APPENDIX
MB740 User’s Manual 55
D. Digital I/O Sample Code
File name: Main.CPP
//---------------------------------------------------------------------------
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT
// WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED
// TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR
// PURPOSE.
//---------------------------------------------------------------------------
#include <dos.h>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include "ITE8705.H"
//---------------------------------------------------------------------------
void ClrKbBuf(void);
int main (int argc, char *argv[]);
void SetDioOutput(unsigned char);
unsigned char GetDioInput(void);
//---------------------------------------------------------------------------
int main (int argc, char *argv[])
{
if (Init_ITE8705() == 0)
{
printf("Can not detect ITE8705, program abort.\n");
return(1);
}
<!--[if !supportEmptyParas]--> <!--[endif]-->
printf("Current DIO input is 0%X\n", GetDioInput());
<!--[if !supportEmptyParas]--> <!--[endif]-->
printf("Set DIO output to high\n");
SetDioOutput(0x0F);
<!--[if !supportEmptyParas]--> <!--[endif]-->
printf("Set DIO output to low\n");
SetDioOutput(0x00);
<!--[if !supportEmptyParas]--> <!--[endif]-->
return 0;
}
//---------------------------------------------------------------------------
void SetDioOutput(unsigned char data)
{
Set_ITE8705_LD( 0x05); //switch to logic device 7
outportb(ITE8705_IO_PORT, ((data & 0x0F) << 4));
}
//---------------------------------------------------------------------------
unsigned char GetDioInput(void)