Appendix A Dio (Digital I/O) Sample Code - Quanmax KUBE-8040 User Manual

Embedded box pc with intel core 2 duo processor
Table of Contents

Advertisement

DIO (Digital I/O) Sample Code
//============================================
//KUBE-8040 Series DOS DIO sample program
//Please compile with Turbo C 3.0 to utilized the program
//============================================
int main()
{
int RetVal;
//Clear DIO_OUT 1~4
RetVal=inp(0x50d);//IO Port: 0x50d
RetVal=(RetVal&0xCF);//DIO_OUT 1 is bit 4
outp(0x50d,RetVal);
RetVal=inp(0x50e);//IO Port: 0x50e
RetVal=(RetVal&0xFB);//DIO_OUT 3 is bit 2
outp(0x50e,RetVal);
RetVal=inp(0x53a);//IO Port: 0x53a
RetVal=(RetVal&0xFE);//DIO_OUT 4 is bit 0
outp(0x53a,RetVal);
system("pause");
//Setting DIO_OUT 1~4
RetVal=inp(0x50d);//IO Port: 0x50d
RetVal=(RetVal|0x30);//DIO_OUT 1 is bit 4
outp(0x50d,RetVal);
RetVal=inp(0x50e);//IO Port: 0x50e
RetVal=(RetVal|0x04);//DIO_OUT 3 is bit 2
outp(0x50e,RetVal);
RetVal=inp(0x53a);//IO Port: 0x53a
RetVal=(RetVal|0x01);//DIO_OUT 4 is bit 0
KUBE-8040 User's Manual
Appendix A
//DIO_OUT 2 is bit 5
//DIO_OUT 2 is bit 5
39

Advertisement

Table of Contents
loading

Table of Contents