I have some C source Code to control a device under Windows. The device is a couple of relays that will start a buzzer at various times.
I'm told its very simple Turbo C but I doubt I can run it as is on a Linux Box. (This is true isnt it???)
#include <conio.h> #include <conio.h>
#include <dos.h>
#include <stdio.h>
main()
{
int a,x;
clrscr();
printf(" AR-2 relay test program (com1)\n\n"
printf("(1) De-energize relay #1\n"
printf("(2) Energize relay #1\n"
printf("(3) De-energize relay #2\n"
printf("(4) Energize relay #2\n"
printf("(5) Exit to Dos\n\n"
printf("select function"
do
{
a=getch();
x=inportb(0x3FC);
if (a==49) x=x&~2;
if (a==50) x=x|2;
if (a==51) x=x&~1;
if (a==52) x=x|1;
outportb(0x3FC,x);
}
while (a!=53);
clrscr();
}
Can anyone suggest a way to write this in Linux to use ttyS1?
Bo
I know its a tall order, great thanks in advance.
I'm told its very simple Turbo C but I doubt I can run it as is on a Linux Box. (This is true isnt it???)
#include <conio.h> #include <conio.h>
#include <dos.h>
#include <stdio.h>
main()
{
int a,x;
clrscr();
printf(" AR-2 relay test program (com1)\n\n"
printf("(1) De-energize relay #1\n"
printf("(2) Energize relay #1\n"
printf("(3) De-energize relay #2\n"
printf("(4) Energize relay #2\n"
printf("(5) Exit to Dos\n\n"
printf("select function"
do
{
a=getch();
x=inportb(0x3FC);
if (a==49) x=x&~2;
if (a==50) x=x|2;
if (a==51) x=x&~1;
if (a==52) x=x|1;
outportb(0x3FC,x);
}
while (a!=53);
clrscr();
}
Can anyone suggest a way to write this in Linux to use ttyS1?
Bo
I know its a tall order, great thanks in advance.