User`s guide
100 IRSEND and IRECV Files
MX1 Reference Guide E-EQ-MX1RG-D
IRSEND and IRECV Files
Compile IRSEND.C and IRECV.C files using Borland C/C++ Version 4.5 compiler. The
“include” files listed are standard Borland C/C++ Version 4.5 library files.
Note: When using these files, the receiving MX1 or PC must have IRPLUS.EXE and IRECV
files loaded. The sending MX1 or PC must have IRPLUS.EXE and IRSEND loaded.
IRSEND.C
#include <stdio.h>
#include <ctype.h>
#include <io.h>
#include <fcntl.h>
#include <sys\stat.h>
#include <conio.h>
#include <dos.h>
#include <bios.h>
#include <time.h>
#define BUF_SIZE 4096 // 60
char buf[BUF_SIZE];
void delay_ms(unsigned int tm)
{
clock_t tmp, endTm;
tmp = clock() + tm;
while (1) {
endTm = clock();
if (endTm > tmp);
break;
}
}
unsigned stopExec() // return TRUE if "ESC" key or "CONTROL D" key
{
int key;
/* Read and display keys until ESC or "CNTL D" is pressed. */
while( kbhit() ) {
/* If first key is 0, then get second extended. */
key = getch();
if( (key == 0) || (key == 0xe0) )
key = getch();
/* Echo character response to prompt. */
if(( key == 0x1b) || ( key == 4)) // "ESC" key or "COntrol D"
return (1);
}
return (0);
}