signal reading error

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
nuwan5213
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

Post by nuwan5213 »

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
Attachments
constant_stich_sawing.fcf
(3.5 KiB) Downloaded 223 times
Electronics for better world.

medelec35
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

Post by medelec35 »

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
Attachments
sucker4.fcf
(14 KiB) Downloaded 233 times
Martin

nuwan5213
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

Post by nuwan5213 »

hi martin,
thanks for reply.
sorry for the empty flow chart.
hear is again check this out.
regards,
nuwan. :)
Attachments
constant_stich_sawing.fcf
(16.16 KiB) Downloaded 226 times
Electronics for better world.

nuwan5213
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

Post by nuwan5213 »

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. :(
Electronics for better world.

Post Reply