english français deutsch
italiano portugese español

PicBasic Pro Compiler Code Samples

A collection of sample programs for use with the PicBasic Pro Compiler from MicroEngineering Labs.

PicBasic Pro Compiler Sample Code - 767pwm.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate the steps necessary to use hardware PWM channel 3 on the 16F767 (and similar devices).

source code

PicBasic Pro Compiler Sample Code - 7segment.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate 7-segment LED display. Schematic can be found at http://melabs.com/resources/articles/ledart.htm (fig 6).

source code

PicBasic Pro Compiler Sample Code - a2d10.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to display result of 10-bit A/D conversion on LCD. Connect analogue input to channel-0 (RA0).

source code

PicBasic Pro Compiler Sample Code - a2d8.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to display result of 8-bit A/D conversion on LCD. Connect analogue input to channel-0 (RA0).

source code

PicBasic Pro Compiler Sample Code - adcin10.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to display result of 10-bit A/D conversion on LCD. Connect analogue input to channel-0 (RA0).

source code

PicBasic Pro Compiler Sample Code - adcin8.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to display result of 8-bit A/D conversion on LCD. Connect analogue input to channel-0 (RA0).

source code

PicBasic Pro Compiler Sample Code - asmint.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate interrupts in assembly language. Turn LED on. Interrupt on PORTB.0 (INTE) turns LED off. Program waits 0.5 seconds and turns LED back on.

source code

PicBasic Pro Compiler Sample Code - bcd.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate conversion to and from BCD.

source code

PicBasic Pro Compiler Sample Code - blink.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to to blink an LED connected to PORTB.0 about once a second.

source code

PicBasic Pro Compiler Sample Code - button.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate the BUTTON command. Prints working variable (in this case B0) to show how auto-repeat works. Prints "PRESS" when button is pressed or repeated.

source code

PicBasic Pro Compiler Sample Code - case.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate the SELECT CASE... CASE... END SELECT structure. Each loop results in the same output using slightly different conditions.

source code

PicBasic Pro Compiler Sample Code - div32.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate the DIV32 command. DIV32 must be used immediately after a multiply statement in order to retain the state of the internal registers of the device.

source code

PicBasic Pro Compiler Sample Code - ee.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate the EEPROM, READ and WRITE commands. Works on targets with data EE only! Initialized address 0..3 and 8. Writes 10..63.

source code

PicBasic Pro Compiler Sample Code - ee12ce.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate the I2CREAD and I2WRITE commands. Writes to the first 16 locations of internal I2C EEPROM, then reads first 16 locations back and sends via serial out repeatedly. For PIC12CE67x microcontrollers.

source code

PicBasic Pro Compiler Sample Code - ee16ce.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate the I2CREAD and I2WRITE commands. Writes to the first 16 locations of internal I2C EEPROM. Reads first 16 locations back and sends to serial out repeatedly. For PIC16CE62x microcontrollers.

source code

PicBasic Pro Compiler Sample Code - eeword.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate how to READ and WRITE word variables to on-board EEPROM. Word is used to add 1000 to each location address and store the result. The word data must be stored as 2 separate bytes.

source code

PicBasic Pro Compiler Sample Code - for.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate the FOR... NEXT command. Prints series of numbers showing STEP facility.

source code

PicBasic Pro Compiler Sample Code - hardpwm.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate hardware PWM. Output is a 1KHz signal with duty cycle sweeping from 20% to 80% once per second. PWM output will be on the CCP1 pin. Register names are for the PIC16F87x devices.

source code

PicBasic Pro Compiler Sample Code - hser.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate sending and receiving with the hardware serial port. Defaults to 2400 bps.

source code

PicBasic Pro Compiler Sample Code - i2c.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate the I2CREAD and I2WRITE commands. Writes to the first 16 locations of an external serial EEPROM, then reads first 16 locations back and sends via serial out repeatedly. For EEPROMS with byte-sized address.

source code

PicBasic Pro Compiler Sample Code - i2cee12.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate the I2CREAD and I2WRITE commands with internal EEPROM on 12-bit core. Writes to the first 16 locations of internal I2C EEPROM, then reads first 16 locations back and sends to serial out repeatedly. Tested on 12CE519. Outputs A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P.

source code

PicBasic Pro Compiler Sample Code - i2cee625.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate the I2CREAD and I2WRITE commands. Writes to the first 16 locations of internal I2C EEPROM. Reads first 16 locations back and sends to serial out repeatedly. For PIC16CE62x microcontrollers.

source code

PicBasic Pro Compiler Sample Code - i2cee674.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate the I2CREAD and I2WRITE commands. Writes to the first 16 locations of internal I2C EEPROM. Reads first 16 locations back and sends to serial out repeatedly. For PIC12CE67x microcontrollers.

source code

PicBasic Pro Compiler Sample Code - i2cmast.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to read and write to I2C slave. Writes a 1-byte offset value, pauses, then reads an 8 character string from the slave. Expects to find the ADC conversion value (- offset) in the 6th position of the string.

source code

PicBasic Pro Compiler Sample Code - i2cslave.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate the operation of an I2C slave.

source code

PicBasic Pro Compiler Sample Code - lcd.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate the operation of an LCD in 4-bit mode.

source code

PicBasic Pro Compiler Sample Code - logic.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to display truth table for binary logical operators.

source code

PicBasic Pro Compiler Sample Code - lookdown.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate the LOOKDOWN command. Converts ASCII hexadecimal characters to numeric equivalents.

source code

PicBasic Pro Compiler Sample Code - lookup.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate the LOOKUP and RANDOM commands. Converts numeric value to ASCII hexadecimal equivalents.

source code

PicBasic Pro Compiler Sample Code - maxmin.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate the MAX and MIN operators. Uses MAX and MIN operators to bound [0..9] to [3..7].

source code

PicBasic Pro Compiler Sample Code - onewire.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate 1-wire temperature display with the LAB-X1 and the DS1820 1-wire temperature sensor.

source code

PicBasic Pro Compiler Sample Code - onint.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate use of ON INTERRUPT interrupts in BASIC. Turn LED on. Interrupt on PORTB.0 (INTE) turns LED off. Program waits 0.5 seconds and turns LED back on.

source code

PicBasic Pro Compiler Sample Code - pulsin.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate use of the PULSIN command with Serial Pulse Width Meter.

source code

PicBasic Pro Compiler Sample Code - pulsout.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate use of the PULSOUT command for a Variable Pulse Generator. Two buttons adjust from off to 10ms in 10 us steps.

source code

PicBasic Pro Compiler Sample Code - sdfs3.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro 2.50L test program to talk to FAT16 formatted MMC/SD cards with PIC18F4550. This is only a test program that is part of a larger project. The complete fileset with schematic, includes and details can be found at http://melabs.com/resources/samples/pbp/sdfs3.zip

source code

PicBasic Pro Compiler Sample Code - ser2mod.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate the use of modifiers with the SERIN2 and SEROUT2 commands.

source code

PicBasic Pro Compiler Sample Code - serin.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate use of the SERIN and SEROUT commands with upper case serial filter.

source code

PicBasic Pro Compiler Sample Code - serqual.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate use of the SERIN command with qualifiers for a "Crude" serial filter for C style comments.

source code

PicBasic Pro Compiler Sample Code - shift.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate the SHIFTIN and SHIFTOUT commands.

source code

PicBasic Pro Compiler Sample Code - sleep.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate the SLEEP command. Slowly blinks an LED using low power mode delay.

source code

PicBasic Pro Compiler Sample Code - sound.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate the SOUND command. Makes random computer-like noises.

source code

PicBasic Pro Compiler Sample Code - spimast.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to read and write to SPI slave using the hardware synchronous serial port. Connect SDI(master) to SDO(slave), SDO(master) to SDI(slave) and SCK(master) to SCK(slave). Common ground is required. Sends ascii "?" to request data, waits for a "!" to begin receiving data. Expects to find the ADC conversion value in the 6th position of the received string.

source code

PicBasic Pro Compiler Sample Code - spislave.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate the operation of an SPI slave. Common ground is required. See spimast.pbp for connections.

source code

PicBasic Pro Compiler Sample Code - usart.pbp

Picbasic Pro Compiler Product Thumb

PicBasic Pro program to demonstrate reading and writing the hardware serial port without HSERIN and HSEROUT. Defaults to 2400 bps.

source code

Page Updated:
20/12/11

Visa Credit
Mastercard
Visa Debit
Maestro
Visa Electron
Paypal

Tel: +44 7814 044 754 - Fax: +44 8715 283 948 - Skype: warburtech.co.uk

Warburton Technology, 33 Selkirk Close, Wimborne, Dorset, BH21 1TN, United Kingdom

VAT Number: GB 846 917 877