system
December 16, 2010, 10:24am
1
My sparkfun sdcard board uses pin D8 for the CS signal, my GLCD (with T6963 controller) uses pin D2 till D9 for data.
Is there a way I can make both work together ?
Extra info:
The pin assignment for the LCD is defined in low level code:
#define GLCD_DATA_PORT1 PORTD
#define GLCD_DATA_PIN1 PIND //Arduino Pins 2-7
#define GLCD_DATA_DDR1 DDRD
#define GLCD_DATA_SHIFT1 <<2
#define GLCD_DATA_RSHIFT1 >>2
#define GLCD_DATA_MASK1 0xFC
#define GLCD_DATA_PORT2 PORTB
#define GLCD_DATA_PIN2 PINB //Arduino Pins 8,9
#define GLCD_DATA_DDR2 DDRB
#define GLCD_DATA_SHIFT2 >>6
#define GLCD_DATA_RSHIFT2 <<6
#define GLCD_DATA_MASK2 0x03
// control port
#define GLCD_CTRL_PORT PORTC
#define GLCD_CTRL_PIN PINC
#define GLCD_CTRL_DDR DDRC
The pin on the sd-card is fixed to pin 8.
system
December 16, 2010, 1:52pm
2
The use of D8 by the sdcard may be hard-wired by the shield design, or may not, if you aren't using a shield.
The use of pins D2 to D9 may be hard-wired by the shield design, or may not, if you aren't using a shield.
Without knowing more about your hardware, we can't help you.
system
December 16, 2010, 2:45pm
3
The D8 of the sdcard shield is hard wired.
The pins of the LCD are soft-wired but the library is using low level code so I can't assign the pins in another way.
As stated above the pins 8 and 9 are defined like this:
#define GLCD_DATA_PIN2 PINB //Arduino Pins 8,9
They are shifted somehow in the rest of the code.
The library I'm using can be found here :
http://code.google.com/p/arduino-t6963c/
system
December 20, 2010, 1:25pm
5
If you wire up the graphics lcd yourself you can change it.
You have to change the code for port numbers the shifting etc.
system
December 20, 2010, 2:11pm
6
The wiring isn't a problem, changing the code is.
Since this is low level code I don't understand what it does.
Pin definitions for pin 8 and 9:
#define GLCD_DATA_PORT2 PORTB
#define GLCD_DATA_PIN2 PINB //Arduino Pins 8,9
#define GLCD_DATA_DDR2 DDRB
#define GLCD_DATA_SHIFT2 >>6
#define GLCD_DATA_RSHIFT2 <<6
#define GLCD_DATA_MASK2 0x03
WriteCommand function:
void T6963::writeCommand(byte command){
while(!(checkStatus()&0x03));
#if (defined(__AVR_ATmega1280__) || \
defined(__AVR_ATmega1281__) || \
defined(__AVR_ATmega2560__) || \
defined(__AVR_ATmega2561__)) //--- Arduino Mega ---
GLCD_DATA_PORT = command;
# else //--- other Arduino ---
GLCD_DATA_PORT1 &= ~GLCD_DATA_MASK1;
GLCD_DATA_PORT1 |= (command GLCD_DATA_SHIFT1);
GLCD_DATA_PORT2 &= ~GLCD_DATA_MASK2;
GLCD_DATA_PORT2 |= (command GLCD_DATA_SHIFT2);
# endif
GLCD_CTRL_PORT &= ~((1 << GLCD_WR) | (1 << GLCD_CE));
n_delay();
GLCD_CTRL_PORT |= ((1 << GLCD_WR) | (1 << GLCD_CE));
}
WriteData function:
void T6963::writeData(byte data){
while(!(checkStatus()&0x03));
#if (defined(__AVR_ATmega1280__) || \
defined(__AVR_ATmega1281__) || \
defined(__AVR_ATmega2560__) || \
defined(__AVR_ATmega2561__)) //--- Arduino Mega ---
GLCD_DATA_PORT = data;
# else //--- other Arduino ---
GLCD_DATA_PORT1 &= ~GLCD_DATA_MASK1;
GLCD_DATA_PORT1 |= (data GLCD_DATA_SHIFT1);
GLCD_DATA_PORT2 &= ~GLCD_DATA_MASK2;
GLCD_DATA_PORT2 |= (data GLCD_DATA_SHIFT2);
# endif
GLCD_CTRL_PORT &= ~((1 << GLCD_WR) | (1 << GLCD_CE) | (1 << GLCD_CD));
n_delay();
GLCD_CTRL_PORT |= ((1 << GLCD_WR) | (1 << GLCD_CE) | (1 << GLCD_CD));
}
I really have no clue on how to change this so I can assign the pins in the order I want.
system
January 3, 2011, 9:53am
7
bump
Anyone who can point me in the right direction on how to change the code ?