- 71 -
Appendix
Appendix C. 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 helps users achieve various applications
such as industrial automation, customized circuit, and laboratory testing. Take
the source code below that is written in C for the digital I/O application example.
Sample Codes:
/*----- Include Header Area -----*/
#include “math.h”
#include “stdio.h”
#include “dos.h”
#define
sioIndex
0x2E
/* or 0x4E */
#define
sioData
0x2F
/* or 0x4F */
/*----- routing, sub-routing -----*/
void main()
{
int iData;
SioGPIOMode(0x0F);
delay(2000);
SioGPIOData(0x05);
delay(2000);
iData = SioGPIOStatus();
printf(“ Input : %2x \n”,iData);
delay(2000);
SioGPIOData(0x0A);
delay(2000);
iData = SioGPIOStatus();
printf(“ Input : %2x \n”,iData);
delay(2000);
}
void SioGPIOMode(int iMode)
{
outportb(sioIndex,0x87);
/* Enable Super I/O */
outportb(sioIndex,0x87);
outportb(sioIndex,0x07);
/* Select logic device – GPIO */
outportb(sioData, 0x06);
outportb(sioIndex,0x30);
/* Enable GPIO */
outportb(sioData, 0x01);
outportb(sioIndex,0xC0);
/* GPIO3 0~7 - Output Enable */
outportb(sioData,iMode);
outportb(sioIndex,0xAA);
/* Disable Super I/O */
}
void SioGPIOData(int iData)
{
outportb(sioIndex,0x87);
/* Enable Super I/O */
outportb(sioIndex,0x87);
Содержание HiCORE-i89Q1
Страница 1: ...1 HiCORE i89Q1 HiCORE i89Q2 PICMG 1 0 Full size SBC User s Manual Version 1 2 2018 01 ...
Страница 9: ...1 Chapter 1 Introduction Chapter 1 Introduction ...
Страница 17: ...2 Chapter 2 Installation Chapter 2 Installation ...
Страница 44: ... 36 This page is intentionally left blank ...
Страница 45: ...3 Chapter 3 BIOS Chapter 3 BIOS ...
Страница 73: ... 65 Appendix Appendix ...