David Presley
New Member
Hi,
I'm using a 14M2 (and PE 6.1.0.0) in a project that needs to transmit data every 15 minutes. After searching the forum and documentation online, it seemed the "time" variable would be perfect for the task. I set the tripwire at a value of 900, thinking 900 seconds = 15 minutes... That's where things went awry.
It took f o r e v e r for the subroutine to be called, and it only happened after I'd given up on it for the night, thinking I must have coded it wrong. Just by circumstance, I was passing by the project's display much later and saw the sub finally being called. (It changes the display to indicate it got there)
Long story, short, I dropped the 900 value down to 10 and used some sertxd calls to determine the 1-second interval was just not happening. Then, it became trial and error to figure out that a value of 75 resulted in approx. 15 minutes.
There are no calls to alter the clock speed, which defaults to 4Mhz on the M2's according to the docs.
In the main body of the code, I have these lines:
let w8 = time
if w8 > 900 then
gosub WiFi_Transmit
endif
The wifi sub is simple for now - it just changes to a dummy display to let me know it got there.
Wi_Fi_Transmit:
<send some text to the display...>
disabletime
let time = 0
enabletime
return
Is there something wrong with this approach, or can anyone shed any light on why 900 seconds took so long?
Thanks in advance.
I'm using a 14M2 (and PE 6.1.0.0) in a project that needs to transmit data every 15 minutes. After searching the forum and documentation online, it seemed the "time" variable would be perfect for the task. I set the tripwire at a value of 900, thinking 900 seconds = 15 minutes... That's where things went awry.
It took f o r e v e r for the subroutine to be called, and it only happened after I'd given up on it for the night, thinking I must have coded it wrong. Just by circumstance, I was passing by the project's display much later and saw the sub finally being called. (It changes the display to indicate it got there)
Long story, short, I dropped the 900 value down to 10 and used some sertxd calls to determine the 1-second interval was just not happening. Then, it became trial and error to figure out that a value of 75 resulted in approx. 15 minutes.
There are no calls to alter the clock speed, which defaults to 4Mhz on the M2's according to the docs.
In the main body of the code, I have these lines:
let w8 = time
if w8 > 900 then
gosub WiFi_Transmit
endif
The wifi sub is simple for now - it just changes to a dummy display to let me know it got there.
Wi_Fi_Transmit:
<send some text to the display...>
disabletime
let time = 0
enabletime
return
Is there something wrong with this approach, or can anyone shed any light on why 900 seconds took so long?
Thanks in advance.