|
Feedback |
|
“”Tell
me your take on the FBL!”” I couldn’t agree more on the first blinking LED for =
any project
– but here’s a suggestion for our colleagues with more =
complex
feedback LED requirements… (FBL) I recently finished (?are they ever ‘finished’?) =
a
project which was low on pins and real-estate – but wanted to add =
some
information for the user. Even though everything worked fine on the bench, I really =
wanted to
give the user some assurance, or an idea of what to look for if their
installation <<wasn’t>> working as expected without =
resorting
to SMS or the web interface - yet there were too many conditions that I =
wanted
to communicate. I came up with a Red-Green LED across two output pins that =
flashes a
sequence of 4-colours and a rest then repeat as long as the system is =
alive.
(Hey – an activity LED as well !) With this setup I’m displaying the condition of four =
separate
subsystems with a red/green/yellow indication. NORMAL ‘good’ operation displays FOUR green =
flashes,
then rest and repeat. For example- Blink 1 incoming heartbeat =
status (messages
received / timeout) Blink 2 modem =
status =
(all
ok / limited functionality / no response) Blink 3 network =
status (LAN
OK / DHCP fallback / cable-link not present) Blink 4 msg queue / GSM status =
(OK / messages
in queue / SIM credit/low RF level) Very easy to understand and document – yet simple to =
code,
could easily be expanded to 5 or 6 blinks (three possible on-states per =
LED…
i.e. up to 18 states displayed in a single LED!) I have implemented the 4-blink sequence as 11 =
‘slots’
per sequence (4 states +3 gaps +4 rest) 1 00 2 00 3 00 4 00 00 00 00 =
(00=3Doff
gap/rest slots) IN the main() idle loop I refresh the pins : either =
as 01 (red)
/ 10 (grn), or alternating 01/10 (to get yellow) within each =
‘slot’
depending on the value assigned to that slot =
(off/red/grn/yel) After every XXX cycles (the slot duration) bump up to =
the
next ‘slot’ number so the blink phase will step through each
subsystem, and repeat forever. If a subsystem changes =
it’s state
01/10/11, when the slot count gets to that ‘LED’ , the =
correct
colour is displayed for that subsystem-slot =
period. Sigh - that sounded complicated – but it’s =
easy and
it works well ! Cheers Michael COOP SL4P |
|
Thanks Michael. Clearly you are using a chip "down to the metal" rather than a SPLat board
(so you SPLat users out there: don't try this at home). Interestingly, the CC18 has a red/green status LED
that can be programmed to a few combinations. With a bit of effort it could probably have several flashes
in different colours to denote different things.
I always find it interesting how we electronic engineers always seem to manage to squeeze one more bit of functionality out of the finite resources we have available. |