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.
01' Name        : FOR.pbp
02' Compiler    : PICBASIC PRO Compiler 2.6
03' Assembler   : PM or MPASM
04' Target PIC  : 12F, 16F, 18F
05' Hardware    : Non specific
06' Oscillator  : internal or external
07' Keywords    : FOR, NEXT, SEROUT, STEP
08' Description : PICBASIC PRO program demonstrating FOR..NEXT Command.
09' Prints series of numbers showing STEP facility.
10'
11 
12Include "modedefs.bas"  ' Include serial modes
13 
14SO Con 0                ' Define serial output pin
15B0 Var byte
16B1 Var byte
17 
18mainloop:
19   For B0 = 3 To 1 Step -1    ' Countdown step size
20     For B1 = 0 To 10 Step B0 ' Count to 10 (or so)
21       Serout SO,N2400,[#B1," "]
22     Next B1
23     Serout SO,N2400,[13,10]  ' End of line
24     Pause 100                ' Delay
25   Next B0
26   Goto mainloop
27 
28   End

Download the program file.