logo image - link to home page

| Products | PicBasic | PicBasic Pro | MPLAB | Comp. |

| PicBasic - Instruction | PicBasic Pro - Intruction |

| Win | Demo | Samples | ASCII | Ser. Line | Upgrade | Patches |

 

Sample Code

To save these files to your computer, you may have to right-click the hyperlink and select "Save Target As..." from the context menu.

PicBasic Pro - general

PicBasic Pro - for 18F

PicBasic Pro - for 12F

PicBasic Compiler - general


PicBasic Pro Compiler back to top

a2d10.bas PicBasic Pro program to display result of 10-bit A/D conversion on LCD without using ADCIN.
a2d8.bas PicBasic Pro program to display result of 8-bit A/D conversion on LCD without using ADCIN.
adcin10.bas ADCIN Command - PicBasic Pro program to display result of 10-bit A/D conversion on LCD.
adcin8.bas ADCIN Command - PicBasic Pro program to display result of 8-bit A/D conversion on LCD.
asmint.bas Interrupts in assembly language - Interrupt on PORTB.0 turns LED off. Program waits .5 seconds and turns LED back on.
bcd.bas PicBasic Pro program to demonstrate conversion to and from BCD format
blink.bas Example program from PBP manual to blink an LED connected to PORTB.0 about once a second
button.bas Demonstrate BUTTON command. Prints working variable (in this case B0) to show how auto-repeat works. Prints "PRESS" when button is pressed or repeated.
case.bas (2.40 or later) Demonstrates the use of the SELECT CASE command structure.
div32.bas (2.40 or later) Demonstrates the use of the DIV32 command for 31x15-bit division.
ee.bas Demonstrate commands for EEPROM. Works on PIC16F(C)84 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).
ee12ce.bas Read and Write to internal I2C EEPROM on the 12CExxx devices.
ee16ce.bas Read and Write to internal I2C EEPROM on the 16CExxx devices.
eeword.bas READ and WRITE word variables to on-board EEPROM
for.bas FOR..NEXT Command - Prints series of numbers showing STEP facility.
fp.zip FLOATING POINT ROUTINES - Add, Subtract, Multiply, and Divide using 24 or 32 bit floating point.Ý Includes math libraries and 4 sample programs.Ý
hardpwm.bas PicBasic Pro Program to demonstrate hardware PWM.
i2c.bas I2CREAD and I2WRITE Commands - Write to the first 16 locations of an external serial EEPROM Read first 16 locations back and send to serial out repeatedly. Note: for EEPROMS with byte-sized address
i2cee12.bas I2CREAD and I2WRITE Commands - Internal EEPROM on 12-bit core.
i2cee674.bas I2CREAD and I2WRITE Commands - Write to the first 16 locations of internal I2C EEPROM. Read first 16 locations back and send to serial out repeatedly. For PIC12CE67x MCU's
i2cee625.bas I2CREAD and I2WRITE Commands - Write to the first 16 locations of internal I2C EEPROM. Read first 16 locations back and send to serial out repeatedly. For PIC16CE62x MCU's
i2cslave.bas
i2cmast.bas
PicBasic Pro program to demonstrate the I2C slave function.Ý Use i2cmast.bas to read and write data to the slave device.
lcd.bas PicBasic program to demonstrate operation of an LCD in 4-bit mode
logic.bas Display Truth Table for Binary Logical Operators.
lookdown.bas LOOKDOWN Command - Convert ASCII Hexadecimal characters to numeric equivalents.
lookup.bas LOOKUP & RANDOM Commands - Convert numeric value to ASCII hexadecimal equivalents.
maxmin.bas MAX/MIN Operators - Use MAX and MIN operators to Bound [0..9] to [3..7]
onewire.bas (2.40 or later) OWIN & OWOUT Commands - Interface to the DS1820 temperature sensor with one-wire.
onint.bas On Interrupt - Interrupts in BASIC - Interrupt on PORTB.0 turns LED off.Ý Program waits .5 seconds and turns LED back on.
ps2clock.bas PicStic-2 Clock Test - Requires Micromint PicStic-2 with JRC6355
ps3adc.bas PicStic-3 ADC Test - Requires Micromint PicStic-3 with LTC1298
pulsin.bas PULSIN Command - Serial Pulse Width Meter
pulsout.bas PULSOUT Command - Variable Pulse Generator. Two buttons adjust from off to 10mSec in 10 uSec steps.
ser2mod.bas A collection of examples using Serin2 and Serout2.Ý Demonstrates the uses of modifiers.
serin.bas SERIN & SEROUT Commands - Upper case serial filter.
serqual.bas SERIN Command w/ Qualifiers - "Crude" serial filter for C++ Style Comments
shift.bas SHIFTIN and SHIFTOUT Commands
sleep.bas SLEEP Command - Slowly Blink LED Using Low Power Mode Delay
sound.bas SOUND Command - Make random computer-like noises.
spimast.bas
spislave.bas
PicBasic Pro program to read and write to SPI slave using the synchronous serial port
usart.bas Read and write hardware USART


PicBasic Pro Compiler for PIC18F series MCUs back to top

clock452.bas LCD clock program using On Interrupt
serA452.bas PicBasic Pro program to demonstrate an interrupt-driven input buffer for hardware USART receive using Assembly language interrupt.Ý Pin definitions compatible with LAB-X1 and PIC18F452.


PicBasic Pro Compiler for PIC12F675 MCU back to top

vref675.bas PicBasic Pro program that demonstrates 10-bit analog conversion using the Vref pin on a 12F675.Ý This is a workaround for a bug in PBP version 2.42 that causes the VCFG bit in the ADCON0 register to be overwritten during the execution of ADCIN.


PicBasic Compiler back to top

2k.bas Demo program of table use past 2K
adc71.bas PEEK and POKE Commands - Access 16C71 A/D using Peek and Poke
blink.bas Example program from manual to blink an LED connected to RB0 about once a second
button.bas 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.bas 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.bas Blinks LED using HIGH and LOW commands to control specified pin.
flash2.bas Blinks LED using Direction and Data bit variables.
flash3.bas Blinks LED using Bit Math
flash4.bas Blinks LED using For..Next Loops. Uses Nap for Low Power & Good Measure!!!
for.bas FOR..NEXT Command - Prints series of numbers showing STEP facility. Inner-loop locks up when step size reaches zero (because loop never increments).
high92x.bas Access high register banks in 16C92x
i2c8.bas 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.bas 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.bas Demonstrate operation of an LCD in 4-bit mode
logic.bas Display Truth Table for Binary Logical Operators
lookdown.bas LOOKDOWN Command - Convert ASCII Hexadecimal characters to numeric equivalents.
lookup.bas LOOKUP & RANDOM Commands - Convert numeric value to ASCII Hexadecimal equivalents.
minmax.bas Use MIN and MAX operators to Bound [0..9] to [3..7]
porta.bas Read and write PortA using Peek and Poke
ps2clock.bas PicStic-2 Clock Test - Requires Micromint PicStic-2 with JRC6355
ps3adc.bas PicStic-3 ADC Test - Requires Micromint PicStic-3 with LTC1298
pulsin.bas PULSIN Command - Serial Pulse Width Meter
pulsout.bas PULSOUT Command - Variable Pulse Generator. Two buttons adjust from off to 10mSec in 10 uSec steps.
serin.bas SERIN & SEROUT Commands - Upper case serial filter.
serqual.bas SERIN Command w/ Qualifiers - "Crude" serial filter for C++ Style Comments
shift.bas Simulate BS2 Shiftin and Shiftout
sleep.bas SLEEP Command - Slowly Blink LED Using Low Power Mode Delay
sound.bas 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.bas Read and write hardware USART using Peek and Poke. For 16C63, 65(A), 73(A), 74(A).


Page up-dated at January 17, 2012


GRIFO®
Via dell'Artigiano, 8/6
40016 San Giorgio di Piano
Bologna ITALY

Tel: +39 051 892.052
FAX: +39 051 893.661


homeHome Software Cat. Index