/* INTS.C
Copyright 1996 by WinSystems Inc.
Permission is hereby granted to the purchaser of the WinSystems
UIO cards and CPU products incorporating the UIO device, to distribute
any binary file or files compiled using this source code directly or
in any work derived by the user from this file. In no case may the
source code, original or derived from this file, be distributed to any
third party except by explicit permission of WinSystems. This file is
distributed on an "As-is" basis and no warranty as to performance,
fitness of purposes, or any other warranty is expressed or implied.
In no case shall WinSystems be liable for any direct or indirect loss
or damage, real or consequential resulting from the usage of this
source code. It is the user's sole responsibility to determine
fitness for any considered purpose.
*/
#include <stdio.h>
#include <dos.h>
#include <conio.h>
#include "uio48.h"
#define BASE_PORT 0x200
/* This program like the poll.c sample uses the edge detection interrupt
capability of the WS16C48 to count edge transitions. Unlike poll.c,
however this program actually uses interrupts and update all of the
transition counters in the background.
*/
/* Our transition totals are stored in this global array */
unsigned int_counts[25];
/* Function declarations for local functions */
void check_ints(void);
void interrupt int_handler(void);
void interrupt (*old_handler)(void);
void main()
{
int x;
/* Initialize the I/O ports. Set all I/O pins to input */
init_io(BASE_PORT);
/* Install an interrupt handler for the board */
/* We disable interrupts whenever we're changing the environment */
disable();
/* Disable interrupts during initialization */
/* Get the old handler and save it for later resoration */
old_handler = getvect(0x0d);
/* Hardwired for IRQ5 */
/* Install out new interrupt handler */
setvect(0x0d,int_handler);
/* Clear the transition count values and enable the falling edge
interrupts.
*/
for(x=1; x<25; x++)
{
int_counts[x] = 0;
/* Clear the counts */
enab_int(x,FALLING);
/* Enable the falling edge interrupts */
}
/* Unmask the interrupt controller */
outportb(0x21,(inportb(0x21) & 0xdf));
/* Unmask IRQ 5 */
/* Reenable interrupts */
enable();
/* Set up the display */
clrscr();
/* Clear the Text Screen */
for(x=1; x<25; x++)
{
gotoxy(1,x);
printf("Bit Number %02d ",x);
}
/* We will continuously print the transition totals until a
Содержание LBC- 486Plus
Страница 81: ...8 APPENDIX C LBC Plus Parts Placement Guide Top 991206 OPERATIONS MANUAL LBC Plus Page 8 1 ...
Страница 83: ...9 APPENDIX D LBC PLUS Mechanical Drawing ...
Страница 84: ......
Страница 85: ...10 APPENDIX E WS16C48 I O Routines and Sample Program Listings ...