#include <mega8.h>
#asm
.equ __lcd_port=0x12 ;PORTD
#endasm
#include <lcd.h>
typedef unsigned char byte;
/* table for the user defined character
arrow that points to the top right corner */
flash byte chara[]={
0b0000111,
0b0000111,
0b0000111,
0b0000111,
0b0000111,
0b0000111,
0b0000111,
0b0000111
};
flash byte charb[]={
0b1111111,
0b1111111,
0b1111111,
0b0000111,
0b0000111,
0b0000111,
0b0000111,
0b0000111
};
flash byte charc[]={
0b0000111,
0b0000111,
0b0000111,
0b0000111,
0b0000111,
0b1111111,
0b1111111,
0b1111111
};
/* function used to define user characters */
void define_char(char flash *pc,unsigned char char_code) //
{ char ir,ar; ar=(char_code<<3) | 0x40;
for (ir=0; ir<8; ir++) lcd_write_byte(ar++,*pc++); };
void main(void)
{
/* initialize the LCD for 2 lines & 16 columns */
lcd_init(16);
/* define user character 0 */
define_char(chara,1);
define_char(charb,2);
define_char(charc,3);
/* switch to writing in Display RAM */
while (1)
{ /* loop forever */
lcd_gotoxy(0,0);
lcd_putsf("\x01\x02");
lcd_gotoxy(0,1);
lcd_putsf("\x01\x03");
}
}