PC인터페이스를 이용한 시스템 응용에 코드 해석??? 한번 봐주세요 ㅇㅅㅇ
쥬디시어스
질문 제목 :
이거 조목조목 어떻게 돌아가는지 해석좀 해주세요 ...
printf scanf 정도는 알긴하지만 그래도 이해가 안가는 부분이 많네요
case1 까지만 해석좀 해주시면 감사하겠습니다.
개정판 pc인터페이스를 이용한 시스템 응용 이라는 책안에 있는 건데 ..
자세한 설명은 생략한다라는 구조의 책이라서 말이죠...
질문 내용 :
#include stdafx.h
#include conio.h
#include dos.h
#include ..\..\eblib\\eblib.h //2402 컴퓨터실 컴퓨터 경로 사용시 경로 수정 요망
#define base_addr0x300
#define portabase_addr | 0x04
#define portbbase_addr | 0x05
#define portcbase_addr | 0x06
#define cwrobase_addr | 0x07
#define cwr1base_addr | 0x0b
void init_eboard(void)
{
outp(cwro, 0x88);
outp(cwr1, 0x80);
outp(porta, 0xff);/* initaialize dot_matrix led */
}
void main(void)
{
int i, j, count;
if(initdriver(eb_device_pci))//device driver initialize
{
printf(device driver loading fail!\r\n); //\r (carrige reutrn)현재 줄 처음으로 감.
return;
}
clrscr();
init_eboard();
printf(\npush a button switch (sw1, sw2, sw3, sw4). \n);
do{
i = ((0xff - inp(portc)) 4) & 0x0f;4a3
switch(i)
{
case 1:
outp(portb, 0x10);
printf(push button 1 (sw1) is on. \n);
count = 0;
do
{
i = ((0xff - inp(portc)) 4) & 0x01;
if (i != 0) count++;
delat(1);
}while(count 10);
count = 0;
do
{
i = ((0xff - inp(portc)) 4) & 0x01;
if (i == 0) count++;
delay(1);
} while(count 10);
outjp(portb, 0x00);
break;
case 2:
outp(portb, 0x20);
printf(push button 2 (sw2) is on. \n);
count = 0;
do
{
i = ((0xff - inp(portc)) 4) & 0x02;
if (i == 0) count++;
delay(1);
} while(count 10);
outp(protb, 0x00);
break;
case 4;
outp(portb, 0x40);
printf(push button 3 (sw3) is on. \n);
count = 0;
do
{
i = ((0xff - inp(portc)) 4) & 0x04;
if (i != 0) count++;
delay(1);
} while(count 10);
count = 0;
do
{
i = ((0xff - inp(portc)) 4) & 0x04;
if (i == 0) count++;
delay(1);
} while(count 10);
outp(portb. 0x00);
break;
case 8;
outp(portb, 0x80);
printf(push button 4 (sw) is on.\n);
count = 0;
do
{
i = ((0xff - inp(portc)) 4) & 0x08;
if (i != 0)count++;
delay(1);
}while(count 10);
count + 0;
do
{i = ((0xff - inp(portc)) 4) &at; 4) & 0x08;
if (i == 0) count++;
delay(1);
} while(count 10);
outp(portb, 0x00);
break;
}
{while(!kbhit());
init_eboard();
}
번호 | 제 목 | 글쓴이 | 날짜 |
---|---|---|---|
2695626 | 피보나치수열 과제 때문에 질문 드립니다. (6) | 옆집언니 | 2025-05-22 |
2695595 | 포인트공부중입니다 int형에서 4=1 인가요? (3) | 족장 | 2025-05-22 |
2695567 | 드라이브 고유번호를 가져오는 함수 (2) | 초코맛사탕 | 2025-05-21 |
2695533 | 음수의 산술변환! 질문이요 ㅠㅠ... (4) | 꽃여름 | 2025-05-21 |
2695506 | 구조체 배열 이용 도서목록 출력 프로그램 (1) | 가을귀 | 2025-05-21 |
2695450 | c언어 함수 질문이요.... | 이슬비 | 2025-05-20 |
2695403 | VirtualAlloc함수 및 메모리 질문 | 크리에이터 | 2025-05-20 |
2695355 | c언어 for함수 | 미쿡 | 2025-05-19 |
2695327 | 안녕하세요 제가 이번에 좀 큰 프로그램을.. | 악당 | 2025-05-19 |
2695295 | mutex동기화의 thread기반 채팅 서버소스 질문입니다 | 그루터기 | 2025-05-19 |
2695270 | 질문이요..swap 관한겁니다..ㅠㅠ (3) | 콩알녀 | 2025-05-19 |
2695244 | 노땅초보궁금한게 하나 있는데요..반복문(while문)초보자질문 (6) | 큰꽃늘 | 2025-05-18 |
2695166 | do while 문 어떤것이잘못된건지 모르겠어요 (2) | 아이폰 | 2025-05-18 |
2695122 | 구조체에 대해 물어보고 싶은게 있습니다 ^^^.. (7) | 수련 | 2025-05-17 |
2695091 | txt 파일 입출력 후 2차 배열에 저장하기입니다. (3) | 헛장사 | 2025-05-17 |
2695063 | 수도요금 프로그램좀 짜주세요. | 시내 | 2025-05-17 |
2695033 | 답변좀요ㅠㅠ (1) | 비사벌 | 2025-05-16 |
2695010 | C++의 STL은 왜 굳이 템플릿화 시켜서 라이브러리를 만드나요? (초보수준의 질문..) (2) | 엘보어 | 2025-05-16 |
2694958 | 로직이 변한다는 것에 대해서 궁금합니다. | 튼동 | 2025-05-16 |
2694929 | 열혈강의 25-2 두번째 문제 질문 | 지우개 | 2025-05-15 |