Seven Segments


Homepage
What is S2
Contacts
Propose a project

Battery Chargers >>
Model Trains >>
Light flasher
Miscellaneous >>
Tech Beans >>

Site Map
Useful links
Site stats
Visits754326
Users509
Categories4
Projects21
Articles66
Files148


© Seven-Segments



All website content
unless otherwise noted
is licensed under a
Creative Commons
License






PIC program description
PIC source description.


The PIC program is very simple and is based on a main loop that flashes the two leds using a random generated seed.
When the PIC wakes up (for a switch of the reed bulb when the user move near to the bulb a magnet) the microcontroller counts the time for what the user activate the switch. This time is used for random number generation and in order to change the two led relative phase. During this period one of two leds is switched on (at 50% brightness) and remains in this state until the user activate the reed bulb.
After this initialization the two leds flashes asynchronously with a 1s period. The end of flashing can occur for two reasons: a) Timeout if the circuit flashes for 1 hour or if the user re-activate the reed bulb for at least 1 second.
The shut down procedure switch on (at 50% brightness) one led and go in sleep mode when the user deactivate the reed bulb (moving the magnet away) shutting off the two leds and the CPU.
All the parameters are specified in constant section for user tuning and easy modifying.

Comments ::


© 2004 Seven-Segments
All content on this website (including text, photographs, resource files, and any other original works), unless otherwise noted, is licensed under a Creative Commons License

LOGIN


PARTNER SITES
Seven Segments Site Map