dsPIC Read for Pulse In
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
- Contact:
dsPIC Read for Pulse In
Hello everyone
Does anyone want to help get dsPIC to read pulse in to work?
Wish to use Pulse In [E1] and or [E2]
Want to be able to read the square frequency between 0 and 400
Can't see any result in the display...
File attached:
Does anyone want to help get dsPIC to read pulse in to work?
Wish to use Pulse In [E1] and or [E2]
Want to be able to read the square frequency between 0 and 400
Can't see any result in the display...
File attached:
Best Regard
Monie
Monie
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: dsPIC Read for Pulse In
Hi Monie,
Just a couple of observations:
The timeout may never occur, because .Return will never be greater than .Timeout (0xFFFFFFFF) due to rollover.
You are reading E.1 which is UART0 RX, is that intended?
The MIAC inputs I1 and I2 are connected to B.0 and B.1 (see the dsPIC chip view)
Hope that helps,
Leigh
Just a couple of observations:
The timeout may never occur, because .Return will never be greater than .Timeout (0xFFFFFFFF) due to rollover.
You are reading E.1 which is UART0 RX, is that intended?
The MIAC inputs I1 and I2 are connected to B.0 and B.1 (see the dsPIC chip view)
Hope that helps,
Leigh
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
- Contact:
Re: dsPIC Read for Pulse In
Hi LeighM
Thanks for the answer.
These were some codes I found on the forum.
Do you have an idea on how to read pulses on Input on I6 or I7
Thanks for the answer.
These were some codes I found on the forum.
Do you have an idea on how to read pulses on Input on I6 or I7
Best Regard
Monie
Monie
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: dsPIC Read for Pulse In
Hi Monie,
The dsPIC MIAC inputs I3 - I8 can only be read as analogue inputs, hence can only read relatively slow inputs.
(The MIAC component macos do have a digital read, but they just take an analogue reading and compare it with a threshold value)
The dsPIC MIAC inputs I3 - I8 can only be read as analogue inputs, hence can only read relatively slow inputs.
(The MIAC component macos do have a digital read, but they just take an analogue reading and compare it with a threshold value)
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
- Contact:
Re: dsPIC Read for Pulse In
Hi LeighM
Thanks for the answer.
I do not understand how to read digital in another way?
Component of Miac_dsPic I can read that there are Inputs 1-8 InputDIGITAL?????
So I do not understand how I can read these InputDIGITAL otherwise.
Do you have a simple code eksemple on how I can read the Pulse In with dsPIC?
Thanks for the answer.
I do not understand how to read digital in another way?
Component of Miac_dsPic I can read that there are Inputs 1-8 InputDIGITAL?????
So I do not understand how I can read these InputDIGITAL otherwise.
Do you have a simple code eksemple on how I can read the Pulse In with dsPIC?
Best Regard
Monie
Monie
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
- Contact:
Re: dsPIC Read for Pulse In
Hi LeighM
Thanks for the answer.
I have to ask you another question?
Would you like to help solve the problem with getting read out Date;-)
Please see below and attached coder...
But in practice will only show the bottom line as "Data is // When simulating in Flowcode is shown as below
The bottom line "Date is 00/00/00 Has attached file: Thank you very much
Excuses a lot but can't get Date printed![Wink ;-)](./images/smilies/icon_wink.gif)
Thanks for the answer.
I have to ask you another question?
Would you like to help solve the problem with getting read out Date;-)
Please see below and attached coder...
But in practice will only show the bottom line as "Data is // When simulating in Flowcode is shown as below
The bottom line "Date is 00/00/00 Has attached file: Thank you very much
Excuses a lot but can't get Date printed
![Wink ;-)](./images/smilies/icon_wink.gif)
Best Regard
Monie
Monie
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: dsPIC Read for Pulse In
Hi Monie,
Need to make the string buffers large enough to include space for the null terminator ...
Need to make the string buffers large enough to include space for the null terminator ...
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
- Contact:
Re: dsPIC Read for Pulse In
Hi LeighM
Thanks for the answer.
It was something that worked![Wink ;-)](./images/smilies/icon_wink.gif)
Thank you very much for your help.
Have a really good working day
Thanks for the answer.
It was something that worked
![Wink ;-)](./images/smilies/icon_wink.gif)
Thank you very much for your help.
Have a really good working day
Best Regard
Monie
Monie
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
- Contact:
Re: dsPIC Read for Pulse In
Hi LeighM
Can you see where in Micro "Date" can view 2010 and not just 19
Have tried a lot but without luck![Wink ;-)](./images/smilies/icon_wink.gif)
Can you see where in Micro "Date" can view 2010 and not just 19
Have tried a lot but without luck
![Wink ;-)](./images/smilies/icon_wink.gif)
Best Regard
Monie
Monie
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: dsPIC Read for Pulse In
Hi Monie,
You will need two separate print macros, PrintTime() and PrintDate()
PrintDate() will need to have PrintString("20") before PrintString(.t3)
You will need two separate print macros, PrintTime() and PrintDate()
PrintDate() will need to have PrintString("20") before PrintString(.t3)
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
- Contact:
Re: dsPIC Read for Pulse In
Hi LeighM
All time suggestions now work Time and Date as I wanted
Thanks for your patience![Wink ;-)](./images/smilies/icon_wink.gif)
All time suggestions now work Time and Date as I wanted
Thanks for your patience
![Wink ;-)](./images/smilies/icon_wink.gif)
Best Regard
Monie
Monie
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
- Contact:
Re: dsPIC Read for Pulse In
Hi every one
Regarding: MIAC dsPIC Read for PulseIn
Cannot count PulsIn up to eg 100
Only count the PulseIn up to 2
Do you have a suggestion on how to read PulsIn up to eg 100 ???
Attached file:
Regarding: MIAC dsPIC Read for PulseIn
Cannot count PulsIn up to eg 100
Only count the PulseIn up to 2
Do you have a suggestion on how to read PulsIn up to eg 100 ???
Attached file:
Best Regard
Monie
Monie
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: dsPIC Read for Pulse In
Hi Monie,
You will need to use a different variable to count the pulses, not PulsIn.
When you read the MIAC digital input into variable PulsIn it will overwrite the value with 1 or 0
Also you will need to ensure that the pulse counter only increments on the change of digital input from 0 to 1
Try this ...
You will need to use a different variable to count the pulses, not PulsIn.
When you read the MIAC digital input into variable PulsIn it will overwrite the value with 1 or 0
Also you will need to ensure that the pulse counter only increments on the change of digital input from 0 to 1
Try this ...
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
- Contact:
Re: dsPIC Read for Pulse In
Hi LeighM
Sorry for first responding now![Wink ;-)](./images/smilies/icon_wink.gif)
Have been to Germany to see the Bremerhaven cruise ship.
Will test your code suggestions
Many thanks for the proposal
Sorry for first responding now
![Wink ;-)](./images/smilies/icon_wink.gif)
Have been to Germany to see the Bremerhaven cruise ship.
Will test your code suggestions
Many thanks for the proposal
Best Regard
Monie
Monie
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
- Contact:
Re: dsPIC Read for Pulse In
Hi LeighM
I can't make the counter work.
Is it something you want to help with?
Can see the pulses on InputDIGITAL!
But no pulses printed on display...
What makes the file PulseIn Previous? Attached file:
I can't make the counter work.
Is it something you want to help with?
Can see the pulses on InputDIGITAL!
But no pulses printed on display...
What makes the file PulseIn Previous? Attached file:
Best Regard
Monie
Monie
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: dsPIC Read for Pulse In
Hi Monie,
Try this
Try this
- Attachments
-
- PulsIn(1).fcfx
- (9.4 KiB) Downloaded 214 times
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
- Contact:
Re: dsPIC Read for Pulse In
Hi LeighM
With your help, I got the variable to count the pulses now!
Many thanks for your help
With your help, I got the variable to count the pulses now!
Many thanks for your help
Best Regard
Monie
Monie