티스토리 뷰
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98 |
#include <io.h>
#include <mega128.h>
#include <delay.h>
//int count;
//int sw;
void lcd_func(void){
PORTG = 0x01; // 명령어 쓰는 신호
PORTA = 0x38; // 0b00111000 8비트, 2행, 5*7도
delay_us(39);
PORTG = 0x00;
}
void lcd_pic(void){
PORTG = 0x01;
PORTA = 0x0e; // 0b00001110 화면on, 커서 on, 블링크 off
delay_us(39);
PORTG = 0x00;
}
void lcd_mv(void){
PORTG = 0x01;
PORTA = 0x06; // 0b00000110 중가, 표시시프트 off
delay_us(39);
PORTG = 0x00;
}
void lcd_clear(void){
PORTG = 0x01;
PORTA = 0x01; // clear
delay_us(2);
PORTG = 0x00;
}
void lcd_data(unsigned char a, unsigned char b){
unsigned char sw;
sw = 0x00;
if(a == 1)sw = 0xc0; // a가 1일 때, sw는 0b11000000; 0b00000000;
PORTG = 0x01; // 명령어 신호
PORTA = (0x80|b|sw); // 0b10000000|8bit|11000000 or 00000000 == 0b11010000|b 하위 7비트 사용해서 DDRAM 저장
delay_us(39);
PORTG = 0x00;
}
void lcd_read(unsigned char a){
PORTG = 0x05; // 0b00000101, 쓰기신호, Enable
PORTA = a; //
delay_us(43);
PORTG = 0x04; // 100 쓰기, Disenable
}
void main(){
DDRG = 0x07;
DDRA = 0xff;
lcd_clear();
delay_ms(10);
lcd_func();
lcd_pic();
lcd_mv();
lcd_data(0,0);
lcd_read(0x46);
lcd_data(0,1);
lcd_read(0x75);
lcd_data(0,2);
lcd_read(0x6e);
lcd_data(0,3);
lcd_read(0x21);
lcd_data(1,0);
lcd_read(0x4d);
lcd_data(1,1);
lcd_read(0x43);
lcd_data(1,2);
lcd_read(0x55);
lcd_data(1,3);
lcd_read(0x21);
lcd_data(1,4);
lcd_read(0x46);
lcd_data(1,5);
lcd_read(0x75);
lcd_data(1,6);
lcd_read(0x6e);
lcd_data(1,7);
lcd_read(0x21);
while(1){
}
} |
'프로그래밍 > C' 카테고리의 다른 글
중복 여부에 따른 이진탐색(Binary Search) (1) | 2020.09.12 |
---|---|
마이크로프로세서 0517 (0) | 2018.05.24 |
마이크로프로세서 0510 (0) | 2018.05.10 |
C언어, 한정자 const/volatile/static/extern (0) | 2018.04.20 |
[자료구조] 3일차_과제(180323) - 연결리스트 (0) | 2018.03.30 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- vue.js
- alpine.js
- SQLite
- nuxt.js
- svelte
- node.js
- Azure
- Remix
- nosql
- REACT
- Next.js
- Angular
- vue
- MySQL
- RDBMS
- Cloud
- 이진탐색 #중복
- aws
- oracle
- gcp
- hoisting
- Quasar
- Gatsby.js
- PostgreSQL
- JavaScript
- DevOps
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
글 보관함