ARM
์บ๋ฆญํฐ LCD๋ก ๋ฉ๋ด ์ ํํ๊ธฐ — ๋ฒํผ์ผ๋ก UI ๊ตฌ์ฑ
๊ฒ์๊ต์
2025. 4. 18. 07:55
๋ฐ์ํ
๐บ ์บ๋ฆญํฐ LCD๋ก ๋ฉ๋ด ์ ํํ๊ธฐ โ ๋ฒํผ UI ๊ตฌ์ฑ
์ด๋ฒ ์ค์ต์์๋ ๋ฒํผ์ ๋๋ฅผ ๋๋ง๋ค LCD ํ๋ฉด์ ๋ด์ฉ์ ์์ฐจ์ ์ผ๋ก ๋ณ๊ฒฝํ๋ ๋ฉ๋ด ์์คํ ์ ๊ตฌํํด๋ด ๋๋ค.
์ด๋ฐ ๋ฐฉ์์ ๊ฐ๋จํ ๋๋ฐ์ด์ค UI ๊ตฌ์ฑ์ ์์ฃผ ์ฌ์ฉ๋๋ ๊ธฐ์ด ๊ตฌ์กฐ์ ๋๋ค.
๐งฐ ์ค๋น๋ฌผ
- ABOV A31G123ML ๋ณด๋
- 16x2 ์บ๋ฆญํฐ LCD (HD44780)
- ํธ์๋ฒํผ 1๊ฐ
- 10kฮฉ ํ๋ค์ด ์ ํญ
๐ ํ ์ฐ๊ฒฐ
- LCD: RS~D7 โ P1.0 ~ P1.5
- ๋ฒํผ: P2.1 (์ ๋ ฅ)
๐ป ์ฝ๋ ์์: ๋ฒํผ์ผ๋ก ๋ฉ๋ด ์ํ
#include "A31G123.h" #include "lcd.h" volatile int menu = 0; void delay_ms(int ms) { for (volatile int i = 0; i < ms * 800; i++); } void lcd_show_menu(int index) { lcd_clear(); switch (index) { case 0: lcd_puts("๐ก Temp Display"); break; case 1: lcd_puts("๐ก Brightness View"); break; case 2: lcd_puts("๐ง System Info"); break; } } int main(void) { lcd_init(); PORT2->MODE &= ~(1 << 1); // P2.1 ์ ๋ ฅ PORT2->PULLUP |= (1 << 1); // ํ์ (๋๋ ์ธ๋ถ ํ๋ค์ด) lcd_show_menu(menu); while (1) { if (!(PORT2->IN & (1 << 1))) { // ๋ฒํผ ๋๋ฆผ (Low) menu = (menu + 1) % 3; lcd_show_menu(menu); delay_ms(300); // ๋๋ฐ์ด์ฑ } } }
โ ํ์ธ ํฌ์ธํธ
- ๋ฒํผ ๋๋ฅผ ๋๋ง๋ค LCD ํ๋ฉด ์ ํ
- 3๊ฐ ๋ฉ๋ด ์ํ: ์จ๋, ๋ฐ๊ธฐ, ์์คํ ์ ๋ณด
- ํฅํ ๊ฐ ๋ฉ๋ด์ ๊ธฐ๋ฅ ์ฐ๋ ๊ฐ๋ฅ
๐ ๋ง๋ฌด๋ฆฌ
์ด์ ๋ฒํผ ๊ธฐ๋ฐ LCD ๋ฉ๋ด ์์คํ
์ ๊ตฌํํ ์ ์๊ฒ ๋์์ด์.
๋ค์์ ๊ฐ ๋ฉ๋ด์ ์ผ์ ์ฐ๋ ๋๋ ์ค์ ์กฐ์
๋ฐ์ํ