PST input - Timer that expires with no entry
Hello,
I think there are a bunch of ways to do this, but currently I'm drawing a blank
I'm using spin,
I have a PST loop as below:
Hex_value := $FFFFFFFF PST.Str(string("Enter the hex value to be used - max FFFFFFFF ")) ' get entry from the keyboard on pst start repeat Hex_value := PST.HexIn ' wait for character to be typed PST.Str(string("Value entered: ")) PST.Hex(Hex_Value,8) PST.NewLine quit
I would like the repeat loop to expire after maybe 10 seconds, in case there is no input, or there is no PST connected, so that the program can continue using the default values.
Hex_value := $FFFFFFFF PST.Str(string("Enter the hex value to be used - max FFFFFFFF ")) ' get entry from the keyboard on pst start repeat ' until timer expires Hex_value := PST.HexIn ' wait for character to be typed PST.Str(string("Value entered: ")) PST.Hex(Hex_Value,8) PST.NewLine quit
I searched the forum and I didn't find anything,
any help would be appreciated
regards
Jeff
Comments
You're going to need a customized entry method with a timeout. Have a look at .rxtime() in fullduplexserial.spin to see how you can add a time-out to an input. This feature is not part of the simple PST object.
This works:
I was trying to stay with PST, and this feature is not super important, more of a diag work, so I just used a pin to enable or disable the feature.
results, works great
if you wait for the time to expire you get the default which is 00000000
thanks
Jeff