Wednesday 25 April 2012

Picaxe i2c as Slave

Not difficult - but there is one pitfall I fell into.

Having set the slave up to be a slave, it needs to keep looping. It doesn't matter what the loop does (and in a simple application at least, I haven't needed to bother with interrupts).

Example:


#picaxe 20x2
#no_table
symbol counter=b5
HI2CSETUP I2CSLAVE, 20 'sets up with address 20, which I find easier to debug than 010100
main:
inc counter  
goto main


The "main" loop could just have a "pause 5000" in it - but it DOES need to loop

No comments:

Post a Comment