Gw-instek GDS-2000 series Programming manual Manual de usuario Pagina 93

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 93
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 92
GDS-2000 Series Programming Manual
93
Appendix A: How can we convert the hexadecimal format to a floating point
format
Question: As the previous example listed on page 32, how can the hexadecimal
value of “0×34 0×56 0×BF 0×94” transfer to 200ns?
Answer:
just use the attached C language program:
#include <stdio.h>
int main()
{
union data
{
char a[4];
float f;
} myData;
myData.a[0]=0x94; /* little-endian byte ordering here, */
myData.a[1]=0xBF; /* so, the last of 0x94 should be placed */
myData.a[2]=0x56; /* in the first order. */
myData.a[3]=0x34;
printf("Here is the Data:\n%0x\n%0x\n%0x\n%0x\n%.3e\n",\
myData.a[0]&0xff,
myData.a[1]&0xff,
myData.a[2]&0xff,
myData.a[3]&0xff,\
myData.f );
return 0;
}
and the output result is following: 2.000e -007=200ns
Vista de pagina 92
1 2 ... 88 89 90 91 92 93

Comentarios a estos manuales

Sin comentarios