Snack 'N' Hack


Blinking Driven Directly from Microcontroller
November 30, 2009, 7:54 pm
Filed under: Uncategorized

I have spent the last two weeks scratching my head and building Transistor based digital switching devices.  Every experiment ended in what might be called “failure,” but today the lights are blinking.  A few days ago I started to doubt the code produced by Matrix Multimedia’s Flowcode for PIC Micro – and for good reason.  When I read the code I realized that the way they had their blink LED routines written would not work for Port A of the Pic 16f887 – which is an analog port that requires special setup.

Once I discovered their error I began to write my own code and had a few more problems getting MPLAB to export correctly to my programmer utility.  I recently switched my development environment and admittedly I’m getting used to some of the quirks.

Friday I wrote some simple Assembly for the PIC that should make an LED light – and voila! it did (after a bit of tweaking as always).  Also, I found a great resource.  Pic List has a delay code generator that makes nice concise loops to any exact interval.  Yes, we can all write our own delay loops, but having one at an odd interval on demand is nice.  Yes, I used the code generator to produce a 1 second delay.  Yes, I am lazy.

As you can’t see from the picture – the Microcontroller is directly driving the LED Matrix (which as you remember must be brought to ground).  No problems yet and it’s been blinking those 4 LEDs for about an hour.

Yippee Yay Hooray!

 

Advertisements

Leave a Comment so far
Leave a comment



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s



%d bloggers like this: