BS2 Timing
CanYouC3D
Posts: 6
Hi All
·
Help!!
·I have a program that needs to read the status of five pins (P5 – P1) and then increment a counter for each pin if they are high an this has to happen in 5mSec.
And I’m stuck with a BS2 because timing of my shiftout and shiftin data.
·
A Stamp User From the Start
Post Edited By Moderator (IT Guy (Parallax)) : 8/14/2004 5:20:12 PM GMT
·
Help!!
·I have a program that needs to read the status of five pins (P5 – P1) and then increment a counter for each pin if they are high an this has to happen in 5mSec.
And I’m stuck with a BS2 because timing of my shiftout and shiftin data.
·
A Stamp User From the Start
Post Edited By Moderator (IT Guy (Parallax)) : 8/14/2004 5:20:12 PM GMT
Comments
·
PS: You're likely to get more help in these forums if you add an appropriate subject title to your post.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
First, you MUST set those pins as inputs.
Next, it looked to me like the poster wanted a separate
count per input pin.
Next, you COULD read all 5 pins at the same time.
CanYouC3D was not clear in the increment values, his post reads to me as if he wants one count per pin high.· If, on the other hand, he does want them have differnt values -- and even more conveniently a binary switch is being used, this will do it:
This is safe code; it masks the other pins on INL so they do not affect the counter.· And just in case the goal is to have a delay that is five milliseconds multiplied by the inputs P1-P5 (binary), this is simple:
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office