on the right track?
Death Star Public Relations Officer
Posts: 5
Hi folks. Here is my·program project. I wanted some input as to whether my program framework made sense enough to pursue coding it(described below):
I want to program my SX-48 as a triple-split 16-bit stopwatch·measuring HI signals arriving at three different pins at three arbitrary times within a 65535 count loop.·My program·will scan three pre-designated PINs for HI signals in·the·loop. As each·HI signal·is successively detected, a status variable·is incremented by one, the 16 bit split·value is stored, and the pin that detected a HI is set to output.·The program will ignore scanning a PIN set to output to avoid duplicate times. The loop will terminate when the status variable is binary 3 or 65535 is exceeded.
It is possible, however improbable, that 2 or 3 of the times will arrive at the same time. But that does not matter too much to me at the moment. I also realize that a HI signal may occur while other program instructions are being executed, which may or may not be a significant source of error.
DSRO
I want to program my SX-48 as a triple-split 16-bit stopwatch·measuring HI signals arriving at three different pins at three arbitrary times within a 65535 count loop.·My program·will scan three pre-designated PINs for HI signals in·the·loop. As each·HI signal·is successively detected, a status variable·is incremented by one, the 16 bit split·value is stored, and the pin that detected a HI is set to output.·The program will ignore scanning a PIN set to output to avoid duplicate times. The loop will terminate when the status variable is binary 3 or 65535 is exceeded.
It is possible, however improbable, that 2 or 3 of the times will arrive at the same time. But that does not matter too much to me at the moment. I also realize that a HI signal may occur while other program instructions are being executed, which may or may not be a significant source of error.
DSRO
Comments
I guess alot depends on how accurate you need the measurement to be and what speed the counter is.
Overall it sound do-able.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module" Now available from Parallax for only $28.95
http://www.parallax.com/detail.asp?product_id=30012
"SX-Video OSD module" Now available from Parallax for only·$49.95
http://www.parallax.com/detail.asp?product_id=30015
Product web site: www.sxvm.com
Those that would give up freedom for security will have neither.
·
I'll be running the counter at 14 MHz.
MR. DSRO
Once you know that a specific bit has changed, just remove that bit from the master "AND" mask. For example, if bit 1 is set, then your mask goes from 7 (in binary %00000111) to 5 (in binary %00000101), which will automatically ignore bit 1.
If you're not familiar with boolean operators like AND and OR and how they are used to check or set bits, then now is the time to do some research and get up to speed. Once you do, you'll find you can easily handle bit operations.
Thanks, PeterM
DSPRO