30 Mar 2006 The Swirling Brain   » (Master)

I got my PIC16F877a Eval board in the mail from Hong Kong. It had absolutely no documentation other than what was on the web page (which was very sparse)! Wow! Anyway, I had already scoured the pics on ebay to figure out pinouts and such. I had written a test program before I received the board. I burned the program into the pic, and with some tweaking actually got it up and running! I'm fairly happy with it. I have a 16x2 LCD with backlight, a 4 digit LED display, 4x4 keypad, Real Time Clock, EEprom, buzzer, serial, and other junk. There's probably better computer boards out there, but this has keypad, display, and i/o for $40. I'm pretty happy with it. I don't think I could have bought all the parts and assembled for less! Saved me a lot of work that I was planning on doing. I'm glad I found it.

The LCD and the LED displays share the same PORTB. That's really weird because they're always conflicting with each other. You send a LCD command and it shows up on the LED display. You send a LED output and it messes with the LCD display. What I figured out was that if you set the LED the way you want, then before turning it off setup a LCD xy command then click the E line, the LED is happy and the LCD is happy. So, basically they're still conflicting with each other, you just can't tell it. So the LED runs fast enough with persistence of vision you don't see the little LCD command, and the LCD gets a xy cursor command, which you don't see either.

I also got a wireless 4 button remote from the same guy. Again, absolutely no docs except what was on the web page. The receiver board was simple so I went ahead and hooked it up to the 877a board. I made it so that when you press button A on the remote it displays A on the keyboard. Also for keys B, C, and D. Yea, it works! So now when I build the RBS, I can have it remote controlled to drop a ball or adjust the time or lights, etc. by remote! Cool.

I arranged the keypad buttons on the eval board be like so:


      +-----+-----+-----+-----+
      |  1  |  2  |  3  |  ^  |
      +-----+-----+-----+-----+
      |  4  |  5  |  6  | esc |
      +-----+-----+-----+-----+
      |  7  |  8  |  9  |  v  |
      +-----+-----+-----+-----+
      |  <  |  0  |  >  |enter|
      +-----+-----+-----+-----+

So I have numbers, arrows, escape and enter! I'm very happy with that. I need to figure out a good way to label the buttons (stickers or something). The 877a eval kit comes with a bread board! I used it to tie the keys input to ground thru 1k resistors so that they would work right.

So far, I have a simple menu where I can scroll up and down. I can go into a menu item with enter and I can back out of a menu item with esc. Right now it just displays a simple menu: set time, ball drop pref, about. The about menu item is all that works right now. If you press it, it will display "Grandfather clock", "See www.swirlingbrain.com", etc. plus up and down graphics chars and and "ESC" graphic char to let you know you can use the up and down arrows and esc to hop out. It's the best user friendly I could muster.

I have several background processes going: One that updates the LED display with the time (although it's not read from the real time clock chip yet), one that scans the keyboard and puts a key to a key buffer and has debounce, one that scans the rf 4 button remote, one that works the elevator motor (don't have the motor hooked up yet), one that works the stepper clock hand motors (although they're not hooked up yet), one that reads the RTC every so often and updates the clock (not done yet), and a few other misc processes for a total of 9 out of a possible 10 processes going on my scheduler code! I'm so glad it works!

So far of the 4 banks of 2k (8k total) I've used 1/2 of the first bank, and 1/4 of the other 3 banks. So I still have plenty of code space left. So the total code is about 2.5k right now out of 8k that I have or about 31% or so. Really I have a lot of code in there already so I'm pretty sure I'll have enough code space to do all I want to do and more!

Really, I'm thinking this setup might be really nice for a robot main board. I could hook a RF serial connection to the board's serial port and control the robot through a PC and I could use the wireless remote for sending simple commands like start, stop, and two functions. Interesting.

Latest blog entries     Older blog entries

X
Share this page