ME Labs, Inc.
719-520-5323
 
Home:
  Developer Resources:

Programming Clues
    Sample Programs
   
    PICBASIC PRO™
Compiler Manual
    PICBASIC™ Compiler
Manual
    Serin2/Serout2 Modes
    ASCII Character Set
    Number Conversion
    Floating Point
Routines
    PBP Debug Monitor
    Articles and Tutorials

Hardware Clues
    Parts / Vendor List
    PICPROTO™ Boards
    LAB-X1 Docs
    LAB-X2 Docs
    LAB-X20 Docs
    LAB-X3 Docs
    LAB-X4 Docs
    LAB-XUSB Docs
    LAB-XT Docs
     
 

ME Labs, Inc. | 1-719-520-5323 | Example Program - FOR.pbp

PICBASIC PRO program demonstrating FOR..NEXT Command. Prints series of numbers showing STEP facility.
' Name        : FOR.pbp
' Compiler    : PICBASIC PRO Compiler 2.6
' Assembler   : PM or MPASM
' Target PIC  : 12F, 16F, 18F
' Hardware    : Non specific
' Oscillator  : internal or external
' Keywords    : FOR, NEXT, SEROUT, STEP
' Description : PICBASIC PRO program demonstrating FOR..NEXT Command.
' Prints series of numbers showing STEP facility.
'

Include "modedefs.bas"  ' Include serial modes

SO Con 0                ' Define serial output pin
B0 Var byte
B1 Var byte

mainloop:
   For B0 = 3 To 1 Step -1    ' Countdown step size
     For B1 = 0 To 10 Step B0 ' Count to 10 (or so)
       Serout SO,N2400,[#B1," "]
     Next B1
     Serout SO,N2400,[13,10]  ' End of line
     Pause 100                ' Delay
   Next B0
   Goto mainloop

   End

           

Download the program file.