Gpio sample code – Acrosser AR-B1622 User Manual

Page 21

Advertising
background image

AR-B1622 User’s Guide

21

6. GPIO Sample Code

/*[]======================================================================[]*/
/*||

GPIO

Test

utility

for

W83627HF.

||*/

/*||

Date

:

10/18/2005

||*/

/*||

Author

:

Willy

||*/

/*[]======================================================================[]*/

/*[]======================================================================[]*/
/*||

Include

files

||*/

/*[]======================================================================[]*/
#include <conio.h>
#include <stdio.h>

/*[]======================================================================[]*/
/*||

Assember

Types

Define

||*/

/*[]======================================================================[]*/
typedef unsigned char

BYTE;

typedef unsigned short int WORD;
typedef unsigned long int DWORD;

void Show_Title();
char YES_NO_Confirm();
void Enter_Config(BYTE IO_PORT_BASE);
void Exit_Config(BYTE IO_PORT_BASE);
void Init_SIO(BYTE IO_PORT_BASE);
int GPI_TEST(BYTE IO_PORT_BASE);
int GPO_TEST(BYTE IO_PORT_BASE);

/*[]======================================================================[]*/
/*|| Function

: GPI_TEST()

||*/

/*|| Input : BYTE IO_PORT_BASE ||*/
/*||

Change :

-

||*/

/*|| Return : Pass return "0", Fail return "1".

||*/

/*|| Description: Test GPI Pins status.

||*/

/*[]======================================================================[]*/
int GPI_TEST(BYTE IO_PORT_BASE)
{
BYTE Read_Byte,Temp_Word,Show_Byte;

// Set W83627HF GPIO10~17 to Input
outportb(IO_PORT_BASE,0xF0);
outportb(IO_PORT_BASE+1,0xFF);

printf(">>>>> GPI Test Start <<<<<");

/////// Input High Test ///////////////////////////////////////////////////

printf("\nConnect GPI Pins to High ? [Y/N] ....... ");

if(YES_NO_Confirm() =='n')
{ printf("\n>>>>> GPI Test Error <<<<<\n"); return 1; } // return fail

Show_Byte=0x00;
// Read W83627HF GPIO10~17 Status
outportb(IO_PORT_BASE,0xF1);
Read_Byte=inportb(IO_PORT_BASE+1);

Advertising