A SERVICE OF

logo

106 IrDA Lite Plus
MX3 Reference Guide E-EQ-MX3RG-J-ARC
IRECV.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>
#define BUF_SIZE 4096 // 60
char buf[BUF_SIZE];
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);
}
void main (int argc, char *argv[])
{
unsigned char *c;
unsigned long bytesRecvd = 0;
int status, comPort = 0xffff;
int fh;
unsigned int i, writen;
/* IR.EXE filename */
fprintf(stderr, "\nIrPlus Version 1.00, read buffer size %d bytes.\n", BUF_SIZE);
// check which COM port
__asm {
mov ax, 0ffffH
mov dx, 0ffffH
int 14H
cmp ax, dx
jz COMM
jmp DONE
COMM:
mov comPort, ax
DONE:
}