Timeout
I have a question about Serin or any command with a timeout. Suppose I am using a driver/receiver that requires being enabled with a high or low to an enable pin before receiving data on another pin and the opposite state after it has received the data. If it doesn’t receive the data before the timeout function it jumps to the Tlabel portion of the program. In the example below will DE simply stay high? No I haven’t had a problem but it seems to be a potential bug depending on what is being driven. Maybe an LED indicating a function is occurring that never turns off as the function has failed rather than occur. Yes I understand that coding in the jumped to Tlabel address could finish things but does it need to?
·
Program code running along to here….
····· HIGH DE
···· ·SEROUT DI, Rbaud,[noparse][[/noparse]"CMD?",CR]
····· SERIN DI, Rbaud, 500, Failedin,[noparse][[/noparse]DEC command]
····· LOW DE
More code…
·
Failedin:
····· More code yet
Thanks, Randy
·
Program code running along to here….
····· HIGH DE
···· ·SEROUT DI, Rbaud,[noparse][[/noparse]"CMD?",CR]
····· SERIN DI, Rbaud, 500, Failedin,[noparse][[/noparse]DEC command]
····· LOW DE
More code…
·
Failedin:
····· More code yet
Thanks, Randy
Comments
·· Regardless of the timeout, the pin is set to an input·at the SERIN command.· Not sure why you're making the pin low afterward, because that will make the pin an output again.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Two diferent pins. The driver/reciever has one pin conected for the SERIN command and another pin conected for enabling the the driver/reciever. The high is for enabling and the low for disabling the chip when SERIN or SEROUT is taking place. I don't suppose it does any harm but if the driver/reciever is not sending or recieving data there is no reason for it to be enabled, thus the low after the SERIN command. The program will only recognize a SERIN or exercise a SEROUT in one slot. Most of the time it is in other slots. I have not looked closely at the posibility but I assume that the POLL functions would not respond to a SERIN while the program is in a different slot? The slot that the program spends most of its time in does not have room for more code and also has several PAUSES in it. This program doesn't need to have that but it could be useful.
·· Sorry, DE/DI looked the same to me last night (Was late)...I tend to use more verbose labels so I don't do that myself.·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com