Example 3: seven-segment led display interface – Echelon Neuron C User Manual
Page 47

Neuron C Programmer’s Guide
35
// since a lower value means more light.
currentBrightness -= input_value;
// Look for underflow or overflow
if (currentBrightness < MAX_BRIGHTNESS)
currentBrightness = MAX_BRIGHTNESS;
else if (currentBrightness > MIN_BRIGHTNESS)
currentBrightness = MIN_BRIGHTNESS;
// Change the triac setting to the
// desired brightness level
io_out(ioLampTriac, currentBrightness);
}
Example 3: Seven-Segment LED Display Interface
The following example shows how to connect multi-character displays to the
neurowire port. The display has an 8-bit configuration register and a 24-bit
display register. This configuration can be defined as follows:
IO_2 output bit ioEnable = 1;
IO_8 neurowire master select(IO_2) ioDisplay;
unsigned char displayReg[3];
unsigned char configReg;
.
.
.
void refreshDisplay() {
__lock {
io_out(ioDisplay, &configReg, 8);
io_out(ioDisplay, displayReg, 24);
}
}