Lcd_RW_Cs = 0;
// 设置 DDRAM 的位址
Lcd_Write_Data( 0xC0 );
Delay_N_mS(1);
Lcd_RS_Cs = 1;
Lcd_RW_Cs = 0;
for( i = 0; i < 16; i ++ )
{
Lcd_Write_Data( Menu2_Tab[Item_Rg * 2 + 1] );
Delay_N_mS(1);
}
}
void Lcd_Color_Dsp( unchar Item_Rg )
{
unchar i;
Lcd_RS_Cs = 0;
Lcd_RW_Cs = 0;
Lcd_Write_Data( 0x0C );
Delay_N_mS(1);
// 设置 DDRAM 的位址, 位址码为 0
Lcd_Write_Data( 0xc0 );
Delay_N_mS(1);
Lcd_RS_Cs = 1;
Lcd_RW_Cs = 0;
for( i = 0; i < 16; i ++ )
{
Lcd_Write_Data( Color_Tab[Item_Rg] );
Delay_N_mS(1);
}
}
//=====================================================================================
// LCD 写操作动作
void Lcd_Write_Data( unchar Data_Rg )
{
Lcd_OE_Cs = 1;
_nop_();
_nop_();
_nop_();
_nop_();
P0 = Data_Rg;
_nop_();
_nop_();
_nop_();
_nop_();
Lcd_OE_Cs = 0;
}
/*=======================================================================================*/
void Lcd_Number_Dsp( void )
{
unchar i;
Lcd_RS_Cs = 0;
Lcd_RW_Cs = 0;
Lcd_Write_Data( 0x0C );
Delay_N_mS(1);
// 设置 DDRAM 的位址, 位址码为
Lcd_Write_Data( 0xc6 );
Delay_N_mS(1);
Lcd_RS_Cs = 1;
Lcd_RW_Cs = 0;
for( i = 0; i < 5; i ++ )
{
Lcd_Write_Data( Set_Num );
Delay_N_mS(1);
}
}
//=========================================================================================
void Hex_To_Ascii( unint Data_Rg )
{
unchar i;
unchar Hex4Bcd_Buf[5];
// Hex To BCD
for( i = 5; i > 0; i -- )
{
Hex4Bcd_Buf[i - 1] = Data_Rg % 10;
Data_Rg /= 10;
}
/*--------------------------------------*/
for( i = 0; i < 5; i ++ )
{
Set_Num[ i ] = 0x20;
}
// BCD To ASCII
if( Hex4Bcd_Buf[0] == 0 )
{
Set_Num[ 0 ] = 0x20;
if( Hex4Bcd_Buf[1] == 0 )
{
Set_Num[ 1 ] = 0x20;
if( Hex4Bcd_Buf[2] == 0 )
{
Set_Num[ 2 ] = 0x20;
if( Hex4Bcd_Buf[3] == 0 )
{
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] [32] [33] [34] [35] [36] [37] [38] [39] [40] [41] [42] [43] [44] [45] [46] [47] [48] [49] [50] [51] 下一页
本文关键字:控制器 程序 51单片机,单片机-工控设备 - 51单片机