4-digit 7-segment LED display example using BiPOM LED-1 board. Includes I2C interface to SAA1064 LED driver chip.
Toolkit:ARM Development System
Location:/bipom/devtools/GCC/LPC2000/examples/led1
int main (void) { UBYTE i; /* Initialize the system */ Initialize(); /* Send messages to TERMINAL window */ tiprintf("\n\rBIPOM MINI-MAX/ARM"); tiprintf("\n\rLED1 TEST "); // for ( ;; ) { /* SAA1064 address */ LED1_Command.Address = I2C_DEVICE_SAA1064 ; /* SAA1064 instruction */ LED1_Command.Instruction = 0 ; /* Test 1 */ tiprintf ( "\r\n\r\nAll segment outputs are switched on"); /* Configure the control word */ LED1_Command.Control = DYNAMIC+NOT_BLANK_13+NOT_BLANK_24+TEST+CUR_12MA; /* Set digit latches */ LED1_Command.Digit1 = LED1_Command.Digit2 = LED1_Command.Digit3 = LED1_Command.Digit4 = 0xff ; SendBuffer(); /* Test 2 */ tiprintf ( "\r\n\r\nDigits 1 & 3 are blanked"); /* Configure the control word */ LED1_Command.Control = DYNAMIC+BLANK_13+NOT_BLANK_24+WORK+CUR_12MA; /* Set a contens of digit latches */ LED1_Command.Digit1 = LED1_Command.Digit2 = LED1_Command.Digit3 = LED1_Command.Digit4 = 0xff ; SendBuffer(); /* Test 3 */ tiprintf ( "\r\n\r\nDigits 2 & 4 are blanked"); /* Configure the control word */ LED1_Command.Control = DYNAMIC+NOT_BLANK_13+BLANK_24+WORK+CUR_12MA; /* Set digit latches */ LED1_Command.Digit1 = LED1_Command.Digit2 = LED1_Command.Digit3 = LED1_Command.Digit4 = 0xff ; SendBuffer(); /* Test 4 */ tiprintf ( "\r\n\r\nAll segment outputs of Digit1 are switched on"); /* Configure the control word */ LED1_Command.Control = DYNAMIC+NOT_BLANK_13+NOT_BLANK_24+WORK+CUR_12MA; /* Set digit latches */ LED1_Command.Digit1 = 0xff ; LED1_Command.Digit2 = LED1_Command.Digit3 = LED1_Command.Digit4 = 0x00 ; SendBuffer(); /* Test 5 */ tiprintf ( "\r\n\r\nAll segment outputs of Digit2 are switched on"); /* Configure the control word */ LED1_Command.Control = DYNAMIC+NOT_BLANK_13+NOT_BLANK_24+WORK+CUR_12MA; /* Set digit latches */ LED1_Command.Digit1 = 0x00 ; LED1_Command.Digit2 = 0xff ; LED1_Command.Digit3 = LED1_Command.Digit4 = 0x00 ; SendBuffer(); /* Test 6 */ tiprintf ( "\r\n\r\nAll segment outputs of Digit3 are switched on"); /* Configure the control word */ LED1_Command.Control = DYNAMIC+NOT_BLANK_13+NOT_BLANK_24+WORK+CUR_12MA; /* Set digit latches */ LED1_Command.Digit1 = LED1_Command.Digit2 = 0x00 ; LED1_Command.Digit3 = 0xff ; LED1_Command.Digit4 = 0x00 ; SendBuffer(); /* Test 7 */ tiprintf ( "\r\n\r\nAll segment outputs of Digit4 are switched on"); /* Configure the control word */ LED1_Command.Control = DYNAMIC+NOT_BLANK_13+NOT_BLANK_24+WORK+CUR_12MA; /* Set digit latches */ LED1_Command.Digit1 = LED1_Command.Digit2 = LED1_Command.Digit3 = 0x00 ; LED1_Command.Digit4 = 0xff ; SendBuffer(); /* Test 8 */ tiprintf ( "\r\n\r\n***************"); tiprintf ( "\r\nSegment testing"); tiprintf ( "\r\n***************"); /* Configure the control word */ LED1_Command.Control = DYNAMIC+NOT_BLANK_13+NOT_BLANK_24+WORK+CUR_12MA; /* Set digit latches */ for ( i = 0 ; i < 8 ; i++ ) { LED1_Command.Digit1 = LED1_Command.Digit2 = LED1_Command.Digit3 = LED1_Command.Digit4 = LED1_ContensSegment[i]; tiprintf ("\r\n\r\n*%c* Segment is switched on", LED1_NameSegment[i] ); SendBuffer(); } } }