Hardware Reference
In-Depth Information
void sendtomax (char c1, char c2, char c3, char c4)
{
PTM & 5 , BIT5;
// enable SPI transfer to MAX6952
putcspi0(c1);
// send c1 to MAX6952
putcspi0(c2);
// send c2 to MAX6952
putcspi0(c3);
// send c3 to MAX6952
putcspi0(c4);
// send c4 to MAX6952
PTM | 5 BIT5;
// load data from shift register to latch
}
void openspi0(void)
{
SPI0BR 5 0x00; // set baud rate to 12 MHz
SPI0CR1 5 0x50; // disable interrupt, set master mode, shift data on
rising edge, clock idle low
SPI0CR2 5 0x02; // disable mode fault, disable SPI in wait mode
WOMS 5 0;
// enable Port S pull-up
}
Example 10.12
Write a program to define fonts for three special characters as shown in Figure 10.31. Store
the font of these three special characters at locations from 0x00 to 0x0E of the MAX6952.
Figure 10.31 User-definable font example
Solution: The program that sets fonts is very straightforward. The following program will set up
the fonts as specified:
#include “c:\cwHCS12\include\hcs12.h”
#include “c:\cwHCS12\include\spi0util.h”
char fonts [15] 5 {0x70,0x40,0x7F,0x40,0x70,0x48,0x38,0x0F,0x38,0x48,0x49,
0x49,0x7F,0x49,0x49};
void send_font (char xc);
void openspi0 (void);
 
Search WWH ::




Custom Search