CFAH1602D-YTI-ET character display issues

thoffman1986

New member
Right now I have successfully initialized this character display to output any character array that I pass to it that fits the constraints. The issue that I currently have is being able to see the cursor step through writing each letter in each space even though my delay is not more than 40 milliseconds. if I decrease the delay any more, I then run into the issue of outputting garbage text or not even initializing at all... Is there any function set command that I need do during initialization or is this just how slow the processor writes out the characters? Pleas let me know if you have any ideas on what to do or if you need more information.

Thank you for reading,

Timothy Hoffmann
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
 
... my delay is not more than 40 milliseconds. if I decrease the delay any more, I then run into the issue of outputting garbage text or not even initializing at all...
Since the longest instruction takes only 1.5 mS, and data writing takes only 37 uS per character, it seems something is drastically wrong if you get errors with a little less than 40 mS delay.
... is this just how slow the processor writes out the characters?
Since you control the processor, you can write out data at any speed. If you want maximum speed, you'll have to test the busy flag of the display to wait for the next write (instead of a long delay).

Tell us some detail about which cpu you use and how you have the display connected. Also, you might attach a file with your code.
 

thoffman1986

New member
more information

I am using a dsPIC30F6015 processor and have my code written in C. in particular I used the C30 compiler from microchip and am attaching the source file. In the file you will see in the main code that it jumps to a initialize LCD function and a Print LCD function. there is also a function for a stepper motor which you can ignore. In Port D i have pins D0 through D7 for the data pins and D8 and D9 for the control pins Enable and RS. R/W is grounded in my program. I will appreciate any other input that you have on the matter and will be happy to answer any questions you have about my source code.

Thank you again,

Timothy Hoffmann
 

Attachments

thoffman1986

New member
Well now I have got it working, For turning the display on, I also turned on the Cursor by sending 00001101 to the pins which must have confused it. I changed that command to 00001100 and It now works great!!! Thank you for looking at my problem even though I have seemed to figure it out on my own.

Thank you again,

Timothy
 
Your code looks like it should work, timing and control signal wise. Your delays could be shortened to 2 mS.

The InitializeLCD() function looks wrong, too few bytes, wrong byte order. You have:
Code:
no delay
0x0D   // display on/off
25 mS delay
0x38   // set function
25 mS delay
The data sheet recommends:
Code:
40 mS delay
0x38   // set function
37 uS delay
0x38   // set function, repeated
37 uS delay
0x0D   // display on/off
37 uS delay
0x01   // clear screen
2 mS delay
0x06   // set entry mode
37 uS delay
These displays have no reset method other than applying power. The first command(s), 40 mS after power up must be the function set. The rest can be in any order. I suspect this is the cause of your problem.

Since the display logic (excluding backlight) draws less than 2 mA, you could probably source the display power from an I/O pin, thereby giving you a way to dynamically reset the display without powering down the whole circuit.

I am guessing that you are using PORTF as a diagnostic status.
 

thoffman1986

New member
yes that is what I am using Port F for, I will make sure to put that delay in at the beginning of the initialization and reorder my commands. after my change, everything seems to be working well now. Thank you all for your help again!!

Timothy
 
Top