MCF52235 and KS0108 LCD´s

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MCF52235 and KS0108 LCD´s

1,960 Views
Kremer
Contributor I
 Hi friends
 
 I´m trying to do a very cheap bidirectional interface between MCF52235 and  a 128x64 LCD controlled by KS0108 (most common and cheap dot matrix LCD).
 Unfortunately, this display requires 5V supply, and i think coldfire is NOT 5V tolerant.
 On another thread on this forum i´ve read that we can connect CF´s gpio as inputs to a TTL level device, since CF will clamp the high level voltage to 3.6V. All we need to do is limit the current by using resistors ( I tried from 1K to 10 K values).
 Well, i used the PORTAN (full 8 bit registers) to do the D0~D7 lines. Using it as output, i can succefully write to display and show any kind of message and chars on it.
 The problem happens when i try to read the device´s ram. Read the internal LCD ram is needed because when you want to set/clear just one pixel, you need to know the state of the other pixels (one pixel is one bit but we write in bytes, so 8 pixels per write), to avoid clearing preivous set pixels.
 So, using PORTAN as input, i can´t read correctly. I mean, when i change the PORTAN DDR register to 0x00 (turn all pins as input), the SETAN register goes to 0xFE, no matter what level i have on port´s pins.
 Testing the PORTAN as gpio input without the display, i can succefully read the pins state correctly (0x00 with port´s pins to GND and 0xFF with port´s pins to 3V3), so this port is working OK.
 Does somebody has done something similar, or guess what i´m missing here?
 
 Thank you all for the help
 Regards
Labels (1)
0 Kudos
1 Reply

372 Views
Kremer
Contributor I
 Oh, i forgot to put my read routine:
 
Code:
/*-------------------------------------------------------------------------------Read data from LCD U8 = LcdDataRead();-------------------------------------------------------------------------------*/U8 LcdDataRead (){ unsigned char rdata;  /* Data Mode */ LCD_CTRL_WR |=  LCD_DI; /* Read Mode */ LCD_CTRL_WR |= LCD_RW;   /* Configura porta AN de dados como entrada */ LCD_DATA_DDR = 0x00; /* 2 clock pulses is needed to read data ram */ glcd_StrobeEnable(); // shift LCD data to output register glcd_StrobeEnable(); // shift data to KS0108 pins, rdata= (U8)(LCD_DATA_RD);/* Nivel 0 em todos os pinos da porta TA */ LCD_CS_WR  = 0x00; /* Configura porta AN de dados como saida */ LCD_DATA_DDR = 0xFF; return rdata; /* return the data read */}

 
 Regards
 
0 Kudos