|
#pragma code /80c196kc 지정
#pragma model(kc)
#include <80c196.h>
/*8255 어드레스 선언*/
#define B_IOPPI_A (unsigned char)0x9800
#define B_IOPPI_B (unsigned char)0x9801
#define B_IOPPI_C (unsigned char)0x9802
#define B_IOPPI_CW (unsigned char)0x9803
/*포인터 선언*/
unsigned char *IOPPI_A;
unsigned char *IOPPI_B;
unsigned char *IOPPI_C;
unsigned char *IOPPI_CW;
void Delay(); //시간지연
void main(void)
{
/*포인터 지정*/
IOPPI_A = B_IOPPI_A;
IOPPI_B = B_IOPPI_B;
IOPPI_C = B_IOPPI_C;
IOPPI_CW = B_IOPPI_CW;
*IOPPI_CW = 0x82;
while(1) /* 무한 반복 */
{
*IOPPI_A = 0xaa;
Delay(10000);
*IOPPI_A = 0x55;
Delay(10000);
}
}
void Delay(unsigned int cnt)
{
while(cnt++);
}
}
-----------------------------------------------------
이건 원문인데요. 오류를 몇 개 찾으라고 하네요. 제가 어느 정도 수정은 했습니다.
주석도 달아야 하는데 몇 개 밖에 몰라서 몇 개만 달았구요.
나머지는 나름대로는 원본에서 수정을 했는데.... 혹시 오류난 것이 있으면 지적 좀 해주세요.
제가 <80c196.h>란 파일이 없다고 뜨네요..[터보 c를 돌려보니..]
-------------------------------------------------------
#pragma code
#pragma model(kc)
#include <80c196.h>
#define B_IOPPI_A (unsigned char*)0x9800
#define B_IOPPI_B (unsigned char*)0x9801
#define B_IOPPI_C (unsigned char*)0x9802
#define B_IOPPI_CW (unsigned char*)0x9803
unsigned char *IOPPI_A;
unsigned char *IOPPI_B;
unsigned char *IOPPI_C;
unsigned char *IOPPI_CW;
void main(void)
{
IOPPI_A = B_IOPPI_A;
IOPPI_B = B_IOPPI_B;
IOPPI_C = B_IOPPI_C;
IOPPI_CW = B_IOPPI_CW;
*IOPPI_CW = 0x82;
while(1) {
*IOPPI_A = 0xaa;
}
}
그리고 이건 자세한 주석을 달라는 것... 위에 것과 별다른 차이가 없는 것으로 생각해요.
unsigned char buf를 이용해서 문구를 만들라고 했는데.
제 생각인데.... [unsigned char]부분에 그냥 뒤에 [buf]만 대입하면 되지 않나요?
|