18F27K40 i2c LCD fails but 18F2320 works
Posted: Wed Aug 16, 2023 10:42 pm
Hi - I recently revived a mature FC7 (7.3.0.5) project. It was originally developed on FC7 and has worked well for years.
The project originally used 16F886 or 18F2320 chips interchangeably. It still compiles under FC7 and works with those chips.
However, I now need to move to 18F27K40 chips for this design. I changed the project options accordingly. The updated code compiles correctly, as with the older chips, and uploads to the hardware without error.
Unfortunately, with the 18F27K40 the i2c LCD doesn't work if the "i2c Config Channel" is set to "Channel 1" (hardware). The LCD_start macro hangs (never returns).
The 18F27K40 simulates correctly within Flowcode. With the actual hardware it fails when it hits the LCD_start macro.
If I change the "i2c Config Channel" from "Channel 1" to "Software" it works, but is very slow...about the speed of a 300 baud modem (for those old enough to remember those days )
I'm licensed for FC7 but tried the code with a friend's FC8 and FC9...same thing. The 18F27K50 simulates correctly but the LCD won't run on the actual hardware.
I've gone over all my chip parameters but can't identify why the i2c hardware component works with the 16F886 and 18F2320 but not the 18F27K40. I'm happy to post my code but wanted to ask first if anybody offhand knows the likely reason.
I've attached screenshots of my chip configs, which is where it seems the problem would be, but I can't identify any issues.
I've tried adding C code statements "OSCFRQ = 0x08; // from INT_OSC helper" and "WPUC = 0xFF; // port c weak pullups enabled" to no avail.
Any thoughts or assistance would be very welcome. Thanks.
The project originally used 16F886 or 18F2320 chips interchangeably. It still compiles under FC7 and works with those chips.
However, I now need to move to 18F27K40 chips for this design. I changed the project options accordingly. The updated code compiles correctly, as with the older chips, and uploads to the hardware without error.
Unfortunately, with the 18F27K40 the i2c LCD doesn't work if the "i2c Config Channel" is set to "Channel 1" (hardware). The LCD_start macro hangs (never returns).
The 18F27K40 simulates correctly within Flowcode. With the actual hardware it fails when it hits the LCD_start macro.
If I change the "i2c Config Channel" from "Channel 1" to "Software" it works, but is very slow...about the speed of a 300 baud modem (for those old enough to remember those days )
I'm licensed for FC7 but tried the code with a friend's FC8 and FC9...same thing. The 18F27K50 simulates correctly but the LCD won't run on the actual hardware.
I've gone over all my chip parameters but can't identify why the i2c hardware component works with the 16F886 and 18F2320 but not the 18F27K40. I'm happy to post my code but wanted to ask first if anybody offhand knows the likely reason.
I've attached screenshots of my chip configs, which is where it seems the problem would be, but I can't identify any issues.
I've tried adding C code statements "OSCFRQ = 0x08; // from INT_OSC helper" and "WPUC = 0xFF; // port c weak pullups enabled" to no avail.
Any thoughts or assistance would be very welcome. Thanks.