0001xxxx 150 baud rate 0010xxxx 300 baud rate 0011xxxx 600 baud rate 0100xxxx 1200 baud rate 0101xxxx 2400 baud rate 0110xxxx 4800 baud rate 0111xxxx 9600 baud rate 1000xxxx 19200 baud rate 1001xxxx 38400 baud rate
Return Values: | None |
void TC_232_parameter(long baud,int parity,int stop,int data)
{
unsigned char cc=0; unsigned int i_baud;
i_baud = (int)(baud / 10L); switch (i_baud)
{
case 11 : cc=0x00; break;
case 15 : cc=0x10; break;
case 30 : cc=0x20; break;
case 60 : cc=0x30; break;
case 120 : cc=0x40; break;
case 240 : cc=0x50; break;
case 480 : cc=0x60; break;
case 1920 : cc=0x80; break;
case 3840 : cc=0x90; break;
default: cc=0x70; break;
}
switch (parity)
{
case 0 : break;
case 1 : cc=cc0x04; break;
case 2 : cc=cc0x0c; break;
case 3 : cc=cc0x08; break;
}
switch (stop)
{
case 1 : break;
case 2 : cc=cc0x02; break;
}
switch (data)
{
case 7 : break;
case 8 : cc=cc0x01; break;