Sergeant82d
Joined: 01 Nov 2009 Posts: 55 Location: Central Oklahoma
|
SED1335 Driver Update |
Posted: Wed Dec 02, 2009 5:53 pm |
|
|
Thanks to the efforts of PCM_Programmer, Will Reeve and MikeP, the problems many of us have had with the SED1335 Driver included in CCS's Library have been identified and corrected.
If you are having problems with vertical lines (every 8th column) missing, or smearing, or likely even if you are not, you need to make the following three changes to your SED1335 Driver:
1)
There's a bug in this function in sed1335.c at least up to ver 4.088. The expression reading the high part is wrong. It's adding 1 to the address before it's cast to an int8 pointer. That's wrong. It should be cast to an int8* before the 1 is added to it.
Code: |
Quote:
int16 getCursorAddress()
{
int16 addr;
glcd_sendCMD(GLCD_CMD_GET_CSR_ADDR);
TGLCD_DATA
*(int8*)(&addr ) = glcd_readByte(); // Read low part
*(int8*)(&addr + 1) = glcd_readByte(); // Read high part /// This is wrong
return addr;
}
It should be changed to this.
Code:
*((int8*)&addr + 1) = glcd_readByte();
|
2)
Code: |
// Purpose: Get the current address of the cursor
// Outputs: A 16 bit integer containing the cursor address
int16 getCursorAddress()
{
int16 addr;
glcd_sendCMD(GLCD_CMD_GET_CSR_ADDR);
TGLCD_COMMAND // changed from TGLCD_DATA
*(int8*)(&addr ) = glcd_readByte(); // Read low part
*(int8*)(&addr + 1) = glcd_readByte(); // Read high part
return addr;
}
|
And 3)
Code: |
// Purpose: Get a byte of data from the display at the address
// Inputs: A 16 bit integer containing the address
// Outputs: An 8 bit integer with the read data
int8 getData(int16 addr)
{
setCursorAddress(addr);
glcd_sendCMD(GLCD_CMD_DISPLAY_READ);
TGLCD_COMMAND // changed from TGLCD_DATA
return glcd_readByte();
}
|
Note in 2 & 3 the TGLCD_COMMAND, where it has been changed from TGLCD_DATA. For further info on what is going on, see this post http://www.ccsinfo.com/forum/viewtopic.php?t=21096
Hope this helps. |
|