A quick question.....


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2009
    Location
    London
    Posts
    251

    Default A quick question.....

    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

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,516


    Did you find this post helpful? Yes | No

    Default

    Hi,
    No, that's not OK. If you have PBP250 or above you can use longs (switch compiler to PBPL) and do:
    Code:
    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)
    Code:
    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.

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts