Tuesday, August 12, 2008

Toggle and Debounce!

A little bit of basic breadboarding, a little bit of code modified from the web and TI's free source code.

The buttons used are made by highly electric. (I think they are the PB613). They are simple push to make switches. There is no locking system, they don't toggle. Push push to make contact. They integrate a cool LED though. I got them from Rapid Electronics. http://www.highly.com/product/ca2/3-7.pdf,

The software code was originally written for the eZ430-F2013, which is a Spy-Bi_wire board. The output LED was set up to be on P1.0 and the input was P1.4. However, the header board from Sparkfun is set up for 4 wire JTAG. I'm not quite sure how to switch it to Spy-Bi-Wire.

Anyway, P1.4 on the F2131 shares a pin with one of the JTAG pins. So, when I did some basic debugging, as soon as I hit the switch, the JTAG Emulator would lose it's link. So, a little change in the code changed the input pin to one of the unused pins, and voila, the video below was made. :)

The code itself is simple. The ports are set up then the device goes into low power mode. Any change on an input pin wakes the device up from low power mode and then waits 20mS and checks if P1.3 is low. If it's still low, then obviously, the button is pressed. :) at which point.. TogGLE! :)

Check out my assistant below - and the short demo of my code working.


video

Cheers

Rochey

No comments: