#include<conio.h>#include<stdlib.h>#include"../lib/8000.h"/*This demo program is for I-8057,I-8053 Module,16 Digital Output & 16 digital Input.Before Run this program,connect the digital output to the digital input*/void main(){ int SlotNo1,SlotNo2,DOdata,DIdata; Print("Please Input DO Module Slot Number(0 to 7) =");//Specific the digital output slot number of I-8057. SlotNo1 = ascii_to_hex(Getch());//MiniOS7 read the slot input. Print(" %d \n\r",SlotNo1);//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. DIOData[SlotNo1].data16 = DOdata;//store the data to the internal variable.for later reference Print("Please Input DI Module Slot Number(0 to 7) =");//Specific the digital input slot number of I-8053. SlotNo2 = ascii_to_hex(Getch());//MiniOS7 read the slot input. Print(" %d \n\r",SlotNo2);//Show the user input. DO_16(SlotNo1,DIOData[SlotNo1].data16);//Function call to execute, set digital output Delay_1(300);//for Isolation Type,Wait the photo coupler DIdata = DI_16(SlotNo2);//Function call to execute, read digital input Print("DI data = %X\n\r",DIdata);//Show the digital input value.}
Back to Previous Page