hi all.
im tryig to get signal from motor control box and it is 5v and it has very low currnt.then i try to put transistor and its work well.
im going to give rb0 input as a signal.what is the maximum freq: of reading when pic is 20 mhz.
the problem is pic does not grab the signal always.
regards,
nuwan
signal reading error
Moderator: Benj
-
- Posts: 82
- Joined: Thu Jul 29, 2010 10:03 am
- Location: sri lanka
- Has thanked: 24 times
- Been thanked: 4 times
- Contact:
signal reading error
- Attachments
-
- constant_stich_sawing.fcf
- (3.5 KiB) Downloaded 222 times
Electronics for better world.
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: signal reading error
Hi nuwan,
Not sure if intended, the flowchart you posted is empty.
As for reading input at RB0.
I would recommend using portB0 interrupt to read the input rather than polling (keep periodically checking state of input)
Since when portB0 changes state say from low to high, no matter what instruction in main is carried out, as soon as its completed the next address of instruction is pushed on the stack, the interrupt routine is carried out, then the saved address of instruction is retrieved from the stack and all is carried on as normal.
This makes the maximum input frequency much higher than polling.
Whereas with polling inputs, these can easily be missed. E.g input goes high on B0 while reading ADC0 and going back low before reaches i/p component.
It's not missed with the interrupt method.
INT(portB0) interrupt can be set to detect rising edge or falling edge.
I have implemented port int within attached flowchart.
Note: using interrupt, input component is no longer required.
Also I would recommend using a faster crystal if you find detection too slow. The faster the crystal, the higher the frequency input can be. Although using interrupt method you may find 4MHz will suffice.
Martin
Not sure if intended, the flowchart you posted is empty.
As for reading input at RB0.
I would recommend using portB0 interrupt to read the input rather than polling (keep periodically checking state of input)
Since when portB0 changes state say from low to high, no matter what instruction in main is carried out, as soon as its completed the next address of instruction is pushed on the stack, the interrupt routine is carried out, then the saved address of instruction is retrieved from the stack and all is carried on as normal.
This makes the maximum input frequency much higher than polling.
Whereas with polling inputs, these can easily be missed. E.g input goes high on B0 while reading ADC0 and going back low before reaches i/p component.
It's not missed with the interrupt method.
INT(portB0) interrupt can be set to detect rising edge or falling edge.
I have implemented port int within attached flowchart.
Note: using interrupt, input component is no longer required.
Also I would recommend using a faster crystal if you find detection too slow. The faster the crystal, the higher the frequency input can be. Although using interrupt method you may find 4MHz will suffice.
Martin
- Attachments
-
- sucker4.fcf
- (14 KiB) Downloaded 233 times
Martin
-
- Posts: 82
- Joined: Thu Jul 29, 2010 10:03 am
- Location: sri lanka
- Has thanked: 24 times
- Been thanked: 4 times
- Contact:
Re: signal reading error
hi martin,
thanks for reply.
sorry for the empty flow chart.
hear is again check this out.
regards,
nuwan.![Smile :)](./images/smilies/icon_smile.gif)
thanks for reply.
sorry for the empty flow chart.
hear is again check this out.
regards,
nuwan.
![Smile :)](./images/smilies/icon_smile.gif)
- Attachments
-
- constant_stich_sawing.fcf
- (16.16 KiB) Downloaded 226 times
Electronics for better world.
-
- Posts: 82
- Joined: Thu Jul 29, 2010 10:03 am
- Location: sri lanka
- Has thanked: 24 times
- Been thanked: 4 times
- Contact:
Re: signal reading error
hi friends, martin.
is there any method to give interrupt signal to pic .[hardware side].
my signal is getting from synchroniser and it variates 0v and 5v nicely with check analogue multimeter.
thanks and best regards,
nuwan.![Sad :(](./images/smilies/icon_sad.gif)
is there any method to give interrupt signal to pic .[hardware side].
my signal is getting from synchroniser and it variates 0v and 5v nicely with check analogue multimeter.
thanks and best regards,
nuwan.
![Sad :(](./images/smilies/icon_sad.gif)
Electronics for better world.