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

PICBASIC PRO program to display truth table for binary logical operators.
' Name        : LOGIC.pbp
' Compiler    : PICBASIC PRO Compiler 2.6
' Assembler   : PM or MPASM
' Target PIC  : 12F, 16F or 18F
' Hardware    : Serial terminal for results display
' Oscillator  : 4MHz internal or external
' Keywords    : SEROUT, FOR NEXT
' Description : PICBASIC PRO program to display truth table for binary
' logical operators.
'

Include "modedefs.bas"  ' Include serial modes

SO Con 0                ' Define serial output pin
B0 Var Byte
B1 Var Byte
B2 Var Byte

mainloop:
   Serout SO,N2400,["      &  &/ |  |/ ^  ^/",10,13]
   For B0 = 0 To 1
     For B1 = 0 To 1
       Serout SO,N2400,[#B1," ",#B0," : "]
       B2 = B1 & B0  : Gosub disp
       B2 = B1 &/ B0 : Gosub disp
       B2 = B1 | B0  : Gosub disp
       B2 = B1 |/ B0 : Gosub disp
       B2 = B1 ^ B0  : Gosub disp
       B2 = B1 ^/ B0 : Gosub disp
       Serout SO,N2400,[10,13]
     Next B1
   Next B0
   Serout SO,N2400,[10,13]
   Goto mainloop
        
disp:
   B2 = B2 & 1
   Serout SO,N2400,[#B2,"  "]
   Return

   End

           

Download the program file.