Gw-instek GDS-800 Series Programming Manual Manual de usuario Pagina 89

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 89
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 88
GDS-806/810/820/840 Programming Manual
88
Appendix A: How can we convert the hexadecimal format to a floating point
format
Question: As the previous example listed on page 27, how can the hexadecimal
value of “0×4C 0×BE 0×BC 0×20” transfer to 100M(Sa/s)?
Answer:
just use the attached C language program:
#include <stdio.h>
int main()
{
union data
{
char a[4];
float f;
} myData;
myData.a[0]=0x20; /* little-endian byte ordering here, */
myData.a[1]=0xbc; /* so, the last of 0x20 should be placed */
myData.a[2]=0xbe; /* in the first order. */
myData.a[3]=0x4c;
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:
Vista de pagina 88
1 2 ... 84 85 86 87 88 89

Comentarios a estos manuales

Sin comentarios