bioscom은 윈도우에선 쓸수 없습니다.
정확히 윈도우 어느 버젼부터인지는 모르겠습니다만..
(아마도 95부터 일듯..)
윈도우에서의 RS232제어 소스는 빌더 자료실에 몇가지 있습니다.
그리고 Turbo C++ 3.1로 공부하는 것은 추천하고 싶지 않습니다.
가능하면.. 빌더 학생판을 사서 공부하시는 것이 좋을것 같습니다.
초보후니 님이 쓰신 글 :
:
:
:
:
:
:
:
저는 Turbo C++ 3.1 윈도우용으로 공부하고 있습니다.
:
아래 소스로 컴파일을 시켜보면 success 나오는데요.
:
warning이나 error도 없고요.
:
근데 run시켜보면 오류 뜹니다. 글고 exe파일 생성도 안되고요.
:
Ctrl+F9로 실행시켰을때 오류메시지는 아래와 같습니다.
:
:
Linker Warning : No module definition file specified: using defaults
:
Linker Error: Undefined symbol_bioscom in module testsource.CPP
:
:
이렇습니다. 고수님들의 도움이 필요합니다. ㅠ.ㅠ 좋은하루 되시길....
:
:
:
#include
#include
#include
:
#include
#include
:
#define
: COM1
: 0
#define
: COM2
: 1
#define
: DATA_READY
: 0x100
#define
: COM_2400
: 0xA0
#define
: COM_NOPARITY
: 0x00
#define
: COM_CHR7
: 0x02
#define
: COM_STOP2
: 0x04
#define SETTINGS ( COM_2400 | COM_NOPARITY | COM_CHR7 | COM_STOP2
: )
/*
:
#define COM1 1
#define
: TRUE 1
#define
: FALSE 0
#define SETTINGS (_COM_9600 | _COM_CHR7
: | _COM_STOP2 | _COM_NOPARITY)
*/
:
unsigned long data_in[256];
:
void main()
{
unsigned in,out, cnt, c ;
: int term, tmr1, tmr2, tmr3, tmr4;
char
: filename[20];
FILE *fp;
struct time
: t;
:
clrscr();
:
bioscom(0, SETTINGS,
: COM1); /* RS232C 초기화 */
: printf("Sampling Count : \n");
printf("file name :
: \n");
printf("term(sec) : \n");
: printf("=======================\n");
gotoxy(18,
: 1);
scanf("%d", &in);
gotoxy(13,
: 2);
scanf("%s", &filename);
: gotoxy(13,3);
scanf("%d", &term);
:
gettime(&t);
tmr1 = t.ti_min * 60 +
: t.ti_sec;
tmr3 = tmr1;
: gotoxy(1,5);
printf("Data receive\n");
: printf("The current time is: %d\n", tmr1);
:
for (cnt = 0; cnt < in; cnt++) {
: while (1)
{
: gettime(&t);
tmr4 = t.ti_min *60 +
: t.ti_sec;
if(tmr4-tmr3 >=
: term)
{
tmr3 =
: tmr4;
break;
: }
}
:
while( (bioscom(3, 0, COM1) & DATA_READY)==0
: ); /*수신 대기 */
out = bioscom(2,0,COM1);
: /* 수신 */
data_in[cnt] = out;
//
: printf(".");
printf("%d \t", out);
if (kbhit())
: { // 키보드의 입력이 있으면 1 그렇지 않으면 0을 되될리는 함수
if (getch() ==
: '\x1B') break; //16진수 1B, 즉 ESC 코드
}
: }
:
gettime(&t);
tmr2 = t.ti_min * 60 +
: t.ti_sec;
printf("\n");
printf("The current time
: is : %d\n", tmr2);
printf("%d, %d\n", in,
: tmr2-tmr1);
printf("\naverage time : %2.3f\n",
: ((float)(tmr2-tmr1)) / ((float)in));
:
printf("** press ENTER to data save.");
: getch();
fp = fopen(filename,"w");
for(cnt = 0;
: cnt c =
: data_in[cnt];
fputc(c,fp);
: }
fclose(fp);
}
:
:
:
: