欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136
標(biāo)題:
一個(gè)簡單的LCD16x2單片機(jī)小程序
[打印本頁]
作者:
oldspring
時(shí)間:
2018-10-14 10:20
標(biāo)題:
一個(gè)簡單的LCD16x2單片機(jī)小程序
前幾天,發(fā)現(xiàn)了這個(gè)51hei網(wǎng)站,突發(fā)奇想,向大家推薦了一個(gè)51編譯器,雖然得到了黑班主的50黑幣,但是沒有任何51黑弟兄們的捧場,實(shí)在遺憾。
今后,我會(huì)經(jīng)常到這里來溜達(dá)溜達(dá),推薦一些常見電路簡單編程(諸如 LCD 16x2 or 16x4, LCD 12864, I2C, SPI, SD Card, 等等........) 。希望大家喜歡。
以下是一個(gè)簡單的 LCD 16x2 的單片機(jī)小程序:
// Lcd module connections
sbit LCD_RS at P2_0_bit;
sbit LCD_EN at P2_1_bit;
sbit LCD_D4 at P2_2_bit;
sbit LCD_D5 at P2_3_bit;
sbit LCD_D6 at P2_4_bit;
sbit LCD_D7 at P2_5_bit;
// End Lcd module connections
char txt1[] = "mikroElektronika";
char txt2[] = "Easy8051B";
char txt3[] = "Lcd4bit";
char txt4[] = "example";
char i; // Loop variable
void Move_Delay() { // Function used for text moving
Delay_ms(500); // You can change the moving speed here
}
void main(){
Lcd_Init(); // Initialize Lcd
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
Lcd_Out(1,6,txt3); // Write text in first row
Lcd_Out(2,6,txt4); // Write text in second row
Delay_ms(2000);
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Out(1,1,txt1); // Write text in first row
Lcd_Out(2,5,txt2); // Write text in second row
Delay_ms(2000);
// Moving text
for(i=0; i<4; i++) { // Move text to the right 4 times
Lcd_Cmd(_LCD_SHIFT_RIGHT);
Move_Delay();
}
while(1) { // Endless loop
for(i=0; i<8; i++) { // Move text to the left 7 times
Lcd_Cmd(_LCD_SHIFT_LEFT);
Move_Delay();
}
for(i=0; i<8; i++) { // Move text to the right 7 times
Lcd_Cmd(_LCD_SHIFT_RIGHT);
Move_Delay();
}
}
}
復(fù)制代碼
附:簡單電路圖。
51-LCD16x2.jpg
(41.75 KB, 下載次數(shù): 64)
下載附件
2018-10-14 10:21 上傳
作者:
songxia8013
時(shí)間:
2018-10-14 17:00
這是個(gè)什么軟件做的?沒見過這個(gè)軟件!
作者:
oldspring
時(shí)間:
2018-10-15 09:37
http://www.raoushi.com/bbs/dpj-136722-1.html
歡迎光臨 (http://www.raoushi.com/bbs/)
Powered by Discuz! X3.1