IT/CodeVision atmega1283 atmega128을 이용한 초음파센서 동작 #include #include #define LCD_RS PORTA.0 #define LCD_RW PORTA.1 #define LCD_EN PORTA.2 #define LCD_Data PORTA #define Trigger PORTD.0 unsigned int distance = 0; unsigned int cm_count = 0; void LCD_E(void) { LCD_EN = 1; delay_us(250); LCD_EN = 0; } void LCD_Command(unsigned char rs, unsigned char rw, unsigned char data) { LCD_RS = rs; LCD_RW = rw; LCD_Data = ((LCD_Data & 0x0f) | (data & 0xf0)); L.. 2022. 7. 17. ATmega128을 이용한 문자 'C' 표시하기 #include #include #define LCD_RS PORTA.0 #define LCD_RW PORTA.1 #define LCD_EN PORTA.2 #define LCD_Data PORTA int count_2msec = 0; void LCD_E(void) { LCD_EN = 1; delay_us(250); LCD_EN = 0; } void LCD_Command(unsigned char rs, unsigned char rw, unsigned char data) { LCD_RS = rs; LCD_RW = rw; LCD_Data = ((LCD_Data & 0x0f) | (data & 0xf0)); LCD_E(); LCD_Data = ((LCD_Data & 0x0f) | ((data 2022. 7. 14. Atmega128을 이용한 0.5초 간격으로 : 깜빡이기 #include #include #define LCD_RS PORTA.0 #define LCD_RW PORTA.1 #define LCD_EN PORTA.2 #define LCD_Data PORTA int count_2msec = 0; unsigned char msec = 0; unsigned char sec = 50; unsigned char minute = 59; unsigned char hour = 23; void LCD_E(void) { LCD_EN = 1; delay_us(250); LCD_EN = 0; } void LCD_Command(unsigned char rs, unsigned char rw, unsigned char data) { LCD_RS = rs; LCD_RW = rw; LCD_Da.. 2022. 7. 13. 이전 1 다음 반응형