beautypg.com

HP IEEE 1394 User Manual

Page 55

background image

54

VXI Programming Using the IEEE 1394 Serial Bus

Chapter 3

Comments

1. Because of the E1410 multimeter data storage format (eight bytes /
reading), the readings are transferred from shared memory to the PC in
bytes. Therefore, it is necessary to swap each byte in order to re-construct
the reading. Depending on the storage formats of your particular
instruments, swapping may not be necessary.

2. This manual is included on the HP I_O Libraries CD. By viewing the
manual from the CD, you can cut and paste this program into your
development environment.

Storing Readings in

Shared Memory - SICL

Example

This example uses the HP E1410 VXIplug&play driver to configure the
multimeter, take the readings, and store them in E8491A shared memory.
SICL functions are used to transfer the readings from shared memory to the
PC.

// SHAR_SICL.CPP - This program demonstrates how to access the
// HP E8491A’s shared memory. The program stores readings taken by
// the HP E1410 multimeter in HP E8491A shared memory, and then
// transfers those readings from shared memory to the computer.

#include "sicl.h"
#include
#include
#include

// project files: SHAR_SICL.cpp, SICL32.lib

// set up byte swap function for readings transferred from
// E8491A shared memory to the PC

#define SWAP_FLOAT64(rdgs) \
{ unsigned char src[8]; \

*((double *)src) = *((double *)rdgs); \
((unsigned char *) (rdgs))[0] = ((unsigned char*) (src))[7]; \
((unsigned char *) (rdgs))[1] = ((unsigned char*) (src))[6]; \
((unsigned char *) (rdgs))[2] = ((unsigned char*) (src))[5]; \
((unsigned char *) (rdgs))[3] = ((unsigned char*) (src))[4]; \
((unsigned char *) (rdgs))[4] = ((unsigned char*) (src))[3]; \
((unsigned char *) (rdgs))[5] = ((unsigned char*) (src))[2]; \
((unsigned char *) (rdgs))[6] = ((unsigned char*) (src))[1]; \
((unsigned char *) (rdgs))[7] = ((unsigned char*) (src))[0]; \

}

void main(void)
{

INST e8491; // handle for SICL session to E8491
INST e1410; // handle for SICL session to E1410
struct vxiinfo info; // structure for data returned by ivxirminfo
unsigned long start_addr; // starting address of shared memory
double rdgs[8000]; // array for readings from shared memory
short i;
unsigned long map; // memory map space

Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com

This manual is related to the following products: