MOD5441X FlexBus using CS1
Posted: Sat Feb 21, 2015 7:23 am
I am trying to use CS1 to connect a LCD to the address & data bus.
The lcd has a "RS" pin meaning 1=command & 0=data. I figured that I could connect this pin to A1 to accomplish this.
I have CS1 working but something strange is going on that i cannot figure out.
Here is the code I have.
what is strange is that the value I give to LCD_COMMAND or LCD_DATA affects the A0 pin during the write.
For instance if i *(unsigned short *)(LCD_COMMAND) = 0x00, A0 should be low which it is. Yet if i change it to a 1 then A0 goes high during the write. Why is this ? I am writing to the same memory location so how does the data affect the address pins.
The lcd has a "RS" pin meaning 1=command & 0=data. I figured that I could connect this pin to A1 to accomplish this.
I have CS1 working but something strange is going on that i cannot figure out.
Here is the code I have.
Code: Select all
#define BASEADDRESS 0x00000000
#define LCD_COMMAND BASEADDRESS
#define LCD_DATA BASEADDRESS + 2
//Enable Chip Select 1 for LCD
sim2.cs[1].cscr = 0x007FFC40;
sim2.cs[1].csmr = 0x00000001;
sim2.cs[1].csar = ( BASEADDRESS >> 16 );
while(1)
{
*(unsigned short *)(LCD_COMMAND) = 0x03;
for(int t=0;t<50;t++){
asm("nop");
}
*(unsigned short *)(LCD_DATA) = 0x00;
OSTimeDly(10);
}
what is strange is that the value I give to LCD_COMMAND or LCD_DATA affects the A0 pin during the write.
For instance if i *(unsigned short *)(LCD_COMMAND) = 0x00, A0 should be low which it is. Yet if i change it to a 1 then A0 goes high during the write. Why is this ? I am writing to the same memory location so how does the data affect the address pins.