Megahertz
- 17th December 2010, 13:22
Is it correct to do the following:
abc var word[2]
abc=0
loop:
abc=abc+1
if abc=80000 then
high LED
abc=0
endif
goto loop
HenrikOlsson
- 17th December 2010, 14:25
Hi,
No, that's not OK. If you have PBP250 or above you can use longs (switch compiler to PBPL) and do:
abc VAR LONG 'Declare abc as a 32bit variable
If you don't have PBPL you can either use N-bit-Math (Darrels math routines) or do something like (not tested)
abc var WORD
abc_ten_thousands VAR WORD
MainLoop:
abc = abc + 1
If abc = 10000 then
abc_ten_thousands = abc_ten_thousands + 1
abc = 0
Endif
If abc ten_thousands = 80 then
High LED
abc = 0
abc_ten_thousands = 0
EndIf
Goto MainLoop
Also, note that the word Loop is a reseved word in newer versions of PBP.
Powered by vBulletin® Version 4.1.7 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.