Kontron KTA55-pITX Manual de usuario Pagina 17

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 25
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 16
KTD-S0043-A Page 14 CPLD Interface
KTA55/pITX Software Guide
6.2 Watchdog Example
The following example (DOS program) show the access to the CPLD features (C compiler: BORLAND C++).
Note:
These programs cannot be run on Linux and Windows
®
.
#include <stdio.h>
#include <dos.h>
#define CPLD_BASE_ADDR 0xA80
#define WDT_INDEX 0xA2
#define WDT_TIMER 0xA3
#define WDT_ENABLE 0x40
#define WDT_TRIGGER 0x80
#define WDT_1SEC 0x00
#define WDT_5SEC 0x01
#define WDT_10SEC 0x02
#define WDT_30SEC 0x03
#define WDT_1MIN 0x10
#define WDT_5MIN 0x11
#define WDT_10MIN 0x12
void ActivateWatchdog (void)
{
outp (CPLD_BASE_ADDR, WDT_INDEX);
outp (CPLD_BASE_ADDR+1, WDT_10SEC);
delay (1);
// wait one millisecond
outp (CPLD_BASE_ADDR+1, WDT_ENABLE | WDT_10SEC);
}
void TriggerWatchdog (void)
{
outp (CPLD_BASE_ADDR, WDT_INDEX);
outp (CPLD_BASE_ADDR+1, WDT_ENABLE | WDT_TRIGGER | WDT_10SEC);
delay (1);
// wait one millisecond
outp (CPLD_BASE_ADDR, WDT_TIMER);
inp (CPLD_BASE_ADDR+1);
}
void main (void)
{
int i;
ActivateWatchdog ();
for (i = 0; i < 5; i++)
// wait half of expiry time (= 5 seconds)
delay (1000); // wait 1 second
TriggerWatchdog (); // trigger the watchdog - total expiry time now 15 seconds
}
Vista de pagina 16
1 2 ... 12 13 14 15 16 17 18 19 20 21 22 23 24 25

Comentarios a estos manuales

Sin comentarios