Jeremy Harris
Senior Member
A quick question that I can't find an answer to.
I'm trying to measure the time between serin events. I have an RF data link that transmits a handful of characters every ~ 30 seconds or so. I have a simple bit of code that has a serin, then a simple calc that uses the time variable to measure the time since the last data burst, then resets the time variable to zero.
The problem is that the time variable doesn't seem to increment every second when the conditional serin is waiting for data, but stays at zero.
I've used the same technique in the past, but not with a blocking instruction like serin.
I've trimmed the code right down to just a conditional serin, followed by a debug, then resetting time to zero and going back to the start of the loop to try and see why time doesn't seem to work. The loop runs and debug updates around once every 30 seconds, but always returns time as zero, even though around 30 secs has elapsed since time was reset to zero.
What I was hoping was that in the ~30 secs between receiving valid serin data, time would carry on incrementing, so that I could determine roughly how long the elapsed time is between valid data bursts. Sadly it looks as if time doesn't increment, but is blocked by serin. debug shows the received data updating OK, but time stays stuck at zero.
This is running on a 14M2, but I'm not sure if that has any impact on the behaviour.
Can anyone confirm that serin does really block time from updating, please, or is it my finger trouble?
If serin does block time, then I'll just have to find a workaround.
I'm trying to measure the time between serin events. I have an RF data link that transmits a handful of characters every ~ 30 seconds or so. I have a simple bit of code that has a serin, then a simple calc that uses the time variable to measure the time since the last data burst, then resets the time variable to zero.
The problem is that the time variable doesn't seem to increment every second when the conditional serin is waiting for data, but stays at zero.
I've used the same technique in the past, but not with a blocking instruction like serin.
I've trimmed the code right down to just a conditional serin, followed by a debug, then resetting time to zero and going back to the start of the loop to try and see why time doesn't seem to work. The loop runs and debug updates around once every 30 seconds, but always returns time as zero, even though around 30 secs has elapsed since time was reset to zero.
Code:
main:
serin c.4, T1200_4, ("POW"), high_byte, low_byte
debug
time = 0
goto main
This is running on a 14M2, but I'm not sure if that has any impact on the behaviour.
Can anyone confirm that serin does really block time from updating, please, or is it my finger trouble?
If serin does block time, then I'll just have to find a workaround.