|
ME Labs, Inc. 719-520-5323 |
|
|
|
ME Labs, Inc. | 1-719-520-5323 | Example Program - LOGIC.pbpPICBASIC 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. |
|
Copyright 2019 ME Labs, Inc. PO Box 8250 Asheville NC 28814 (719) 520-5323 (719) 520-1867 fax email: support@melabs.com |
|