Echelon Neuron C Manual de usuario Pagina 94

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 267
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 93
74 Functions
Syntax
#include <control.h>
void application_restart (void);
Example
#define MAX_ERRS 50 int error_count;
...
when (error_count > MAX_ERRS)
{
application_restart();
}
bcd2bin( ) Built-in Function
The bcd2bin( ) built-in function converts a binary-coded decimal structure to a
binary number. The structure definition is built into the compiler. The most
significant digit is
d1
. Note that
d1
should always be 0.
Syntax
unsigned long bcd2bin (struct bcd *
a
);
struct bcd {
unsigned d1:4,
d2:4,
d3:4,
d4:4,
d5:4,
d6:4;
};
Example
void f(void)
{
struct bcd digits;
unsigned long value;
memset(&digits, 0, 3);
digits.d3=1;
digits.d4=2;
digits.d5=3;
digits.d6=4;
value = bcd2bin(&digits);
//value now contains 1234
}
bin2bcd( ) Built-in Function
The bin2bcd( ) built-in function converts a binary number to a binary-coded
decimal structure.
Vista de pagina 93
1 2 ... 89 90 91 92 93 94 95 96 97 98 99 ... 266 267

Comentarios a estos manuales

Sin comentarios