Browse over 10,000 Electronics Projects

Switched LED

Switched LED

Use a switch to change the signal on a port, and turn the LED on and of based on that signal. A simple on off switch done the difficult way.
The 12F675 has pins that can either be digital or analog. If the port is not set to digital the input signal is always 0. It took many many hours and suggestions from Stef and Wouter before I managed to get that right. It’s done like this:


First the right addresses need to be obtained from the 12F675 data sheet. Now if you look at the data sheet you’ll see that the address for CMCON is 19h, while I use 1F. I copied this value from Wouter’s fader (for the 16F628 actually) and it worked ok. I have no idea why.

Visit Here for more.