Welch Allyn SureTemp PlusModule - User Manual User Manual

Page 56

Advertising
background image

Command and Response Strings: Examples

SureTemp Plus Module OEM Implementation

56

Confidential

Welch Allyn OEM Technologies

These steps are shown in the following code sample:

float f;

// Where you want the result converted...

unsigned char s[5];

// Array holding the message starting at the float data element unconverted.

unsigned char d[5];

// Array holding the message starting at the float data element converted to

// the endianness of the processor.

// For little-endian processors (Intel x86, Pentium, etc.)....

// Move data from source to destination.

d [0] = s [0];

d [1] = s [1];

d [2] = s [2];

d [3] = s [3];

f = (float) *((float *) (&d[0]));

// For big-endian processors (Motorola CPU32, etc.)....

// Move data from source to destination.

d [3] = s [0];

d [2] = s [1];

d [1] = s [2];

d [0] = s [3];

f = (float) *((float *) (&d[0]));

Advertising