GLK240128-25 Flow Control Help
Posted: Fri May 18, 2007 11:22 am
Hello, I am having a little trouble using flow control with my MO display, and was hoping someone would be able to give me some tips. My display frequently gives me garbage or cuts off some characters when I send enough to cover about half the screen or more. I assume this is because the buffer is overflowing, so I tried to use this simple function to send all my commands to the display:
This is how I initialize my flow control:
As I understand it from the manual, both flow control arguments represent the number of bytes remaining in the buffer, although I tried using 25, 25 as well.
Even using this function for my writes, I still get garbage towards the end of my transmissions. I am using a microcontroller board that only reads C and assembly, and am communicating through RS232 protocol. Any help you could give would be greatly appreciated. Thank you.
--David
Code: Select all
void myCwrite(char *cmd, int len) // takes the command to send and size
{
int i;
char status[1];
for(i = 0; i < len; i++)
{
serCwrite(&cmd[i], 1); // writes 1 byte to the port that has the display connected to it
serCread(status, 1, 1000); // reads 1 byte from the port
if(status[0] == 0xFE) // 0xFE indicates "almost full"
while( status[0] != 0xFF ) // 0xFF indicates ready
serCread(status, 1, 1000);
}
}
Code: Select all
void flowControl(int full, int empty) // I typically use 25, 65 respectively
{
char cmd[4];
cmd[0] = 0xFE;
cmd[1] = 0x3A;
cmd[2] = full;
cmd[3] = empty;
serCwrite(cmd, 4); // sends the command 0xFE 0x3A <full> <empty>
}
Even using this function for my writes, I still get garbage towards the end of my transmissions. I am using a microcontroller board that only reads C and assembly, and am communicating through RS232 protocol. Any help you could give would be greatly appreciated. Thank you.
--David