Hey all,
Thought I'd post this up for anyone who wants to interface the MAX6956 with a PICAXE via I2C. It's nothing advanced, but will hopefully save someone some time as they're getting started with this chip.
Link to the datasheet if interested: http://datasheets.maxim-ic.com/en/ds/MAX6956.pdf
And the code/diagram:
Charlie
Thought I'd post this up for anyone who wants to interface the MAX6956 with a PICAXE via I2C. It's nothing advanced, but will hopefully save someone some time as they're getting started with this chip.
Link to the datasheet if interested: http://datasheets.maxim-ic.com/en/ds/MAX6956.pdf
And the code/diagram:
Code:
' MAX6956 LED Display Driver and I/O Driver
' Example PICAXE Code and Circuit
'
'
'
' +5V
' +
' |
' '----------------------o------------------o--o--o---------o----------------------------o--
' | | | | | |
' |4k7 | | |4k7 | |
' .-. | .-..-. | |
' | | | | || | | MAX6956 |
' download circuit | | | | || | | __ |
' omitted '-' 18X | '-''-' .------)--------------------o| |o--'
' | __ | | | | .--)--------------------o| |o- --.
' | -o| |o- | | | | |--)--------------------o| |o--- |
' | -o| |o- | | | | |--)--------------------o| |o- .||
' | -o| |o- | | | | | | '--------------o| |o- |||
' '------o| |o- | | | | | | LED | '------------o| |o- |||
' .------o| |o------' | | | | |->|--' | o| |o- |||
' | -o| |o- | | | | | | o| |o- |||
' | .---o| |o- | | |39k| | | o| |o- |||
' | | -o| |o- | | .-. | | LED | o| |o- |||
' | | -o|__|o------' | | | | | '->|----' o| |o- |||
' | | | | | | | | o| |o- |||
' | | | | | '-' | o| |o- |||
' | | | | | | | o|__|o |||
' | | | | | | | |||
' | | '--o--)--)---)------------------------------- ||
' | '---------------------o--)---)--------------------------------'|
' | | | |
' | | | |
' | | | |
' | | | |
' | | | |
' | | | |
' |----------------------o---------------------------o---o---------------------------------'
' ===
' GND
#picaxe 18x
' MAX6956 initialisation
i2cslave %10000000, i2cslow, i2cbyte ' AD0 and AD1 grounded based on this address
writei2c $04, (1) ' wake up
writei2c $09, ($55) : writei2c $0A, ($55) ' configure unused ports as outputs
writei2c $02, ($F) ' set LED outputs to full current (can be adjusted through $0 to $F)
' Examples
' Flash LED on port 12
writei2c $0B, ($A8) ' configure port 12 as LED output
do
writei2c $2C, (1) ' LED on (i.e. current sunk)
pause 1000
writei2c $2C, (0) ' LED off
pause 1000
loop
' Change global current setting with LED 12 on
writei2c $0B, ($A8) ' configure port 12 as LED output
writei2c $2C, (1) ' LED on
do
writei2c $02, ($0) ' dimmest, 1/16
pause 500
writei2c $02, ($5)
pause 500
writei2c $02, ($A)
pause 500
writei2c $02, ($F) ' brightest, 16/16
pause 500
loop
' Alternate power between LEDs 12 and 13
writei2c $0B, ($A0) ' configure ports 12 and 13 as LED outputs
do
writei2c $2C, (1, 0) ' LED on
pause 500
writei2c $2C, (0, 1) ' LED off
pause 500
loop