dsPIC & CFAG320240CX-FMI-T Interfaced

PlazmaFox

New member
Hello all,

New user, but decided to upload my code for anybody that may want to take a look at how to interface a CFAG320240CX-FMI-T with a dsPIC. I included the entire workspace for MPLab and the schematic for the circuit. I basically followed the setup procedure given in the Epson data sheet, which initializes a 512 × 128 pixel screen, but produces 4 sub-screens on the 320240CX-FMI. Additionally, the LCD was setup in 8080 mode when it shipped, which is how I programmed it.

From here I plan on using the screen to display different graphics associated with particular sounds that I’ll sample and cross correlate with previously stored sounds in memory. It’s kind of a sound-to-visual converter designed for the hearing impaired.

If anyone has any questions, feel free to ask. I hope this is a help to anyone with setup and initialization maladies. :D :eek: :confused: :) :) :D ;) :cool:

Regards,

Trevor
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
 

Attachments

CF Tech

Administrator
Wow, that sounds like an interesting project :)

Thanks for posting code, I am sure it will be found useful.
 

bfmitch

New member
Questions

Trevor,

In the schematic you have the DISPOFF line connected to an output from the DsPIC. In the code you have that line set as an output. With the DsPIC does initializing the line as an output put it at 0 or 1? If it's a zero it appears the LCD should be turned off.

In the Main Loop code, when you turn the LCD on, there are no parameters to the command. Since the default for Reg 09H is 0, the display should still be off after the command.

I'm using a CFAG320240CX-TFH-T. I hope the controller isn't that much different between the two.
 

PlazmaFox

New member
DISPOFF line, and Reg[ 09h ]

Your correct, the LCD should in fact be turn OFF. I didn’t even realize this until you pointed it out. :eek: I went back to check my code, and in simulation the DSIPOFF line is in fact in a LOW state. Additionally, when I drove the pin high the display did actually turn off. So, page 12 of the data sheet was wrong by what my experience is telling me. :confused:

If the line is HIGH, the there will be no display, if LOW just the opposite and the display is on.

As for the turning on the display in the main loop, simply by issuing the command 0x58 or 0x59 turns the display either off or on respectively. "Command" being the operative word here; this is denoted by the fact that in 8080 mode the A0 line is held HIGH when the !WR line is pulsed low to high. So its like your telling the LCD controller, ok, the information on the DATA lines is going to be written to you ( 'you' being the LCD controller ) as a command. Meaning that, both commands 0x58 and 0x59 are mapped to the same register, but the numbers themselves are passed as the parameter. ( As far as I understand it )
Note that 58h = 01011000b the last LSB being a zero and would turn the display off, while 59h = 01011001b, the 1 turning the display on. So if only enabling the display on or off, all you have to do is write either command. Any parameters pass hence forth would be used for the display attribute register Reg[ 0Ah ].

Thanks for pointing out the DISPOFF line. :D :D Originally, I never set or cleared the specific bit, other than clearing all of PORTF.

Hope that answers your question.
 

bfmitch

New member
Document Madness

As I was getting my display to work I spent a lot of time with that manual over the last few days. The information is in there but you really have to dig in multiple spots at the same time to get what you need.

I found all the information for using the commands and their parameters to turn on and off the display. I found quite a few places where if you do exactly what they say it won't give the result you're expecting. I had to experiment with most of the parameters for the different commands until I got what I wanted.
 

MarkEE

New member
Plazma
Thank you for posting this code. Im interfacing a dspic6014 for a project designing a storage scope. I've poured over the data sheet for hours but your code really cleared up all my questions. I just translated it to C and will probably fire it up in a day or two.

Thanx
Mark
 

sgupta

New member
Hello,

Thanks for posting the project details on dsPIC interface by Trevor. unfortunately, the asm file seems to be corrupted.

Thanks,
Sudhir Gupta
 

m3x1can0

New member
Fixing display

Hi,

I looked at your code, and translated it to C added an extra line at the bottom of EPSON just like the datasheet does, but every time I try to fix the 4 sub-screens problem I get nothing displayed anymore.
Has someone figured out how to fix this? I tried changing my code to what the crystalfontz datasheet example says up to the point where they dump the bitmap where I just generate characters. So far I've had no luck this way either.

Please let me know if someone has figured it out or anyone has ideas as to how to fix this.

Thanks
-Pablo
 
Top