목차
1. 프로젝트 정의
2. 프로젝트 요구사항 분석
3. 초기 설계(S/W)
4. 상세 설계(S/W)
메트릭스 LED 구동 방법
DC 모터 동작
E-Board DC Motor와 8255의 포트C
누름 스위치 동작 설명
누름스위치의 입력 회로
5. 최종결과 및 고찰
최종 source (남+여 표시)
2. 프로젝트 요구사항 분석
3. 초기 설계(S/W)
4. 상세 설계(S/W)
메트릭스 LED 구동 방법
DC 모터 동작
E-Board DC Motor와 8255의 포트C
누름 스위치 동작 설명
누름스위치의 입력 회로
5. 최종결과 및 고찰
최종 source (남+여 표시)
본문내용
r와의 소스 결합 하지 못함.
팀원들 간의 단합은 잘되었으나 C언어에 대한 지식이 부족하여 많은 어려움을 겪었다. 교수님과 주변 도움에도 불구하고 이번 프로젝트를 성공 해내지 못한 것이 아쉽다. 그래도 이번 프로젝트를 진행하면서 EZ보드에 있는 Dot matrix 와 DC Motor 에 관한 기본적인 원리를 이해하는데 많은 도움을 받을 수 있었다. 처음 작성한 순서도의 내용대로 차근차근 진행해 나갔어야 하는데 처음 과정을 생략하고 중간 과정부터 프로젝트를 진행해나가 중간에 막혀 만족하지 못한 결과물이 나온 것 같다.
최종 source (남+여 표시)
#include
#include
#include
#include \"eblib.h\"
#define BASE_ADDR 0x300
#define PORTA BASE_ADDR | 0x04
#define PORTB BASE_ADDR | 0x05
#define PORTC BASE_ADDR | 0x06
#define CWR0 BASE_ADDR | 0x07
#define CWR1 BASE_ADDR | 0x0b
#define DC_MOTOR_ON 0x08
#define DC_MOTOR_OFF 0x00
#define switch_on 500
#define switch_off 500
#define On_Time 100
#ifndef TRUE
#define TRUE 1
#endif /* ifndef TRUE */
#ifndef FALSE
#define FALSE 0
#endif /* ifndef FALSE */
void init_eboard(void)
{
outportb(CWR0, 0x88); /* PortA, PortB, PortC(L):Out, PortC(H): In */
outportb(CWR1, 0x80); /* PortA, PortB, PortC(L):Out, PortC(H): Out */
outportb(PORTA, 0xff); /* initialize dot_matrix led */
}
int EbdSwitch(int SwitchId)
{
unsigned int nDin, bOn;
nDin = inp(PORTC); /* read switch port */
switch (SwitchId)
{
case 0: bOn = (nDin & 0x10) ? FALSE : TRUE; break;
case 1: bOn = (nDin & 0x20) ? FALSE : TRUE; break;
case 2: bOn = (nDin & 0x40) ? FALSE : TRUE; break;
case 3: bOn = (nDin & 0x80) ? FALSE : TRUE; break;
}
return bOn;
}
int main(void)
{
if(InitDriver(EB_DEVICE_PCI))
{
printf(\"Device Driver Loading Fail!\\r\\n\");
return 0;
}
int i, j, count, timeout;
//clrscr();
init_eboard();
printf(\"\\nPush a Button Switch (SW1, SW2, SW3, SW4).\\n\");
while(1)
{
for (i = 0; i < 4; i++)
if (!EbdSwitch(i)) continue;
count = 0;
for (timeout = 0; timeout < 50; timeout++)
{
if (EbdSwitch(i)) count++;
delay(1);
}
if (count < 10) continue;
//outp(PORTB, (1 << i) | (1 << (i+4)));
///* outp(RELAY, 1 << (i+4)); */
//printf(\"Push Button %d is pressed.\\n\", i);
if(i==0)
{
//init_eboard();
int ch1[8][8]={0,0,0,1,1,0,0,0,
0,0,1,1,1,1,0,0,
0,1,0,1,1,0,1,0,
1,0,0,1,1,0,0,1,
0,0,0,1,1,0,0,0,
0,1,1,1,1,1,1,0,
1,0,0,0,0,0,0,1,
0,1,1,1,1,1,1,0};
int k=0;
while(k<100)
{
for (j = 0; j < On_Time; j++)
{ for (j = 0; j < 8; j++)
{ for (i = 0; i < 8; i++)
{
if(ch1[j][i] == 1)
{ outportb(PORTA, j*8+i);
delay(0);
}
else
{ outp(PORTA, 0xc0);
delay(0);
}
/* if (kbhit())
{init_eboard();
return;
}*/
}
}
printf(\"%d\",i);
break;
}
k++;
}
init_eboard();
}
if(i==1)
{
init_eboard();
int ch1[8][8]={0,1,1,1,1,1,1,0,
1,0,0,0,0,0,0,1,
0,1,1,1,1,1,1,0,
0,0,0,1,1,0,0,0,
1,1,1,1,1,1,1,1,
0,0,0,1,1,0,0,0,
0,0,0,1,1,0,0,0,
0,0,0,1,1,0,0,0};
int k=0;
while(k<100)
{
for (j = 0; j < On_Time; j++)
{ for (j = 0; j < 8; j++)
{ for (i = 0; i < 8; i++)
{
if(ch1[j][i] == 1)
{ outportb(PORTA, j*8+i);
delay(0);
}
else
{ outp(PORTA, 0xc0);
delay(0);
}
/*if (kbhit())
{init_eboard();
return;
}*/
}
}
printf(\"%d\",i);
break;
}
k++;
}
init_eboard();
}
count = 0;
do
{
if (!EbdSwitch(i)) count++;
delay(1);
}
while(count < 10);
outp(PORTB, 0x00);
/* outp(RELAY, 0x00); */
}
if (kbhit()) { if (getch() == 27) return; }
}
}
팀원들 간의 단합은 잘되었으나 C언어에 대한 지식이 부족하여 많은 어려움을 겪었다. 교수님과 주변 도움에도 불구하고 이번 프로젝트를 성공 해내지 못한 것이 아쉽다. 그래도 이번 프로젝트를 진행하면서 EZ보드에 있는 Dot matrix 와 DC Motor 에 관한 기본적인 원리를 이해하는데 많은 도움을 받을 수 있었다. 처음 작성한 순서도의 내용대로 차근차근 진행해 나갔어야 하는데 처음 과정을 생략하고 중간 과정부터 프로젝트를 진행해나가 중간에 막혀 만족하지 못한 결과물이 나온 것 같다.
최종 source (남+여 표시)
#include
#include
#include
#include \"eblib.h\"
#define BASE_ADDR 0x300
#define PORTA BASE_ADDR | 0x04
#define PORTB BASE_ADDR | 0x05
#define PORTC BASE_ADDR | 0x06
#define CWR0 BASE_ADDR | 0x07
#define CWR1 BASE_ADDR | 0x0b
#define DC_MOTOR_ON 0x08
#define DC_MOTOR_OFF 0x00
#define switch_on 500
#define switch_off 500
#define On_Time 100
#ifndef TRUE
#define TRUE 1
#endif /* ifndef TRUE */
#ifndef FALSE
#define FALSE 0
#endif /* ifndef FALSE */
void init_eboard(void)
{
outportb(CWR0, 0x88); /* PortA, PortB, PortC(L):Out, PortC(H): In */
outportb(CWR1, 0x80); /* PortA, PortB, PortC(L):Out, PortC(H): Out */
outportb(PORTA, 0xff); /* initialize dot_matrix led */
}
int EbdSwitch(int SwitchId)
{
unsigned int nDin, bOn;
nDin = inp(PORTC); /* read switch port */
switch (SwitchId)
{
case 0: bOn = (nDin & 0x10) ? FALSE : TRUE; break;
case 1: bOn = (nDin & 0x20) ? FALSE : TRUE; break;
case 2: bOn = (nDin & 0x40) ? FALSE : TRUE; break;
case 3: bOn = (nDin & 0x80) ? FALSE : TRUE; break;
}
return bOn;
}
int main(void)
{
if(InitDriver(EB_DEVICE_PCI))
{
printf(\"Device Driver Loading Fail!\\r\\n\");
return 0;
}
int i, j, count, timeout;
//clrscr();
init_eboard();
printf(\"\\nPush a Button Switch (SW1, SW2, SW3, SW4).\\n\");
while(1)
{
for (i = 0; i < 4; i++)
if (!EbdSwitch(i)) continue;
count = 0;
for (timeout = 0; timeout < 50; timeout++)
{
if (EbdSwitch(i)) count++;
delay(1);
}
if (count < 10) continue;
//outp(PORTB, (1 << i) | (1 << (i+4)));
///* outp(RELAY, 1 << (i+4)); */
//printf(\"Push Button %d is pressed.\\n\", i);
if(i==0)
{
//init_eboard();
int ch1[8][8]={0,0,0,1,1,0,0,0,
0,0,1,1,1,1,0,0,
0,1,0,1,1,0,1,0,
1,0,0,1,1,0,0,1,
0,0,0,1,1,0,0,0,
0,1,1,1,1,1,1,0,
1,0,0,0,0,0,0,1,
0,1,1,1,1,1,1,0};
int k=0;
while(k<100)
{
for (j = 0; j < On_Time; j++)
{ for (j = 0; j < 8; j++)
{ for (i = 0; i < 8; i++)
{
if(ch1[j][i] == 1)
{ outportb(PORTA, j*8+i);
delay(0);
}
else
{ outp(PORTA, 0xc0);
delay(0);
}
/* if (kbhit())
{init_eboard();
return;
}*/
}
}
printf(\"%d\",i);
break;
}
k++;
}
init_eboard();
}
if(i==1)
{
init_eboard();
int ch1[8][8]={0,1,1,1,1,1,1,0,
1,0,0,0,0,0,0,1,
0,1,1,1,1,1,1,0,
0,0,0,1,1,0,0,0,
1,1,1,1,1,1,1,1,
0,0,0,1,1,0,0,0,
0,0,0,1,1,0,0,0,
0,0,0,1,1,0,0,0};
int k=0;
while(k<100)
{
for (j = 0; j < On_Time; j++)
{ for (j = 0; j < 8; j++)
{ for (i = 0; i < 8; i++)
{
if(ch1[j][i] == 1)
{ outportb(PORTA, j*8+i);
delay(0);
}
else
{ outp(PORTA, 0xc0);
delay(0);
}
/*if (kbhit())
{init_eboard();
return;
}*/
}
}
printf(\"%d\",i);
break;
}
k++;
}
init_eboard();
}
count = 0;
do
{
if (!EbdSwitch(i)) count++;
delay(1);
}
while(count < 10);
outp(PORTB, 0x00);
/* outp(RELAY, 0x00); */
}
if (kbhit()) { if (getch() == 27) return; }
}
}
추천자료
CPU Architecture Instruction type - I, R, J(jump and branch)
[초등교원임용고시 교육과정서브노트] - 실과
한국의 행정과 관료제
열역학 실험보고서
[기타] 기업경영과 정보시스템
컴활1급자료
건강가정 지원센터의 주요 기능과 역할과 평생교육 프로그램
멀티미디어의 개념
2018년 2학기 컴퓨터구조 출석대체시험 핵심체크
인터넷 활용1)사물인터넷에 대한 개념과 사물 인터넷의 주요 기술에 대해 정리하고 사물 인터...
2018년 2학기 프로그래밍언어론 기말시험 핵심체크
2018년 2학기 컴퓨터구조 기말시험 핵심체크
소개글