Custom Search

Blassic PIC I2C I/O with Peek & Poke

Here is a little (extended)Blassic program to read the PIC 16F876A I2C Slave.

It first sets up the I2C Address.

Then, Writes commands to read the PIC Serial Port, Toggling Port A,1 every New Line.

The program exits if a “!” is received.

midge# more PeekPokeTest.bas
10 POKE 34,46 :  REM our chip at 2e
20 POKE 35,3 :  REM select serial port
30 a = PEEK(35) REM Get a serial Char (0 if none ready)
40 IF a = 0 THEN GOTO 30
50 PRINT CHR$(a);
55 IF a <> 13 THEN GOTO 60
56 POKE 35,5 : REM toggle port A1
57 POKE 35,3 : REM back to serial port
60 IF a <> 33 THEN 30
midge#

Tags: , , ,

Leave a Reply


Powered by WebRing.