View previous topic :: View next topic |
Author |
Message |
nhamdtk4
Joined: 18 May 2009 Posts: 8 Location: Việt Nam
|
Can't change port data in glcd.c |
Posted: Sun Apr 25, 2010 6:50 am |
|
|
I tried but I can't change port data in GLCD.C. Could you help me? Thank! |
|
|
nhamdtk4
Joined: 18 May 2009 Posts: 8 Location: Việt Nam
|
|
Posted: Tue May 04, 2010 6:19 pm |
|
|
Could you help me. please! |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue May 04, 2010 7:10 pm |
|
|
Explain your problem in detail. No one replied, because we don't know
what you mean by "can't change port data in GLCD.c".
Do you mean that you want to change the default PIC pins that are used
for the GLCD to some other pins ? If so, tell us what new pins you want
to use. |
|
|
nhamdtk4
Joined: 18 May 2009 Posts: 8 Location: Việt Nam
|
|
Posted: Wed May 05, 2010 7:30 am |
|
|
Yes, thank PCM programmer very much (my english is too bad, i'm sorry). I want to use portB (or other ports) is data port. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed May 05, 2010 11:39 am |
|
|
To change the data port for GLCD.c to PortB, you need to edit the lines
shown in bold below, and change the "_d" to "_b" in each case.
Quote: |
void glcd_writeByte(char chip, BYTE data)
{
.
.
.
output_d(data); // Put the data on the port
.
.
.
}
|
Note that the following routine has two lines that must be edited:
Quote: |
BYTE glcd_readByte(BYTE chip)
{
.
.
.
input_d(); // Set port d to input
.
.
.
data = input_d(); // Get the data from the display's output
.
.
.
} |
Also note that at the top of the GLCD.c file, it lists the PIC pins for the
control signals (such as GLCD_CS1, etc). Most of these control signals
are assigned to PortB. You need to change them to use pins on a
different port. You can't have the GLCD data port and the control
signals on the same port. They must be on different ports. |
|
|
nhamdtk4
Joined: 18 May 2009 Posts: 8 Location: Việt Nam
|
|
Posted: Wed May 05, 2010 6:32 pm |
|
|
Thank you very much! |
|
|
chuot chui
Joined: 19 Jul 2011 Posts: 2
|
i can't do it |
Posted: Tue Jul 19, 2011 2:33 am |
|
|
i have changed data port(port b) and control pins but the simulation not work!! Please tell me why? |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9225 Location: Greensville,Ontario
|
|
Posted: Tue Jul 19, 2011 4:48 am |
|
|
Well now the bad part of your problem.
You tell us you're using a simulator( Proteus ?) NOT real hardware.
Should have told us that in the first message.
It is full of bugs, errors and other problems and cannot be solved here.Best to ask in the simulator's manufacturers 'support' forum, if one exists.
When you have real hardware,show us your code,PIC type, compiler version and we're then able to help. |
|
|
chuot chui
Joined: 19 Jul 2011 Posts: 2
|
|
Posted: Tue Jul 19, 2011 11:53 am |
|
|
I'm using Proteus not real hardware. My code is very simple. I use PIC 16c77 and GLCD to display my name using CCS 's library (graphics.c and HDM64GS12.c). I changed control port and data port but it didn't work
dataport : port_b
CS1 : RD7
CS2 : RD6
RS : RD5
DI : RC7
RW : RC6
E : RC5 |
|
|
|