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