Quote Originally Posted by Darrel Taylor View Post
No 65khz does not sound right, and ...
It doesn't throw you to the error label because it always reads 0's on the pin.

An ack from the device is a low pulse. As long as it sees a low when it expects an ack, it will never jump to the label.

OK, it's time for you to pony up some of the info you've been leaving out.

What are your CONFIGs?
What cyrstal are you using?
What DEFINE OSC are you using?
What pins are the SCL and SDA on?

And the rest of the code.
<br>
So, back to the basics.
If not 65kHz is correct, then what should it be?

If I change the device address from $40 to something else for ex. $45 it will throw the program to the error label. That behavior sounds "healthy", doesn't it?

By CONFIGs you mean? See post #1
The crystal is 12MHz
DEFINE OSC 48
The SDA,SCL pins are connected correctly to pins 33,34 + 2x 2k2 pull-ups
Using also Microchip USB HID bootloader v2.2

I2Creg = OLAT1 : I2Cbyte = $ff : gosub writeioextender: pause 20
I2Creg = IODIR1 : I2Cbyte = $ff : gosub writeioextender: pause 20
The current test loop is here:
Loop:
gosub getbattery
if onoffpressed = 1 then powerout = 0

I2Creg = GP1 : gosub readioextender' to IOEbyte
pause 20

lcdout cmd,home3, dec battery/10, ".",dec battery//10,"V ", dec w/100," ", _
dec onoffpressed,cmd,home4, hex2 IOEbyte," "
goto Loop