User’s Manual
108
ECM-3410/3410L/3410N User’s Manual
Demo Program 2 (C Language)
//==============================================================
// Title
: ECM-3410 Watchdog Timer Test Utility
// Company : Evalue Technology Inc.
// Version : 1.0
// Date : 10/04/2000
// Compiler : Borland C ++
//==============================================================
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#define IO_INDEX_PORT 0x3F0
#define IO_DATA_PORT 0x3F1
#define UNLOCK_DATA 0x87
#define LOCK_DATA 0xAA
#define DEVICE_REGISTER 0x07
void EnterConfigMode()
{
outportb(IO_INDEX_PORT, UNLOCK_DATA);
outportb(IO_INDEX_PORT, UNLOCK_DATA);
}
void ExitConfigMode()
{
outportb(IO_INDEX_PORT, LOCK_DATA);
}
void SelectDevice(unsigned char device)
{
outportb(IO_INDEX_PORT, DEVICE_REGISTER);
outportb(IO_DATA_PORT, device);
}
unsigned char ReadAData(short int reg)
{
outportb(IO_INDEX_PORT, reg);
return (inportb(IO_DATA_PORT));
}