UFAnders
Joined: 13 Apr 2005 Posts: 36 Location: Michigan
|
MAX6955 LED Driver Functions |
Posted: Sat Jun 25, 2005 9:59 am |
|
|
Maxim's MAX6955 LED Driver can drive up to 128 discrete LEDs with each group of 8 having 4-bit intensity control. It's really slick, and here is a header file to get it up and running ASAP.
Code: | #define MAX6955BaseAddress 0b11000000
#define reg_noOp 0x00
#define reg_decodeMode 0x01
#define reg_globalIntensity 0x02
#define reg_scanLimit 0x03
#define reg_configuration 0x04
#define reg_displayTest 0x07
#define reg_digitType 0x0C
#define reg_intensity10 0x10
#define reg_intensity32 0x11
#define reg_intensity54 0x12
#define reg_intensity76 0x13
#define reg_intensity10a 0x14
#define reg_intensity32a 0x15
#define reg_intensity54a 0x16
#define reg_intensity76a 0x17
#define USE_GLOBAL 0x00
#define USE_DISCRETE 0x40
#define RUN 0x01
#define SHUTDOWN 0x00
#define reg_digit0 0x60
#define reg_digit1 0x61
#define reg_digit2 0x62
#define reg_digit3 0x63
#define reg_digit4 0x64
#define reg_digit5 0x65
#define reg_digit6 0x66
#define reg_digit7 0x67
#define reg_digit0a 0x68
#define reg_digit1a 0x69
#define reg_digit2a 0x6A
#define reg_digit3a 0x6B
#define reg_digit4a 0x6C
#define reg_digit5a 0x6D
#define reg_digit6a 0x6E
#define reg_digit7a 0x6F
void writeMAX6955(unsigned char, unsigned char, unsigned char);
void initMAX6955(unsigned char);
void writeMAX6955(unsigned char driver, unsigned char command, unsigned char data)
{
i2c_start();
i2c_write(MAX6955BaseAddress + (driver<<1));
i2c_write(command);
i2c_write(data);
i2c_stop();
}
void initMAX6955(unsigned char driver)
{
writeMAX6955(driver, reg_decodeMode, 0x00);
writeMAX6955(driver, reg_scanLimit, 0x07);
writeMAX6955(driver, reg_configuration, (RUN|USE_DISCRETE));
writeMAX6955(driver, reg_globalIntensity, 0x0F);
writeMAX6955(driver, reg_digitType, 0x00);
writeMAX6955(driver, reg_displayTest, 0x01);
delay_ms(1000);
writeMAX6955(driver, reg_displayTest, 0x00);
} |
|
|