Using the MAX6955 LED Display Driver with a PIC Microcontroller to Scroll Messages
"THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG".
The program, shown in Listing 1, can be modified to scroll alphanumeric messages with a length of 8 to 126 characters. The application circuit shown in Figure 1 consists of the MAX6955, the PIC18F442 and four super bright red 14-segment dual character displays from Lumex (Part number LDD-F5406RI).
For Larger Image
Figure 1. MAX6955 application schematic.
The example assembly program continuously scrolls the alphanumeric characters located in the lookup table of the program. The alphanumeric message length is adjustable from 8 to 126 characters long including all blank spaces (0x20). It is recommended to add 7 blank spaces at the beginning and end of the message to obtain the best scrolling effect. In order to customize the message, first modify the hexadecimal representation of the character to scroll in the lookup table of the program. Then modify the CharCount variable value to the number of alphanumeric characters in the selected message including all blank spaces. The program calculates the correct shift count using the equation:
CharCount - 7 = ShiftCountPlusOne
ShiftCount = ShiftCountPlusOne - 1
For example, "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG" contains 43 characters. Adding 7 blank spaces before and after the message increases the character count to 57. Using the equation above shows that a message with a character count of 57 would be shifted a total of 49 segments from right to left.
The example program also contains function calls to interface the MAX6955 to the PIC using the internal MSSP I2C port. Since other microcontrollers have similar on-chip peripherals, the example I2C communication routines provided were purposely broken down into single I2C function calls so that the code can be quickly implemented with other microcontrollers. Table 1 shows the single I2C compatible function calls used in the example assembly program.
alt-click (PC) or option-click (Mac) to download Listing 1.
Listing 1. An example assembly program that interfaces the MAX6955 to the PIC18F442's internal MSSP I2C peripheral.
Table 1. Single I2C compatible function calls.
|Single I2C compatible function calls||Description|
|HWI2C_start||Performs an I2C compatible start condition.|
|HWI2C_repeatedStart||Performs an I2C compatible repeated start condition.|
|HWI2C_W_write||Performs all I2C compatible write operations including the initial slave address write frame.|
|HWI2C_readMore_W||Performs an I2C compatible read operation with Master ACK.|
|HWI2C_readLast_W||Performs an I2C compatible read operation with Master NACK.|
|HWI2C_stop||Performs an I2C compatible stop condition.|