Shop OBEX P1 Docs P2 Docs Learn Events
Timeout — Parallax Forums

Timeout

RandyRandy Posts: 79
edited 2006-08-21 15:03 in BASIC Stamp
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

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-08-21 01:14
    Randy,

    ·· 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
  • RandyRandy Posts: 79
    edited 2006-08-21 14:52
    Hi Chris,
    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.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-08-21 15:03
    Randy,

    ·· 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.· =)· Anyway, in true (non-inverted) baud mode the default idle state of the line is high or 5V in this case.· So the line should normally be high or floating with no data, depending on whether or not the lin is input or output.· I hope this helps.· Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
Sign In or Register to comment.