목차
Ⅰ. 서론
1. 연구 배경
2. 연구 목표
3. 작품의 기능 및 성능
4. 개발일정
Ⅱ. 본론
1. 마이크로 프로세서 PIC16F73의 이해
2. RS232C 전송방식이란
3. Key Matrix 구조
4. Dot Matrix 구조
Ⅲ. 결론
Ⅳ. 제작 후기
Ⅴ. 참고 자료
별첨 : 1. 회로도 및 도트매트릭스 실행화면
2. 프로그램소스
1. 연구 배경
2. 연구 목표
3. 작품의 기능 및 성능
4. 개발일정
Ⅱ. 본론
1. 마이크로 프로세서 PIC16F73의 이해
2. RS232C 전송방식이란
3. Key Matrix 구조
4. Dot Matrix 구조
Ⅲ. 결론
Ⅳ. 제작 후기
Ⅴ. 참고 자료
별첨 : 1. 회로도 및 도트매트릭스 실행화면
2. 프로그램소스
본문내용
KEY_CODE[F];
return(temp);
}
temp = key2 & 0x04;
if(!temp) {
temp = KEY_CODE[J];
return(temp);
}
}
return(NOKEY);
}
BYTE check_key3(void)
{
BYTE temp;
if(key3 != NOKEY) {
temp = key3 & 0x01;
if(!temp) {
temp = KEY_CODE[C];
return(temp);
}
temp = key3 & 0x02;
if(!temp) {
temp = KEY_CODE[G];
return(temp);
}
temp = key3 & 0x04;
if(!temp) {
temp = KEY_CODE[K];
return(temp);
}
}
return(NOKEY);
}
BYTE check_key4(void)
{
BYTE temp;
if(key4 != NOKEY) {
temp = key4 & 0x01;
if(!temp) {
temp = KEY_CODE[D];
return(temp);
}
temp = key4 & 0x02;
if(!temp) {
temp = KEY_CODE[H];
return(temp);
}
temp = key4 & 0x04;
if(!temp) {
temp = KEY_CODE[L];
return(temp);
}
temp = key4 & 0x08;
if(!temp) {
temp = ENTER;
return(temp);
}
}
return(NOKEY);
}
BYTE was_key(void)
{
BYTE temp;
BYTE checker;
checker = 0;
for(temp=0;temp<8;temp++)
{
key_pos[temp] = 0;
}
if(key1 != NOKEY) {
key_pos[0] = 1;
}
if(key2 != NOKEY) {
key_pos[1] = 1;
}
if(key3 != NOKEY) {
key_pos[2] = 1;
}
if(key4 != NOKEY) {
key_pos[3] = 1;
}
for(temp=0;temp<8;temp++)
{
if(key_pos[temp]) {
checker++;
}
}
return(checker);
}
BYTE scan_key(void)
{
BYTE temp;
key1 = NOKEY;
key2 = NOKEY;
key3 = NOKEY;
key4 = NOKEY;
keycode = NOKEY;
key1 = read_key1(KS0);
key2 = read_key1(KS1);
key3 = read_key1(KS2);
key4 = read_key1(KS3);
temp = was_key();
if(!temp) {
return(NOKEY);
}
keycode = check_key1();
if(keycode != NOKEY) {
return(keycode);
}
keycode = check_key2();
if(keycode != NOKEY) {
return(keycode);
}
keycode = check_key3();
if(keycode != NOKEY) {
return(keycode);
}
keycode = check_key4();
if(keycode != NOKEY) {
return(keycode);
}
return(NOKEY);
}
void refresh_key_buf(void)
{
BYTE temp;
for(temp=0;temp<4;temp++) {
key_buf[temp] = NOKEY;
}
}
void init_sys(void)
{
BYTE temp;
porta_buf = 0xff;
portb_buf = 0xff;
portc_buf = 0xff;
TRISA = 0x00; /* all output */
TRISB = 0xff; /* all input */
PORTA = porta_buf;
key1 = NOKEY;
key2 = NOKEY;
key3 = NOKEY;
key4 = NOKEY;
keycode = NOKEY;
key = NOKEY;
refresh_key_buf();
}
void main(void)
{
BYTE temp;
BYTE keytemp;
BYTE protection;
init_sys();
index = 0;
rescan:
while(1) {
key = NOKEY;
key = scan_key();
if(key != NOKEY) break;
}
if(key != NOKEY) {
/*
while(1) {
temp = NOKEY;
temp = scan_key();
if(temp == NOKEY) break;
}
*/
delay_ms(500);
if(key != ENTER) {
if(index < 4) {
key_buf[index] = key;
}
index++;
if(index > 4) {
index = 4;
}
goto rescan;
}
if(!index) goto rescan;
putc(ENTER);
delay_ms(200);
for(temp=0;temp
/* out keycode data using RS232 */
if(temp==0) {
putc(KEY_CODE[W]);
delay_ms(200);
keytemp = key_buf[temp];
putc(keytemp);
delay_ms(200);
} else if(temp==1) {
putc(KEY_CODE[X]);
delay_ms(200);
keytemp = key_buf[temp];
putc(keytemp);
delay_ms(200);
} else if(temp==2) {
putc(KEY_CODE[Y]);
delay_ms(200);
keytemp = key_buf[temp];
putc(keytemp);
delay_ms(200);
} else if(temp==3) {
putc(KEY_CODE[Z]);
delay_ms(200);
keytemp = key_buf[temp];
putc(keytemp);
delay_ms(200);
}
}
putc(ENTER);
delay_ms(200);
index = 0;
refresh_key_buf();
goto rescan;
}
goto rescan;
}
return(temp);
}
temp = key2 & 0x04;
if(!temp) {
temp = KEY_CODE[J];
return(temp);
}
}
return(NOKEY);
}
BYTE check_key3(void)
{
BYTE temp;
if(key3 != NOKEY) {
temp = key3 & 0x01;
if(!temp) {
temp = KEY_CODE[C];
return(temp);
}
temp = key3 & 0x02;
if(!temp) {
temp = KEY_CODE[G];
return(temp);
}
temp = key3 & 0x04;
if(!temp) {
temp = KEY_CODE[K];
return(temp);
}
}
return(NOKEY);
}
BYTE check_key4(void)
{
BYTE temp;
if(key4 != NOKEY) {
temp = key4 & 0x01;
if(!temp) {
temp = KEY_CODE[D];
return(temp);
}
temp = key4 & 0x02;
if(!temp) {
temp = KEY_CODE[H];
return(temp);
}
temp = key4 & 0x04;
if(!temp) {
temp = KEY_CODE[L];
return(temp);
}
temp = key4 & 0x08;
if(!temp) {
temp = ENTER;
return(temp);
}
}
return(NOKEY);
}
BYTE was_key(void)
{
BYTE temp;
BYTE checker;
checker = 0;
for(temp=0;temp<8;temp++)
{
key_pos[temp] = 0;
}
if(key1 != NOKEY) {
key_pos[0] = 1;
}
if(key2 != NOKEY) {
key_pos[1] = 1;
}
if(key3 != NOKEY) {
key_pos[2] = 1;
}
if(key4 != NOKEY) {
key_pos[3] = 1;
}
for(temp=0;temp<8;temp++)
{
if(key_pos[temp]) {
checker++;
}
}
return(checker);
}
BYTE scan_key(void)
{
BYTE temp;
key1 = NOKEY;
key2 = NOKEY;
key3 = NOKEY;
key4 = NOKEY;
keycode = NOKEY;
key1 = read_key1(KS0);
key2 = read_key1(KS1);
key3 = read_key1(KS2);
key4 = read_key1(KS3);
temp = was_key();
if(!temp) {
return(NOKEY);
}
keycode = check_key1();
if(keycode != NOKEY) {
return(keycode);
}
keycode = check_key2();
if(keycode != NOKEY) {
return(keycode);
}
keycode = check_key3();
if(keycode != NOKEY) {
return(keycode);
}
keycode = check_key4();
if(keycode != NOKEY) {
return(keycode);
}
return(NOKEY);
}
void refresh_key_buf(void)
{
BYTE temp;
for(temp=0;temp<4;temp++) {
key_buf[temp] = NOKEY;
}
}
void init_sys(void)
{
BYTE temp;
porta_buf = 0xff;
portb_buf = 0xff;
portc_buf = 0xff;
TRISA = 0x00; /* all output */
TRISB = 0xff; /* all input */
PORTA = porta_buf;
key1 = NOKEY;
key2 = NOKEY;
key3 = NOKEY;
key4 = NOKEY;
keycode = NOKEY;
key = NOKEY;
refresh_key_buf();
}
void main(void)
{
BYTE temp;
BYTE keytemp;
BYTE protection;
init_sys();
index = 0;
rescan:
while(1) {
key = NOKEY;
key = scan_key();
if(key != NOKEY) break;
}
if(key != NOKEY) {
/*
while(1) {
temp = NOKEY;
temp = scan_key();
if(temp == NOKEY) break;
}
*/
delay_ms(500);
if(key != ENTER) {
if(index < 4) {
key_buf[index] = key;
}
index++;
if(index > 4) {
index = 4;
}
goto rescan;
}
if(!index) goto rescan;
putc(ENTER);
delay_ms(200);
for(temp=0;temp
if(temp==0) {
putc(KEY_CODE[W]);
delay_ms(200);
keytemp = key_buf[temp];
putc(keytemp);
delay_ms(200);
} else if(temp==1) {
putc(KEY_CODE[X]);
delay_ms(200);
keytemp = key_buf[temp];
putc(keytemp);
delay_ms(200);
} else if(temp==2) {
putc(KEY_CODE[Y]);
delay_ms(200);
keytemp = key_buf[temp];
putc(keytemp);
delay_ms(200);
} else if(temp==3) {
putc(KEY_CODE[Z]);
delay_ms(200);
keytemp = key_buf[temp];
putc(keytemp);
delay_ms(200);
}
}
putc(ENTER);
delay_ms(200);
index = 0;
refresh_key_buf();
goto rescan;
}
goto rescan;
}
소개글