HP 9000 Series 300 Tutorials Manual page 188

Device i/o and user interfacing hp-ux concepts and tutorials
Hide thumbs Also See for HP 9000 Series 300:
Table of Contents

Advertisement

258
/* MAIN OUTPUT LOOP */
259
i
=
0;
260
while ((c
=
getchar(»
!=
EOF) {
261
if (i
==
bufsz) {
262
amigo_write(outbuf. i);
263
i
=
0;
264
}
265
outbuf[i++]
=
c;
266
}
267
/* post remaining buffer */
268
if (i) amigo_write(outbuf. i);
269
exit(O);
270
}
271
272
/* ROUTINE TO DO THE MAIN I/O TO THE BUSS */
273
/* lock bus. do preamble. read/write. do postamble and unlock bus */
274
/* preamble must be 3 or 4 bytes. postamble must be 1 or 2 bytes */
275
int
276 HPIB_msg(rw_flag. pcm1. pcm2. pcm3. buffer. length. ocmO. ocm1)
277
int rw_flag;
278
int
pcm1;
279
int
pcm2;
280
int
pcm3;
281
char
*buffer;
282
int
length;
283
int
ocmO;
284
int
ocm1 ;
285
{
286
287
288
289
unsigned char pre_cmd[4] ;
unsigned char post_cmd[2] ;
int tlog
=
-1;
290
pre_cmd[O]
=
UNL;
/* always issue unlisten command first */
291
pre_cmd[1]
=
pcm1;
292
pre_cmd[2]
=
pcm2;
293
pre_cmd[3]
=
pcm3;
294
295
post_cmd[O]
296
post_cmd[1]
297
ocmO;
ocm1;
298
/* first get exclusive use of the bus */
299
if (io_lock(eid)
<
0)
300
fatal_err("io_lock". ptr_dev. F_EXIT);
301
0-8
OIL Programming Example

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Hp 9000 series 800

Table of Contents