Welcome to the forum.
This example might do the trick
http://www.microengineeringlabs.com/...pbc/countx.bas
Welcome to the forum.
This example might do the trick
http://www.microengineeringlabs.com/...pbc/countx.bas
Dave
Always wear safety glasses while programming.
Thanks...
I actually got it working before I read this... Had to set the Port as Outputs...
Now my next question:
The PIC18 explored poard has an LCD display on it. It is connected through an SPI I/O expander, MCP23S17. How do in therface it??? Microchips Manual is totally useless for me since I have no programming background...
The user guide states this:
An LCD display with two lines, 16 characters each, is connected to the SPI I/O
expander, MCP23S17. The two control lines and eight data lines are connected to the
I/O expander.
The I/O expander has an SPI interface that connects it to the microcontroller.The I/O
expander is disabled or enabled from the SPI by jumper JP3.
Last edited by Frozen001; - 8th August 2008 at 17:06.
Not familiar with that board. Do you have a link to the docs?
Dave
Always wear safety glasses while programming.
Well, hate to give you a bit of bad news, but you can't drive that LCD directly using PicBasicPro (maybe you already knew that, maybe not...)
It's set up such that the I/O from the expander drive the LCD pins. The LCD is a standard parallel, Hitachi 44780 compatible type from the looks of it.
If you do a Google search on that term, you should be able to find some documentation on how to drive it. I don't have anything with me at the moment or I'd attach it here.
Once you get your head wrapped around driving that LCD thru the I/O expander, it should be a piece of cake.
Since the board is from Microchip, I can't imagine somebody NOT having already written some 'libraries' to handle that.
Not so much serially, but yes, serially.
You'll have to set each pin individually, for each operation, every time, because you are accessing each pin, one at a time, thru the I/O expander.
For instance, to send any character (assuming the LCD is initialized), you'll have to set each data bit, one at a time, set the R/W line (which can most likely be set once to WRITE when the prorgam starts, then leave it alone), then strobe the E line high then back low.
Initialization is another thing... It's a long-ish sequence of setting various bits and/or bytes in the LCD itself, specifying modes, cursors, and so on. Nice thing is, once it's done, you don't have to do it again.
Call me crazy, but it's not really that hard once you get a set of 'core' subroutines built-up. Not to mention, you'll really get a feel for how PBP works once you're done writing the mess...
I suppose the other option is to disconnect that LCD and wire it up as shown in the PBP manual or something close to it...which isn't an unreasonable option. Might require a bit of trace cutting and/or rewiring. Not sure, haven't look at the datasheet for that board too closely.
(just looked at the datasheet for the board)
For that matter, you could probably disconnect the LCD from the mount it sits in right now, plug it into that expansion slot off to the side and set up each pin to do what you need.
If you can blink an LED, you can build up to running an LCD.
Last edited by skimask; - 8th August 2008 at 18:49.
Maybe, but I doubt it. Like skimask said. Can not use it with standard PBP commands.
Get a cheap LCD and hook it up like the example in the manual if you need to play with an LCD now.
Or wait and do some research like skimask said. Or maybe Darrel will have a trick up his sleeve.
Dave
Always wear safety glasses while programming.
Bookmarks