0

Getting the same results at last!

Posted by Chris on Thursday, November 26, 2009
It's been a despondent couple of days in Nerd Towers, trying to get the LCD display working from a PIC 18LF4550 (with USB support). First off, we had to step the supply voltage down from 5V (from the usb bus) to 3.3V via voltage regulator. This is to simulate running the screen and PIC from a lipo battery, not from the usb bus.

The problems started straight away.
Maplins Brighton didn't stock any 3V3 regulators. The web said "2 in stock" but at the store, they had none. Now, I don't mind admitting that Wrexham in North Wales is not the nicest place to live, but the Maplins store there is excellent. They stock pretty much anything you care to ask for over the components counter, and the staff and friendly and knowledgeable. Ask for a 470uF capacitor and they'll even ask if you're building a USB device (they take in interest in what their customers are using the components for) and give you a range to choose from - they're interested in what they sell and understand their customers.
The Brighton Maplins stock nothing. Two NPN transistors? What's the catalogue number? Sorry, we've only got one of those in stock. No I can't offer an alternative. You give me a catalogue number and I'll see if we've got it in stock (they invariably haven't!)

Anyway, enough about Maplins - a load of 3v3 regulators arrived in the post (ordered from the Farnell website, delivered next day) and we got to work. We made sure that we had the 18LF versions of microchips (the L being "low voltage") which run at anywhere between 2.5V and 5.5V.
Running off the 5V USB bus, the PICs worked fine (we always use an LED to show when the PIC is doing something, so as long as it's lit/flickering, we can tell that the PIC is actually doing something). But run a PIC18LF4550 from 3.3V and nothing happens. Zero. Zilch.

It turns out that PIC18s can't be relied on to support 20Mhz crystals at 3.3V - the datasheet shows a voltage/oscillation graph and 20Mhz is just out of the "safe zone" at 3V3. So we had to buy in some 16Mhz crystals (yes, you guessed it, none in stock at Maplins, Brighton). While waiting for them to arrive, I stuck some wires onto the crystal on Xing's Arduino board and used that (the Arduino uses a 16Mhz crystal - perhaps for the same reason?).

Still nothing.
What this time?
The brown-out fuse! Even with the brown-out voltage set to 2.1V the PIC refused to work. Disable the brown-out fuse, and the PIC magically comes to life and works perfectly with a 16Mhz crystal (albeit by this time, we'd reduced the code to a simple "turn-on-an-led" routine).

So now we had a PIC running at 16Mhz and at 3.3V. Brilliant.
Code it up with the LCD initialisation routines and off we go.....
Nothing.

Plug the LCD into the Arduino - it lights up and initialises perfectly.
So at least we know we've not damaged the LCD!
Plug the LCD into the PIC and there's nothing. Zero.
Testing the pins with a multimeter, comparing the two set-ups provided us with some interesting information. Namely, that when connected to the Arduino (see photo on this earlier post) the VIN pin has 9V on it. When connected to the PIC, this pin reads 0V.
Xing specifically said to connect 3.3V to the 5V supply pin and NOT to use the VIN pin (because of the way this prototype board is wired, the 5V supply on the Arduino does actually read 3.3V). So when connected to the PIC, the VIN pin is zero.
What happens if we bend this pin back, so it can't make a connection when the LCD is connected to the Arduino?
Hmmmm.
The LCD fails to light up. It just sits there. Dead.

Result! It may not be working, but at least we now get the same result using both PIC and Arduino controllers.

0 Comments

Post a Comment

whos.amung.us

Copyright © 2009 .Nerd Club All rights reserved. Theme by Laptop Geek. | Bloggerized by FalconHive Supported by Blogger Templates.