Playing (part 2)
As I mentioned in my post ‘Playing’, debugging PIC software is quite often not nearly as easy as debugging PC based software. My (current
) lack of experience with both PICs and C didn’t help a lot either. Though I have managed quite easily to pass the ‘hello world’ equivalent of blinking a LED on and off, the next step – actually displaying ‘Hello World!’ on an LCD – was less easy.
I had the basic code for writing instructions, and the actual instructions, to the LCD correct. It’s a standard 16×2 character LCD with a HD44780-compatible controller (you can control one of those using the parallel port on a PC actually). I have a great little simulation tool which has a module to simulate the display, but of course I couldn’t take the easy path for my actual hardware implementation.
My actual hardware implementation was a bit more tricky, because I wasn’t connecting the LCD directly to the PIC as the simulator assumes. I’m using a shift register for the data lines, which greatly reduces the number of pins needed on the PIC, which is good news because it doesn’t have a whole lot of I/O pins. I had a couple things wrong in sending data out of the shift register. (Basically, a shift register is a simple chip that accepts a serial input (2 lines) and translates that to a parallel output (8 lines).) It may have included sending the bits in the wrong order.
Obviously, because the instructions that did arrive at the LCD arrived in reverse order, they didn’t mean a whole lot and the most interesting thing I was able to do was blink the backlight on and off.
But a bunch of LEDs and some added delays allowed me to see exactly what was going on, and now finally, I have a display that shows ‘Hello World!’
I’ll take a picture later.
(And, further debugging should be relatively easy, because I now have a way to let the PIC tell me what it’s doing
).
And another thing… There’s a new menu item on the top, ‘PIC programming’. I’m writing a load of PIC-related stuff which could possibly be interesting to someone. Partially because even at this point, where there isn’t much actual content in it, it’s already gotten me up at least 5 ranks on WhatPulse (I’m 803rd of the world as I type this ^^). For the moment it remains inaccessible to anyone but me, but some day…
Comments
Leave a Reply
