基于uPSD3200的人機(jī)對(duì)話設(shè)計(jì)
temp = P4;
return temp;
}
unsigned char ReadCommand(void) //從P09703OLED顯示屏讀取寄存器狀態(tài)
{ unsigned char temp;
DC_PIN_NUM = 1;
RD_PIN_NUM = 0;
RD_PIN_NUM = 1;
temp = P4;
return temp;
}
void WriteCommand(unsigned char Data) //寫(xiě)指令代碼到P09703OLED顯示屏
{ DC_PIN_NUM = 0;
P4=Data;
WR_PIN_NUM = 0;
WR_PIN_NUM = 1;
}
void WriteData(uint8 Data) //寫(xiě)參數(shù)及數(shù)據(jù)到P09703OLED顯示屏
{ DC_PIN_NUM = 1;
P4=Data;
WR_PIN_NUM = 0;
WR_PIN_NUM = 1;
}
main(){ int j, i;
InitOled(); //初始化P09703OLED顯示屏,由于SSD1303軟件控制指令非常豐富,該函數(shù)內(nèi)容較長(zhǎng),在這里不做描述,詳情見(jiàn)P09703應(yīng)用筆記,這里要說(shuō)明的是:InitOled()中的comm_out2()函數(shù)用WriteCommand()函數(shù)替代
for(i=0;i8;i++)
WriteCommand (0xB0+i); //設(shè)置顯示位置—行
WriteCommand (0x02); //設(shè)置顯示位置—列低地址
WriteCommand (0x10); //設(shè)置顯示位置—列高地址
for(j=0;j128;j++)
WriteData((0xFF); //屏幕顯示,全亮
}
}
上述僅是對(duì)P09703基本的應(yīng)用,有關(guān)更多的SSD1303軟件控制指令,通過(guò)該文介紹的方法,并結(jié)合SSD1303的指令集[3],讀者能夠?qū)09703有更深了解。對(duì)于按鍵我們給出了電路原理圖,由于編成相對(duì)簡(jiǎn)單,這里就不做描述了。
pos機(jī)相關(guān)文章:pos機(jī)原理
評(píng)論