Hi Spinnaker,And how many times have I said this only to find my mistake when I finally decided to do point to point troubleshooting.
Hi JohnInTX,Should the contrast pin be grounded? What does ISIS mean when it says disconnected? That would indicate a problem in the sim skiz?
On the software side, I took your code and built it with XC8 and found many versions of the xlcd library on disk (who knew?) but picked one, built it OK then stepped it while watching the ports in a window. I found that OpenXLD issued the WRONG setup codes for a 4 bit interface. That's disturbing but since I found several different versions of xlcd on disk (doubtless from various demo kits etc) I looked at the source in C18. It looked better but I didn't update my test project (busy). If it were me, I'd try this:
Explicitly include the .h file and a copy of the xlcd library source files in your code as part of the project. Don't use the compiled library. Using real source gives you control over what's going on AND you can see it execute line by line in the MPLAB simulator.
Resolve any build errors including specifying delays etc.
Step the code in MPLABX simulator, watch the port values and compare them with the Hitachi 44780 datasheet. Step OVER the delays to avoid wearing out your mouse buttons but put the stopwatch up to verify the time.
I prefer MPLABX for this kind of thing because the editor window grays out code excluded by #defines. When there are a lot of them, its much easier to see what code was actually generated.
I found the xlcd source in C:\Program Files (x86)\Microchip\mplabc18\v3.40\src\pmc_common\XLCD and the .h in C:\Program Files (x86)\Microchip\mplabc18\v3.40\h on my system. YMMV
Include each file as part of your project and build for debug. Keep in mind that you would not be the first person to find bugs or questionable code in a library. In particular, I didn't like the r-m-w on PORTx (instead of LATx) but I'm fussy that way.
I don't know what your experience level is but this is one reason I (like many of our *ahem* more experienced members) write my own libraries, sometimes using published source as a guide. Your problem, and ours too, is that you don't really know the particulars of the code you are using when you use a compiled library.
|Thread starter||Similar threads||Forum||Replies||Date|
|J||Can I connect this Thermostat to my Heat Pump?||General Electronics Chat||4|
|A||Looping CAN BUS signal or turning a reading into a input||Analog & Mixed-Signal Design||22|
|Can I communicate with this controller? Scrap from a ship propeller||Microcontrollers||4|
|Can multiple power management devices be used in a single power supply?||General Electronics Chat||1|
|Can CD40110 start counting from 1||General Electronics Chat||12|
by Jeff Child
by Jeff Child
by Dale Wilson