Urrea UD88 Manual De Usuario Y Garantía página 90

Multímetro de auto rango
Tabla de contenido

Publicidad

Idiomas disponibles

Idiomas disponibles

E N G L I S H
Example:
Program (FICOM.H)
The following program is an example of a C language
program which helps users to understand the data
format and the data interfacing method, and also to
develop their own programs.
<Interrupt Usage and Selection between
COM1 and COM2>
#define COM1 0
#define COM2 1
/* Base addresses of serial ports */
#define COM1BASE 0x03f8
#define COM2BASE 0xx02f8
#define COMBASE ((comport= = COM1) ? COM1BASE:
COM2BASE)
/* Registers */
#define THR (COMBASE +0) /* Transmit Holding Register */
#define RBR (COMBASE +0) /* Receive Buffer Register */
#define IER (COMBASE +1) /* Interrupt Enable Register */
#define IIR (COMBASE +2) /* Interrupt Identification Register
*/
#define LCR (COMBASE +3) /* Line Control Register */
#define MCR (COMBASE +4) /* Modem Control Register */
#define LSR (COMBASE +5) /* Line Status Register */
#define MSR (COMBASE +6) /* Modem Status Register */
/* Parameters to bioscom function */
#define DATABIT7 0x02 /* Data bit */
#define DATEBIT8 0x03
#define STOPBIT1 0x00 /* Stop bit */
#define STOPBIT2 0x04
#define NOPARITY 0X00 /* Parity bit */
#define ODDPARITY 0X08
#define EVENPARITY 0x18
#define BAUD1200 0x80 /* Baud rate */
#define BAUD2400 0xa0
#define BAUD4800 0xc0
#define BAUD9600 0xe0
90
/* 8259 PIC (Programmable Interrupt Controller) */
#define IMR 0x21 /* I/O address of 0CW1 (IMR) of 8529 PIC */
#define 0CW2 0x20 /* I/O address of 0CW2 of 8259 PIC */
/* 0CW: Operation Command Word */
/* IMR: Interrupt Mask Register */
#define MASKON 0xe7 /* Mask IRQ3/IRQ4 on
#define MASKOFF 0x18 /* Mask IRQ4/IRQ4 off
#define EOI 0x20 /* Non-specific End on Interrupt command
0CW2 */
/* Interrupt Request Numbers */
#define IRQ0 0x08 /* Interrupt Vector for Timer */
#define IRQ3 0x0b /* Interrupt Vector for COM2 */
#define IRQ4 0x0c /* Interrupt Vector for COM1 */
#define IRQ8 0x70 /* Interrupt Vector for RTC (Real Time
Clock) */
#define IRQ16 0x1C /* Interrupt Vector to called Timer */
#define IRQNUM ( (comport = = COM1) ? IRQ4 : IRQ3)
*/ Miscellaneous */
#define BUFSIZE 0X4000 /* Size of comm. Buffer */
#define BUFFEREMPTY(-1) /* Buffer empty */
#define ON 1
#define OFF 0
IMR */
IMR */

Hide quick links:

Publicidad

Capítulos

Tabla de contenido
loading

Tabla de contenido