General Sample Code for PicBasic™

2k.pbc Demo program of table use past 2K
adc71.pbc PEEK and POKE Commands - Access 16C71 A/D using Peek and Poke
blink.pbc Example program from manual to blink an LED connected to RB0 about once a second
button.pbc Demonstrate BUTTON command. Prints working variable (in this case B0) to show how auto-repeat works. Prints "PRESS" when button is pressed or repeated.
ee.pbc Demonstrate commands for EEPROM. Works on 16C84 and 16Fxxx targets only!!! Initialized address 0..5 and 9. Writes 10..63. This leaves addresses 6..8 undefined (assuming your programmer doesn't unconditionally program all EEPROM locations).
flash1.pbc Blinks LED using HIGH and LOW commands to control specified pin.
flash2.pbc Blinks LED using Direction and Data bit variables.
flash3.pbc Blinks LED using Bit Math
flash4.pbc Blinks LED using For..Next Loops. Uses Nap for Low Power & Good Measure!!!
for.pbc FOR..NEXT Command - Prints series of numbers showing STEP facility. Inner-loop locks up when step size reaches zero (because loop never increments).
high92x.pbc Access high register banks in 16C92x
i2c8.pbc I2CIN and I2COUT Commands - Write address to the first 16 locations of an external serial EEPROM. Read first 16 locations back and send to serial out repeatedly. The control byte and address variable are selected for EEPROM's with 1-byte addressing, such as 24LC01, 24LC02, etc.
i2c16.pbc I2CIN and I2COUT Commands - Write address to the first 16 locations of an external serial EEPROM. Read first 16 locations back and send to serial out repeatedly. The control byte and address variable are selected for EEPROM's with 2-byte addressing, such as 24LC32 and 24LC65
lcd.pbc Demonstrate operation of an LCD in 4-bit mode
logic.pbc Display Truth Table for Binary Logical Operators
lookdown.pbc LOOKDOWN Command - Convert ASCII Hexadecimal characters to numeric equivalents.
lookup.pbc LOOKUP & RANDOM Commands - Convert numeric value to ASCII Hexadecimal equivalents.
minmax.pbc Use MIN and MAX operators to Bound [0..9] to [3..7]
porta.pbc Read and write PortA using Peek and Poke
ps2clock.pbc PicStic-2 Clock Test - Requires Micromint PicStic-2 with JRC6355
ps3adc.pbc PicStic-3 ADC Test - Requires Micromint PicStic-3 with LTC1298
pulsin.pbc PULSIN Command - Serial Pulse Width Meter
pulsout.pbc PULSOUT Command - Variable Pulse Generator. Two buttons adjust from off to 10mSec in 10 uSec steps.
serin.pbc SERIN & SEROUT Commands - Upper case serial filter.
serqual.pbc SERIN Command w/ Qualifiers - "Crude" serial filter for C++ Style Comments
shift.pbc Simulate BS2 Shiftin and Shiftout
sleep.pbc SLEEP Command - Slowly Blink LED Using Low Power Mode Delay
sound.pbc SOUND Command - Make random computer-like noises. More refinement might make sound effects realistic enough to convince your boss you're working when you're really just playing Doom!!!
usart.pbc Read and write hardware USART using Peek and Poke. For 16C63, 65(A), 73(A), 74(A).