Thanks for the reply. I've pulled up the ports and it look like it works now! It is possible to put the LED-driver into the test-mode and to set it back to normal operation.
The only problem is that I can't get a character on the display. To find te problem I've attached a serial cable to the PIC and added some debug commands.
The code I've used:
Include "modedefs.bas"
DEFINE OSC 20
'DEFINE I2C_HOLD 1
SCL VAR PORTB.4
SDA VAR PORTB.5
CommandByte VAR BYTE
SlaveAddress var BYTE
DataByte VAR BYTE
ReadData VAR BYTE
Character VAR BYTE
'Set Debug pin port
DEFINE DEBUG_REG PORTC
'Set Debug pin bit
DEFINE DEBUG_BIT 5
'Set Debug baud rate
DEFINE DEBUG_BAUD 2400
'Set Debug mode: 0 = true, 1 = inverted
DEFINE DEBUG_MODE 1
Init:
Debug "-->> Start <<--", 10 ,13
Debug "Test mode", 10 ,13
SlaveAddress = $A0 'Set the device address at the I2C-bus (datash. p. 10)
CommandByte = $07 'Set the Command Byte ($07 = displaytestmode. Datasheet page 11)
DataByte = $01 'Set the Data Byte
I2CWRITE SDA, SCL, SlaveAddress, CommandByte, [DataByte] 'Write the data to the I2C-device
I2CREAD SDA, SCL, SlaveAddress, [ReadData]
Debug "ReadData = ", dec ReadData ,10 ,13 ,10 ,13
pause 500
Debug "Normal mode", 10 ,13
SlaveAddress = $A0 'Set the device address at the I2C-bus (datash. p. 10)
CommandByte = $07 'Set the Command Byte ($07 = Normal mode. Datasheet page 11)
DataByte = $00 'Set the Data Byte
I2CWRITE SDA, SCL, SlaveAddress, CommandByte, [DataByte] 'Write the data to the I2C-device
I2CREAD SDA, SCL, SlaveAddress, [ReadData]
Debug "ReadData = ", dec ReadData ,10 ,13 ,10 ,13
pause 500
Debug "Set LED intensity 1", 10 ,13
SlaveAddress = $A0 'Set the device address at the I2C-bus (datash. p. 10)
CommandByte = $01 'Set the Command Byte ($01 = Intensity10. Datasheet page 11)
DataByte = $FF 'Intensity of all segments set to maximum (Page 20)
I2CWRITE SDA, SCL, SlaveAddress, CommandByte, [DataByte] 'Write the data to the I2C-device
I2CREAD SDA, SCL, SlaveAddress, [ReadData]
Debug "ReadData = ", dec ReadData ,10 ,13 ,10 ,13
pause 500
Debug "Set LED intensity 2", 10 ,13
SlaveAddress = $A0 'Set the device address at the I2C-bus (datash. p. 10)
CommandByte = $02 'Set the Command Byte ($02 = Intensity32. Datasheet page 11)
DataByte = $FF 'Intensity of all segments set to maximum (Page 20)
I2CWRITE SDA, SCL, SlaveAddress, CommandByte, [DataByte] 'Write the data to the I2C-device
I2CREAD SDA, SCL, SlaveAddress, [ReadData]
Debug "ReadData = ", dec ReadData ,10 ,13 ,10 ,13
pause 500
Debug "Set Scan-Limit", 10 ,13
SlaveAddress = $A0 'Set the device address at the I2C-bus (datash. p. 10)
CommandByte = $03 'Set the Command Byte ($01 = Intensity10. Datasheet page 11)
DataByte = $01 'Intensity of all segments set to maximum (Page 20)
I2CWRITE SDA, SCL, SlaveAddress, CommandByte, [DataByte] 'Write the data to the I2C-device
I2CREAD SDA, SCL, SlaveAddress, [ReadData]
Debug "ReadData = ", dec ReadData ,10 ,13 ,10 ,13
pause 500
Debug "Character 'I'D0,P0&P1", 10 ,13
SlaveAddress = $A0 'Set the device address at the I2C-bus (datash. p. 10)
CommandByte = $60 'Set the Command Byte ($60 = Digit 0 Plane P0 & P1. Datasheet page 11)
DataByte = $49 'Display Character 'I'
I2CWRITE SDA, SCL, SlaveAddress, CommandByte, [DataByte] 'Write the data to the I2C-device
I2CREAD SDA, SCL, SlaveAddress, [ReadData]
Debug "ReadData = ", dec ReadData ,10 ,13 ,10 ,13
Debug "-->> End <<--", 10 ,13 ,10 ,13 ,10 ,13
end
And this is the result at my serial port:
-->> Start <<--
Test mode
ReadData = 0
Normal mode
ReadData = 0
Set LED intensity 1
ReadData = 0
Set LED intensity 2
ReadData = 1
Set Scan-Limit
ReadData = 0
Character 'I'D0,P0&P1
ReadData = 0
-->> End <<--
While the chip is in test-mode, the LED's are all burning. After the testmode, no LED is burning.
Bookmarks