#include<conio.h>
#include<stdlib.h>
#include"../lib/8000.h" //I-8000 Series Function Call Definition
/*
This demo program is writted for I-8054 Module,8 Digital Output & 8 digital Input.
Before Run this program,connect the digital output to the digital input
*/
void main()
{
unsigned int SlotNo,DOdata;
unsigned char DIdata;
Print("Please Input DO Module Slot Number(0 to 7) =");//Specific the slot number of I-8054.
SlotNo = ascii_to_hex(Getch());//MiniOS7 read the slot input.
Print(" %d \n\r",SlotNo);//Show the user input.
Print("Please Input DO Data(Hex) = ");
Scanf("%x",&DOdata);//MiniOS7 read the user keyin the digital output value.
Print("DO data = %x\n\r",DOdata);//Show the user input.
DIO_DO_8(SlotNo,DOdata);//Function call to execute, set digital output
Delay_1(300);//for Isolation Type,Wait the photo coupler
DIdata = DI_8(SlotNo);//Function call to execute, read digital input
Print("DI data = %X\n\r",DIdata);//Show the digital input value.
}
Back to Previous Page