mấy PRO giúp mình cái code chạy chữ tiếng việt với.mình có code hiển thị tiếng việt rồi mak` mun làm cho nó chạy từ phải sang trái mak` kko bik viết thế nào.Mong các PRO giúp đỡ
#include <16f877A.h>
#use delay(clock=20000000)
#fuses hs,nowdt,noput
#define LCD_RS PIN_B0
#define LCD_EN PIN_B1
#define LCD_B4 PIN_B4
#define LCD_B5 PIN_B5
#define LCD_B6 PIN_B6
#define LCD_B7 PIN_B7
byte const cgram [48] = {0x0E,0X09,0X09,0X1D,0X09,0X09,0X0E,0X00,
0X04,0X0A,0X00,0X0E,0X0A,0X0A,0X04,0X00,
0X04,0X08,0X16,0X01,0X12,0X12,0X1E,0X00,
0X04,0X08,0X14,0X08,0X1C,0X14,0X1E,0X00
};
void LCD_SetData (int cX )
{
output_bit ( LCD_B4, cX & 0x01 );
output_bit ( LCD_B5, cX & 0x02 );
output_bit ( LCD_B6, cX & 0x04 );
output_bit ( LCD_B7, cX & 0x08 );
}
void LCD_PulseEnable()
{
output_high ( LCD_EN );
delay_MS ( 10 );
output_low ( LCD_EN );
delay_MS ( 10 );
}
void LCD_PutCmd (int cX )
{
output_low (LCD_RS);
LCD_SetData ( swap ( cX ) );
LCD_PulseEnable ();
LCD_SetData ( swap ( cX ) );
LCD_PulseEnable();
}
void LCD_PutChar ( unsigned int cX )
{
output_high ( LCD_RS );
LCD_SetData ( swap ( cX ) ); /* send high nibble */
LCD_PulseEnable();
LCD_SetData ( swap ( cX ) ); /* send low nibble */
LCD_PulseEnable();
delay_ms(10);
}
void lcd_cmd (int data)
{
output_low(LCD_RS);
output_B(data);
LCD_PulseEnable();
}
void LCD_Init ()
{
delay_ms(20);
lcd_cmd( 0x30 );
delay_ms(10);
lcd_cmd( 0x30 );
delay_US(350);
lcd_cmd( 0x30 );
lcd_cmd(0b00101000);
LCD_PutCmd(0b00101000);
LCD_PutCmd (0b00001100 ); /* display ON, cursor off, no blink */
LCD_PutCmd ( 0b00000110 ); /* entry mode set, increment & scroll left */
LCD_PutCmd ( 0x01 ); /* clear display */
}
VOID lcd_string(byte posistion,char *ptr,int delay)
{
LCD_PutCmd (posistion );
WHILE (*ptr!=0)
{
LCD_PutChar (*ptr++ );
DELAY_MS(delay);
}
}
void main ()
{
char text1 []="DH Ton Duc Thang";
char text3 []="MSSV:081373D";
int8 i,k;
char *ptr;
set_tris_b(0);
LCD_Init ();
LCD_PutCmd (0X40);
for(i=0;i<48;i++)
LCD_PutChar(cgram[i]);
lcd_string(0x80,text1,5);
lcd_string(0x0C0,text3,5);
lcd_string(0x0D0,text4,5);
LCD_PutCmd (0X80);
LCD_PutChar(0X00);
LCD_PutCmd (0X84);
LCD_PutChar(0X01);
LCD_PutCmd (0X87);
LCD_PutChar(0X00);
LCD_PutChar(0X02);
LCD_PutCmd (0X8D);
LCD_PutChar(0X03);
#include <16f877A.h>
#use delay(clock=20000000)
#fuses hs,nowdt,noput
#define LCD_RS PIN_B0
#define LCD_EN PIN_B1
#define LCD_B4 PIN_B4
#define LCD_B5 PIN_B5
#define LCD_B6 PIN_B6
#define LCD_B7 PIN_B7
byte const cgram [48] = {0x0E,0X09,0X09,0X1D,0X09,0X09,0X0E,0X00,
0X04,0X0A,0X00,0X0E,0X0A,0X0A,0X04,0X00,
0X04,0X08,0X16,0X01,0X12,0X12,0X1E,0X00,
0X04,0X08,0X14,0X08,0X1C,0X14,0X1E,0X00
};
void LCD_SetData (int cX )
{
output_bit ( LCD_B4, cX & 0x01 );
output_bit ( LCD_B5, cX & 0x02 );
output_bit ( LCD_B6, cX & 0x04 );
output_bit ( LCD_B7, cX & 0x08 );
}
void LCD_PulseEnable()
{
output_high ( LCD_EN );
delay_MS ( 10 );
output_low ( LCD_EN );
delay_MS ( 10 );
}
void LCD_PutCmd (int cX )
{
output_low (LCD_RS);
LCD_SetData ( swap ( cX ) );
LCD_PulseEnable ();
LCD_SetData ( swap ( cX ) );
LCD_PulseEnable();
}
void LCD_PutChar ( unsigned int cX )
{
output_high ( LCD_RS );
LCD_SetData ( swap ( cX ) ); /* send high nibble */
LCD_PulseEnable();
LCD_SetData ( swap ( cX ) ); /* send low nibble */
LCD_PulseEnable();
delay_ms(10);
}
void lcd_cmd (int data)
{
output_low(LCD_RS);
output_B(data);
LCD_PulseEnable();
}
void LCD_Init ()
{
delay_ms(20);
lcd_cmd( 0x30 );
delay_ms(10);
lcd_cmd( 0x30 );
delay_US(350);
lcd_cmd( 0x30 );
lcd_cmd(0b00101000);
LCD_PutCmd(0b00101000);
LCD_PutCmd (0b00001100 ); /* display ON, cursor off, no blink */
LCD_PutCmd ( 0b00000110 ); /* entry mode set, increment & scroll left */
LCD_PutCmd ( 0x01 ); /* clear display */
}
VOID lcd_string(byte posistion,char *ptr,int delay)
{
LCD_PutCmd (posistion );
WHILE (*ptr!=0)
{
LCD_PutChar (*ptr++ );
DELAY_MS(delay);
}
}
void main ()
{
char text1 []="DH Ton Duc Thang";
char text3 []="MSSV:081373D";
int8 i,k;
char *ptr;
set_tris_b(0);
LCD_Init ();
LCD_PutCmd (0X40);
for(i=0;i<48;i++)
LCD_PutChar(cgram[i]);
lcd_string(0x80,text1,5);
lcd_string(0x0C0,text3,5);
lcd_string(0x0D0,text4,5);
LCD_PutCmd (0X80);
LCD_PutChar(0X00);
LCD_PutCmd (0X84);
LCD_PutChar(0X01);
LCD_PutCmd (0X87);
LCD_PutChar(0X00);
LCD_PutChar(0X02);
LCD_PutCmd (0X8D);
LCD_PutChar(0X03);
Comment