欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136
標題:
一個簡單的LCD16x2單片機小程序
[打印本頁]
作者:
oldspring
時間:
2018-10-14 10:20
標題:
一個簡單的LCD16x2單片機小程序
前幾天,發現了這個51hei網站,突發奇想,向大家推薦了一個51編譯器,雖然得到了黑班主的50黑幣,但是沒有任何51黑弟兄們的捧場,實在遺憾。
今后,我會經常到這里來溜達溜達,推薦一些常見電路簡單編程(諸如 LCD 16x2 or 16x4, LCD 12864, I2C, SPI, SD Card, 等等........) 。希望大家喜歡。
以下是一個簡單的 LCD 16x2 的單片機小程序:
// 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();
}
}
}
復制代碼
附:簡單電路圖。
51-LCD16x2.jpg
(41.75 KB, 下載次數: 64)
下載附件
2018-10-14 10:21 上傳
作者:
songxia8013
時間:
2018-10-14 17:00
這是個什么軟件做的?沒見過這個軟件!
作者:
oldspring
時間:
2018-10-15 09:37
http://m.raoushi.com/bbs/dpj-136722-1.html
歡迎光臨 (http://m.raoushi.com/bbs/)
Powered by Discuz! X3.1