Useing Pollxxx commands to react to input faster
WT in Indiana
Posts: 5
I need to react to a pin going high very fast and I read that the Poll in command could help me do that but for the life of me I cannot figure it out.
Heres what I have (cliff notes)
**********************************
loop:
BUTTON 0,1,10,400,B2,0,Label1
PULSOUT 10, 650
PULSOUT 1,3750
GOTO loop:
************************
I may have misunderstood that I can use the pollin command to execute a subroutine stored in eeprom.
but I can't figure out how
can I put the pulse out command in Slot 0 and do a loop and wait for the input on port 0 to go high
if so how do I write the pulsout command into memory and trigger the program to execute
Heres what I have (cliff notes)
**********************************
loop:
BUTTON 0,1,10,400,B2,0,Label1
PULSOUT 10, 650
PULSOUT 1,3750
GOTO loop:
************************
I may have misunderstood that I can use the pollin command to execute a subroutine stored in eeprom.
but I can't figure out how
can I put the pulse out command in Slot 0 and do a loop and wait for the input on port 0 to go high
if so how do I write the pulsout command into memory and trigger the program to execute
Comments
Forget the Cliff Notes ... what, specifically, are you trying to accomplish. The solution may be simpler than you imagine.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
I have an input trigger going high for 2 msec
I need to delay 750uS after the front edge of that trigger and pull the output line low for 3 msec.
the timing of the delay needs to be programmable and precise
Ohh yeah, It needs to be done soon with only the parts I have on hand
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
is there a way to use the pollin in command to trigger a command set ?
Reset:
· HIGH OutLine
Main:
· DO : LOOP UNTIL (InLine = 1)··· ' wait for input to go high
· PULSOUT SparePin, 300·········· ' delay·from front end
· PULSOUT OutLine, 1500·········· ' pull output line low
· GOTO Main
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
delay=650
POLLIN 0,1 ' target state is 1 on p0
POLLOUT 10,1 ' you don't really need this, see below
POLLMODE 2 ' enable polling
POLLWAIT 8 ' sit here until p0->1
PULSOUT 10, delay ' program delay
PULSOUT 1,3750
The latency is deterministic. There is the delay for the POLLWAIT itself (around 190 microseconds for a BS2pe, or around 130 microseconds for a BS2px), plus the delay to interpret the PULSOUTs. On a BS2px, the minimum delay to the leading edge of your second PULSOUT is about 300 microseconds (That being with delay=0)
The POLLOUT command is not necessary, but with a 'scope it lets you investigate the latency of the POLLWAIT command.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Super Duper perfect. This will open up several options
I use the basic stamp at a major engine manufacture to do small project boxes to aid in R&D.
I've been programming BS since the BS1 came out and this just goes to prove that you never know anything and there's always someone out there to learn from
Thanks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
The latched POLLIN states are also useful for capturing events in the background, for later processing. That makes use of scratchpad locations that store the status of the pins. Here are some snippits...
http://www.emesys.com/BS2pe.htm#spram_specials
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com