Saturday, June 6, 2009

LCD to PIC interfacing.

Just as the title says, here's how to connect an hd44780 compliant LCD module to your PIC microcontroller.

I will be using mikroElektronika's mikroBasic for this, . Their BASIC compilers are just fantastic. Moreover, they are free for hobbyists. You can get it here.

For the micro, I am using the 16F628A, configured to run on the 8Mhz internal oscillator.

mikroBasic by default assumes that the wiring between the PIC and the LCD is as follows:
D7 → port.7 (pin13 on the 16F628)
D6 → port.6 (pin12)
D5 → port.5 (pin11)
D4 → port.4 (pin10)
E → port.3 (pin9)
RS → port.2 (pin8)
RW → port.0 (pin6)

The pin-out for commonly found LCD modules is:
Remember, Vss: GND, Vcc:+5v, VLc:GND, VB+ and VB- are for back lighting.

For the code, I used a screen dump here instead of copy-pasting.
Ah, Neatness..(FAIL)

( have to write it ALL OVER. GWAHAHAHAH!)

(Click to enlarge)

As you have probably guessed from the (very) self-documenting source code above, what we want to display on the LCD is enclosed in commas on the 28th line. (My program starts on the 16th line)

And if everything is done according to the above, the end result is, most of the time, a variation of this.

Again, another satisfying moment in the life of the weary experimenter...when something you build from genuine scratch finally manages to concoct an output. In words.

Thursday, June 4, 2009

Build Report: Boss MT-2 Metal Zone

[While this blog was originally meant for digital electronics only, it will now include from, time to time, some analog stuff too. I think that I'm finally starting to love analog stuff...]

For those from (third world..?) countries where BOSS effects pedal are way, way, waaay too much overpriced for their poor, poor, sad, pedal-less self, this post might prove to be of some interest. Here's build report of the BOSS MT-2...the Metal Zone.

And Yes..With Pictures.
It all starts with this all-too-familiar packet from

I bet they cant wait to be mounted...

...on this locally made PCB.

Board overview, minus the op-amps...

Custom mounting techniques...

Verroboard for pots...(which had to be redone in the end)

Note: Expect this post to grow over time as I complete the pedal.


This one was a real b*tch to build. I had to change 2 full sets of op-amps(that means 8!), burning and lifting several PCB tracing in the solder/de-soldering process. Also, after a trillion hours of trouble shooting, I basically found out that some stages of the schematic I was using was WRONG(AAAAAAaaarrrgggh!!) [that was very precisely the exclamation I made when I found the error]

Nevertheless, after another trillion or so hours of troubleshooting, the pedal basically worked quite satisfactorily, except for that noisy background 'waterfall' sound that I tamed later. The palm-mutes it generated were 'chubby' and essentially had that character what I was looking for. There is still a significant amount of noise that comes out though and somehow, I feel this project is still not completed because of this. But it is very usable and for my second pedal, I think the cloning is quite a success. (I found out later that it is actually one of the most difficult pedals out there to clone )

I am currently drawing up a corrected schematic which I will post later(with the PCB layout).

Also, I will post sound clips some other time when I get to.

(Here's the cloned 'Boss Metal Zone MT-2' in late testing phase)