Inter PICAXE serial communications advice? -SOLVED-
January 31, 2012
Main code summary: The 28X2 raises a pin high, triggering the interrupt on the 08M2. The 28X2 then sends a number (1 to 5) via serial connection to the waiting 08M2. The 08M2 then I2Cs the correct bits to an I/O expander to turn on an LED pattern:
for b28 = 1 to 5
LED_code = b28
serout ser_pin,N2400_8,(LED_code) 'set for triggering the interrupt with 08M2
HI2CSETUP I2CMASTER, PCF_byte, i2cfast, i2cbyte 'set for I/O expander I2C
setint %00010000,%00010000 'reset interrupt; rising edge,serint pin
if LED_byte <> LED_byte_hist then
select case LED_byte
case 1 'looking
case 2 'locked
case 3 'alert
case 4 'startup on
hi2cout latch_register, (blue)
hi2cout latch_register, (green)
hi2cout latch_register, (red)
hi2cout latch_register, (white)
hi2cout latch_register, (none)
setint %00010000,%00010000 'reset interrupt; state,pin
Believe me when I tell you the pins are connected correctly like the interrupt going to C.4, etc etc etc. No special resistors involved either. I tried pullups/downs out of frustration and they didn't result in anything different. I can get a non-interrupt version of the program to work fine but the above gets me nothing. I've spent several days on this and I'm having varing degrees of non-success. I'm getting ready to cry blue smoke here.
FWIW I'm trying to get the serial communications done on the C.3 pin of the 08M2 and the C.3 pin of the 28X2. I know the C.3 pin needs an external diode on th 08M2 for serin commands but it doesn't make a difference if it's there or not. I even had the serial byte get picked up on C.4 when it should have been on C.3. I'm chalking that up to a low battery but this is the kind of thing that's making me nuts-o-bonkers-crazy. I even moved the serial in line to C.4 on the 08M2 but the results were the same.
Ok, time for some thumb sucking and then some sleep. Four days wasted on this bug. Thanks for lookin.