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 - MAXMIN.pbp

PICBASIC PRO program to demonstrate MAX/MIN Operators. Uses MAX and MIN operators to Bound [0..9] to [3..7].
' Name        : MAXMIN.pbp
' Compiler    : PICBASIC PRO Compiler 2.6
' Assembler   : PM or MPASM
' Target PIC  : 12F, 16F or 18F
' Hardware    : PC serial connection & terminal for result display
' Oscillator  : 4MHz internal or external
' Keywords    : MAX, MIN, SEROUT
' Description : PICBASIC PRO program to demonstrate MAX/MIN Operators.
' Uses MAX and MIN operators to Bound [0..9] to [3..7].
'

Include "modedefs.bas" ' Include serial modes

SO Con 0               ' Define serial out pins
B0 Var byte
B1 Var byte

mainloop:
   For B0 = 0 To 9         ' B0 = 0..9
     B1 = B0 Max 3 Min 7   ' B1 = B0 Bounded to [3..7]
     Serout 0,N2400,[#B0," ",#B1,10,13] ' Display results
   Next B0
   Serout 0,N2400,[10]     ' Line Break
   Goto mainloop           ' Forever

   End

           

Download the program file.