Appendix b. digital i/o, Introduction – Lanner LEC-7900 User Manual

Page 30

Advertising
background image

29

Appendix B. Digital I/O

Introduction

The Digitanl I/O on the rear panel is designed to provide the input and output operations for
the system For sample DIO code, see Digt-IO folder under LEC-7900D Utility on the Driver
and Manual CD.
A DIO sample code:

// Copyright (c) 2009 Lanner Electronic Inc. All rights reserved.

// DIO utility for LEB-7900

//;

Output Input

//;

GPO30 GPI34

//;

GPO31 GPI35

//;

GPO32 GPI36

//;

GPO33 GPI37

#include <stdio.h>

#include <string.h>

#include <dos.h>

#include <stdlib.h>

#include <inlines/pc.h>

#define INDEX_PORT 0x2e

#define DATA_PORT 0x2f

#define CR20_REG

0x20 //This register indicate the device's ID

#define W83627UHG_ID

0xA2

void help()

{

printf("Lanner Electronics Inc. 2009/10/28\n");

printf("Digital IO control V0.1 for LEB-7900\n");

printf("\n");

}

int main(int argc, char *argv[])

{

int temp6, temp8=0;

help();

//;********** Detect SIO ******************

Enter_Configuation();

if(detect_sio())

{

printf("It's not correct SuperIO, program terminated!!!\n");

printf("Rx20 = %02X\n", read_w83627UHG_reg(0, CR20_REG));

return -1;

}

Exit_Configuation();

Init_WDTO_GPIO_Interface();

//;********************* DIO start

*****************************************************

Enter_Configuation();

//;*********************GPO30 and

GPI34*****************************************************

printf("GPO30(OUT) to GPI34(IN)...\n");

write_w83627UHG_reg(0x07, 0xE1, read_w83627UHG_reg(0x07, 0xE1) | 0x01);

//;Set GPO30 to 1

delay(50);

for(temp6=1; temp6<50; temp6++)

Advertising