HP 34401A User Manual page 192

Hide thumbs Also See for 34401A:
Table of Contents

Advertisement

Chapter 6 Application Programs
RS-232 Operation Using Turbo C
RS-232 Operation Using Turbo C
The following example shows how to program an AT personal computer
for interrupt-driven
sent to the HP 34401A and responses received for commands that query
information. The following program is written in Turbo C and can be
easily modified for use with Microsoft Quick C.
RS-232 Operation Using Turbo C
#include <bios.h>
#include <stdio.h>
#include <string.h>
#include <dos.h>
#include <conio.h>
#define EVEN_7 (0x18 | 0x02 | 0x04)
#define ODD_7
(0x08 | 0x02 | 0x04)
#define NONE_8 (0x00 | 0x03 | 0x04)
#define BAUD300
0x40
#define BAUD600
0x60
#define BAUD1200 0x80
#define BAUD2400 0xA0
#define BAUD4800 0xC0
#define BAUD9600 0xE0
/* 8250 UART Registers */
#define COM
0x3F8
#define THR
COM+0
#define RDR
COM+0
#define IER
COM+1
#define IIR
COM+2
#define LCR
COM+3
#define MCR
COM+4
#define LSR
COM+5
#define MSR
COM+6
Continued on next page ’
Microsoft is a U.S. registered trademark of Microsoft Corporation.
port communications. SCPI commands can be
COM
/* Even parity, 7 data, 2 stop */
/* Odd
/* None parity, 8 data, 2 stop */
/* COM1 base port address */
/* LCR bit 7 = 0 */
/* LCR bit 7 = 0 */
/* LCR bit 7 = 0 */
/* The rest are don't care for bit 7 */
parity, 7 data, 2 stop */
6
193

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents