dr_when
New Member
Hi,
New here, but thought I would try after not finding a solution as of yet. I have been using the Oshonsoft Basic Compiler for Pic for a number of years and have always managed to work around problems that I have had. I have gotten frustrated at times with how Vladimir has handled his dev tools but I keep reminding myself that the cost is pretty low.
I am currently trying to use a pcf8574t based LCD backpack that works just fine with Arduino boards. I am trying to get it to work with the 12f675. As I examine the data captures I have made with a Saleae Logic device, my low level commands are messed up. I cannot seem to send commands using a slave address of 0x27 which is what the pcf8574 wants. The address comes out as 0x13 and read/write depending on my sending 0x27 or 0x26. Before I resort to writing something in assembly to do this I thought I would reach out and see if anyone can shine more light on Vladimir's I2c commands. Perhaps I am doing something wrong
I have to say I have had some pretty complex pieces of code run with no issues but this has me stumped. Any ideas? Thanks in advance.
Here is what I have tried. Also changed 0x27 to 0x26 for read/write.
UPDATE: If I use an I2C slave address of 0x4e, it gets shifted in as 0x27 and works correctly. This has the feeling of a bug. Attached is a capture of what I get when sending 0x4e instead of 0x27 which is the real slave address.
Define CONFIG = 0x0194
'attempt i2c lcd backpack on 12f675
'*************************************************
'adjust osccal
ASM: Call 0x03ff
ASM: bsf status,5
ASM: movwf OSCCAL
ASM: bcf status,5
'*************************************************
CMCON = 7
ANSEL = 0
Symbol SCL = GPIO.2
Symbol SDA = GPIO.1
Dim slave_addr As Byte
slave_addr = 0x27
'*************************************************************************
I2CPrepare SDA, SCL
WaitMs 500
I2CStart
I2CSend slave_addr
I2CSend 0x30
I2CStop
WaitUs 500
I2CStart
I2CSend slave_addr
I2CSend 0x34
I2CStop
End
New here, but thought I would try after not finding a solution as of yet. I have been using the Oshonsoft Basic Compiler for Pic for a number of years and have always managed to work around problems that I have had. I have gotten frustrated at times with how Vladimir has handled his dev tools but I keep reminding myself that the cost is pretty low.
I am currently trying to use a pcf8574t based LCD backpack that works just fine with Arduino boards. I am trying to get it to work with the 12f675. As I examine the data captures I have made with a Saleae Logic device, my low level commands are messed up. I cannot seem to send commands using a slave address of 0x27 which is what the pcf8574 wants. The address comes out as 0x13 and read/write depending on my sending 0x27 or 0x26. Before I resort to writing something in assembly to do this I thought I would reach out and see if anyone can shine more light on Vladimir's I2c commands. Perhaps I am doing something wrong
I have to say I have had some pretty complex pieces of code run with no issues but this has me stumped. Any ideas? Thanks in advance.
Here is what I have tried. Also changed 0x27 to 0x26 for read/write.
UPDATE: If I use an I2C slave address of 0x4e, it gets shifted in as 0x27 and works correctly. This has the feeling of a bug. Attached is a capture of what I get when sending 0x4e instead of 0x27 which is the real slave address.
Define CONFIG = 0x0194
'attempt i2c lcd backpack on 12f675
'*************************************************
'adjust osccal
ASM: Call 0x03ff
ASM: bsf status,5
ASM: movwf OSCCAL
ASM: bcf status,5
'*************************************************
CMCON = 7
ANSEL = 0
Symbol SCL = GPIO.2
Symbol SDA = GPIO.1
Dim slave_addr As Byte
slave_addr = 0x27
'*************************************************************************
I2CPrepare SDA, SCL
WaitMs 500
I2CStart
I2CSend slave_addr
I2CSend 0x30
I2CStop
WaitUs 500
I2CStart
I2CSend slave_addr
I2CSend 0x34
I2CStop
End
Attachments
Last edited: