Download CodeVisionAVR User Manual

Transcript
CodeVisionAVR
/* table for the user defined character
arrow that points to the top right corner */
flash byte char0[8]={
0b0000000,
0b0001111,
0b0000011,
0b0000101,
0b0001001,
0b0010000,
0b0100000,
0b1000000};
/* function used to define user characters */
void define_char(byte flash *pc,byte char_code)
{
byte i,a;
a=(char_code<<3) | 0x40;
for (i=0; i<8; i++) lcd_write_byte(a++,*pc++);
}
void main(void)
{
/* initialize the LCD for 2 lines & 16 columns */
lcd_init(16);
/* define user character 0 */
define_char(char0,0);
/* switch to writing in Display RAM */
lcd_gotoxy(0,0);
lcd_putsf("User char 0:");
/* display used defined char 0 */
lcd_putchar(0);
while (1); /* loop forever */
}
unsigned char lcd_read_byte(unsigned char addr);
reads a byte from the LCD character generator or display RAM.
void lcd_init(unsigned char lcd_columns)
initializes the LCD module, clears the display and sets the printing character position at row 0 and
column 0. The numbers of columns of the LCD must be specified (e.g. 16).
No cursor is displayed.
This is the first function that must be called before using the other high level LCD Functions.
void lcd_clear(void)
clears the LCD and sets the printing character position at row 0 and column 0.
© 1998-2001 HP InfoTech S.R.L.
Page 117