Appendix D: Digital I/O Setting; Source Code In C - LGX Extended Temperature AU910 User Manual

Fanless intel core i5/i7 embedded system
Table of Contents

Advertisement

A0000 - BFFFF
PCI bus
A0000 - BFFFF
Intel(R) HD Graphics

Appendix D: Digital I/O Setting

Digital I/O can read from or write to a line or an entire digital port, which is
a collection of lines. This mechanism can be used to meet user's various
applications such as industrial automation, customized circuit, and labora-
tory testing. The source code below written in C is the applicable sample for
programming.
D.1 Source Code in C
/*-----
Include Header Area -----*/
#include "math.h"
#include "stdio.h"
#include "dos.h"
void main(void){
int SMB_PORT_AD = 0xF000;
int SMB_DEVICE_ADD = 0x6E; /*75111R's Add=6eh */
//programming DIO as output
//0:input 1:Output
/*
Index 10, GPIO1x Output pin control
SMB_Byte_WRITE(SMB_PORT_AD,SMB_DEVICE_ADD,0x10,0xff);
delay(10);
/*
Index 20, GPIO2x Output pin control
SMB_Byte_WRITE(SMB_PORT_AD,SMB_DEVICE_ADD,0x20,0xff);
delay(10);
/*
Index 40, GPIO3x Output pin control
SMB_Byte_WRITE(SMB_PORT_AD,SMB_DEVICE_ADD,0x40,0xff);
delay(10);
Appendix
*/
*/
*/
- 74 -
Appendix
//programming DIO default LOW
/*
Index 11, GPIO1x Output Data value
SMB_Byte_WRITE(SMB_PORT_AD,SMB_DEVICE_ADD,0x11,0x00);
delay(10);
/*
Index 21, GPIO2x Output Data value
SMB_Byte_WRITE(SMB_PORT_AD,SMB_DEVICE_ADD,0x21,0x00);
delay(10);
/*
Index 41, GPIO3x Output Data value
SMB_Byte_WRITE(SMB_PORT_AD,SMB_DEVICE_ADD,0x41,0x00);
delay(10);
}
//----------------------------------------------------------------------------
unsigned char SMB_Byte_READ (int SMPORT, int DeviceID, int REG_INDEX)
{
unsigned char SMB_R;
outportb(SMPORT+02, 0x00);
outportb(SMPORT+00, 0xff);
/* clear */
delay(10);
outportb(SMPORT+04, DeviceID+1);
outportb(SMPORT+03, REG_INDEX);
outportb(SMPORT+02, 0x48);
delay(10);
SMB_R= inportb(SMPORT+05);
return SMB_R;
}
void SMB_Byte_WRITE(int SMPORT, int DeviceID, int REG_INDEX, int REG_DATA)
{
outportb(SMPORT+02, 0x00);
outportb(SMPORT+00, 0xff);
/* clear */
delay(10);
outportb(SMPORT+04, DeviceID);
outportb(SMPORT+03, REG_INDEX);
outportb(SMPORT+05, REG_DATA);
outportb(SMPORT+02, 0x48);
delay(10);
}
*/
*/
*/
/* clear */
/* clear */
/* clear */
/* read_byte */
/* clear */
/* clear */
/* clear */
/* read_byte */
/* read_byte */
- 75 -

Advertisement

Table of Contents
loading

This manual is also suitable for:

Extended temperature au912

Table of Contents