Owner's manual
Chapter 5
Using the RS–232 Ports
5–62
case DLE:
if ( message_started )
{
if ( ++length > MAX_BUFFER )
{
_bios_serialcom(_COM_SEND,portnum,DLE);
_bios_serialcom(_COM_SEND,portnum,NAK);
last_response = 0;
message_started = 0;
err = 0;
length = 0;
df1_bcc = 0;
msg = msg_start_ptr;
}
else
{
*msg++ = ( ch & 0xFF );
df1_bcc += ( ch & 0xFF );
}
}
break;
case ENQ:
if ( last_response )
{
_bios_serialcom(_COM_SEND,portnum,DLE);
_bios_serialcom(_COM_SEND,portnum,NAK);
}
else
{
_bios_serialcom(_COM_SEND,portnum,DLE);
_bios_serialcom(_COM_SEND,portnum,NAK);
}
break;
default:
break;
}
}
else if ( message_started )
{
if ( ++length > MAX_BUFFER )
{
_bios_serialcom(_COM_SEND,portnum,DLE);
_bios_serialcom(_COM_SEND,portnum,NAK);
last_response = 0;
message_started = 0;
err = 0;
DF1 Programming
Example (cont’d)