日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

avr uart打印_AVR | 在16x2 LCD上打印HELLO WORLD

發布時間:2025/3/11 编程问答 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 avr uart打印_AVR | 在16x2 LCD上打印HELLO WORLD 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

avr uart打印

We would learn the connection to the LCD first as the connections is a bit complex and here we are using an 8-bit LCD.

我們將首先學習到LCD的連接,因為連接有點復雜,這里我們使用的是8位LCD 。

Simulation

模擬

Explanation

說明

  • Search these devices from the device selection menu:

    從設備選擇菜單中搜索以下設備:

  • ATmega16
  • LM016L (It’s a 16*2 Alphanumeric LCD)
  • One Power Terminal
  • One Ground terminal
  • Connect the power terminal from the VDD and VEE of the LCD.

    從LCD的VDD和VEE連接電源端子。

  • Connect the Enable pin (E) and VSS pin to the ground terminal.

    將使能引腳(E)和VSS引腳連接到接地端子。

  • Double click on the Power terminal and write +5V in its properties.

    雙擊電源端子,并在其屬性中寫入+ 5V 。

  • Connect the R/S and E pin to the PC0 and PC1 of the ATmega16.

    將R / S和E引腳連接到ATmega16的PC0和PC1 。

  • The next step would be to debug the HEX file in the ATmega16.

    下一步將是調試ATmega16中的HEX文件。

Now after all the connections are made we will move forward to the coding section. As the coding for the LCD is bit longer so I won’t be attaching the screenshots from the Atmel Studio.

現在,在完成所有連接之后,我們將前進至編碼部分。 由于LCD的編碼更長,因此我不會附加Atmel Studio的屏幕截圖。

.minHeight{min-height: 250px;}@media (min-width: 1025px){.minHeight{min-height: 90px;}} .minHeight{min-height: 250px;}@media (min-width: 1025px){.minHeight{min-height: 90px;}}

用C代碼在LCD上打印HELLO WORLD (C code to print HELLO WORLD on the LCD)

#include <avr/io.h> #define F_CPU 1000000 #include <util/delay.h> #define RS0 #define EN1void lcd_comm (char); void lcd_data(char); void lcd_init (void);int main(void) {lcd_init();lcd_data('H');lcd_data('E');lcd_data('L');lcd_data('L');lcd_data('O');lcd_comm(20);lcd_data('W');lcd_data('O');lcd_data('R');lcd_data('L');lcd_data('D');while(1){} }void lcd_comm(char x){PORTD = x;PORTC &= ~(1<<RS);PORTC |= 1<<EN;_delay_ms(5);PORTC &= ~(1<<EN); }void lcd_data(char x){PORTD = x;PORTC |= 1<<RS;PORTC |= 1<<EN;_delay_ms(5);PORTC &= ~(1<<EN); }void lcd_init(void){DDRD = 0xFF;DDRC = 0x03;lcd_comm(0x38);lcd_comm(0x06);lcd_comm(0x0E);lcd_comm(0x01);lcd_comm(0x80); }

Explanation

說明

  • Firstly we have included all the header file that is required basically

    首先,我們包含了所有基本需要的頭文件

  • At the initial condition, we have defined EN=0 and RS=1.

    在初始條件下,我們已定義EN = 0和RS = 1 。

  • Next we have defined certain functions lcd_comm(char), lcd_data(char) and lcd_init(void).

    接下來,我們定義了某些函數lcd_comm(char) , lcd_data(char)和lcd_init(void) 。

  • Inside the int main(void) we have written the alphabets that need to be print in the screen.

    在int main(void)內部,我們編寫了需要在屏幕上打印的字母。

  • Also here lcd_comm(20); is the command given to the LCD to create space between the two words.

    同樣在這里lcd_comm(20); 是給LCD的命令,用于在兩個單詞之間創建空格。

  • Inside the void lcd_comm(char x) we have taken the variable as char x, which we have assigned to PORTC.

    在void lcd_comm(char x)內部,我們將變量指定為char x ,并將其分配給PORTC 。

  • In the next step we have masked the initial value of RS which was initially 1, and here we have made it 0.

    在下一步中,我們屏蔽了RS的初始值為1的初始值,在這里將其設為0。

  • Next, we have made our Enable Pin high and then low by giving the time delay of 5ms in between.

    接下來,通過在5ms之間設置時間延遲,將使能引腳設為高電平,然后設為低電平。

  • Again for the next function, we would be giving the data to LCD through this.

    再次為下一個功能,我們將通過此將數據提供給LCD。

  • We have taken a variable x, and assigned to PORTD, again made RS pin 0 and also have done similarly the Enable pin high and then low by providing the time delay of 5ms.

    我們取了一個變量x ,并將其分配給PORTD ,再次將RS引腳設置為0,并通過提供5ms的時間延遲, 將使能引腳先設置為高電平,然后設置為低電平。

  • In this function lcd_init(void) we have written all the commands that are required for the LCD at the beginning.

    在此函數lcd_init(void)中,我們在一開始就編寫了LCD所需的所有命令。

  • For more detail of every command, you can check the last article that I have written about the LCD.

    有關每個命令的更多詳細信息,可以查看我寫的有關LCD的最后一篇文章。

  • Also, the DDRD=0xFF indicates all the data pins connected to the PORTD, and DDRC=0x03 is for the connection of the ENABLE Pin and R/S pin we connected to PORTC.

    同樣, DDRD = 0xFF表示連接到PORTD的所有數據引腳,而DDRC = 0x03用于連接我們連接到PORTC的ENABLE引腳和R / S引腳。

Build the program and after this debug the Hex file in the simulation software design that we have created earlier and click on the RUN button and your HELLO WORLD will appear in the Screen.

生成程序,然后在調試之后,使用我們先前創建的仿真軟件設計中的Hex文件,然后單擊RUN按鈕,您的HELLO WORLD將出現在屏幕中。

翻譯自: https://www.includehelp.com/embedded-system/print-hello-world-on-the-16x2-lcd.aspx

avr uart打印

創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎

總結

以上是生活随笔為你收集整理的avr uart打印_AVR | 在16x2 LCD上打印HELLO WORLD的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 最新中文在线视频 | 能免费看18视频网站 | 日韩av免费在线观看 | 国产一区二区网址 | 最新色视频 | 四虎成人av | 天堂√8在线中文 | 成人你懂的 | 性高潮久久久久 | 九九视频免费观看 | 成人综合一区 | 一二三区在线视频 | 精品一区二区电影 | 免费黄色av | 欧美精品亚洲 | 日韩精品观看 | 伊人伊人鲁 | 亚洲天堂一区二区三区 | 欧美中文一区 | 国产视频手机在线播放 | 国产一区二区三区亚洲 | 一级特黄aa大片欧美 | 6080电视影片在线观看 | 国产精品高潮呻吟久久av野狼 | 国产精品久久久久久中文字 | 精品无码一区二区三区蜜臀 | 99国产揄拍国产精品 | 最新国产视频 | 国产精品www在线观看 | 伊人国产在线观看 | 久久久久久视 | 国产一级片麻豆 | 亚洲熟伦熟女新五十路熟妇 | 天天摸日日摸狠狠添 | av第一页| 无码精品一区二区三区在线播放 | 亚洲国产综合视频 | 神马伦理影视 | 国产片久久| 亚洲超碰在线 | 女人扒开腿免费视频app | 在线观看中文字幕一区 | 熟女高潮一区二区三区 | 黄色香蕉视频 | 污污的视频网站在线观看 | 亚洲色图导航 | 久久久久久九九九九 | 久久美女免费视频 | 熟女人妻一区二区三区免费看 | 美女视频一区 | 国产成人无码精品久久 | 久久国产一区二区 | 国产真实夫妇交换视频 | 国产无套粉嫩白浆内谢 | 日韩精品高清在线 | 天天综合永久入口 | 四虎影院免费视频 | 亚洲午夜福利一区二区三区 | 一级中文字幕 | 99爱视频在线观看 | 人妻互换免费中文字幕 | 国产一二视频 | 一区二区日韩精品 | a级黄色网 | 国产日| 丁香花国语版普通话 | 秋霞午夜伦理 | 村姑电影在线播放免费观看 | www.黄色在线| 欧美xxxx免费虐 | 99av视频| 日韩精品一区二 | 台湾a级艳片潘金莲 | 成年人黄网站 | 久久精品亚洲精品国产欧美 | 伊人视频 | 日韩免费不卡视频 | 欧美性tv| 人人妻人人澡人人爽欧美一区 | 国产偷人妻精品一区 | 91一区二区三区四区 | 国产在线观看免费播放 | 久久久亚洲精品视频 | 欧美中文在线观看 | 久久精品无码一区二区三区 | 五月天综合久久 | 久久成人免费网站 | 日韩欧美在线视频免费观看 | 日本女人性视频 | 日韩字幕| 久久亚洲综合色 | 日韩在线一二三 | 可以看黄色的网站 | 狠狠干一区 | 国产精品夜夜 | 怨女1988国语版在线观看高清 | 国产色爱 | 国产在线欧美在线 | 亚洲精选中文字幕 |