Echelon Neuron C Manual do Utilizador Página 75

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 268
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 74
Neuron C Programmer’s Guide 63
Example:
network input SNVT_temp nviCurrent;
network input SNVT_temp nviSetpoint;
network output SNVT_volt nvoValve;
eeprom uninit SNVT_temp lastGoodCurrent, lastGoodSetpoint;
when(nv_update_occurs(nviCurrent)) {
lastGoodCurrent = nviCurrent;
nvoValve = algorithm(lastGoodCurrent, lastGoodSetpoint);
}
when(nv_update_occurs(nviSetpoint)) {
lastGoodSetpoint = nviSetpoint;
nvoValve = algorithm(lastGoodCurrent, lastGoodSetpoint);
}
After power-up or reset, track which network variable has been updated,
and execute the algorithm only after all required input data has arrived.
Example:
#define CURRENT_OK 0x01
#define SETPOINT_OK 0x02
#define ALL_OK (CURRENT_OK | SETPOINT_OK)
unsigned received;
network input SNVT_temp nviCurrent;
network input SNVT_temp nviSetpoint;
network output SNVT_volt nvoValve;
when(nv_update_occurs(nviCurrent)) {
received |= CURRENT_OK;
if (received & ALL_OK == ALL_OK) {
nvoValve = algorithm(lastGoodCurrent, lastGoodSetpoint);
}
}
when(nv_update_occurs(nviSetpoint)) {
received |= SETPOINT_OK;
if (received & ALL_OK == ALL_OK) {
nvoValve = algorithm(lastGoodCurrent, lastGoodSetpoint);
}
}
After power-up, poll both input network variables, thus explicitly
requesting that the data sources resend their most recent value. This
solution is popular, simple, and straight-forward.
Example:
network input SNVT_temp nviCurrent;
network input SNVT_temp nviSetpoint;
network output SNVT_volt nvoValve;
when(reset) {
poll(nviCurrent);
Vista de página 74
1 2 ... 70 71 72 73 74 75 76 77 78 79 80 ... 267 268

Comentários a estes Manuais

Sem comentários