Troubleshooting
Why a DF1 echo command gets DLE NAK from a MicroLogix 1500
Short answer
A DLE NAK from a MicroLogix 1500 means the DF1 link heard your frame and rejected its envelope. Send echo as command 0x06, store the transaction number as two bytes low first, recompute the checksum over the final transmitted bytes, and free the serial port from other software before blaming the protocol.

On this page
A DLE NAK is not a refusal to talk: the MicroLogix 1500 heard your frame and rejected its envelope, which narrows the fault to a handful of bytes. The three that matter are the command byte, which must be 0x06 (decimal 6) for an echo; the transaction number, which must be two bytes stored low byte first; and the error check, which must be computed over the exact bytes as finally transmitted, stuffing included. There is no activation or enable command in DF1. When communication dies after a PC restart, another program on the host has taken the serial port, and no protocol byte will fix that.
What each receive symptom means #
Log the byte count and a hexadecimal dump of everything the port returns before you change a single byte in the request. A DLE NAK, a lone zero byte and silence are three different faults with three different fixes:
- DLE NAK (0x10 0x15): the controller detected the transmission and rejected the link frame. Check the command byte, the transaction number length, the delimiter stuffing and the error check.
- DLE ACK (0x10 0x06) with no command reply: the link accepted the frame, so the fault is in your receive logic. Keep reading after the acknowledgment.
- One 0x00 byte: a real link acknowledgment is two bytes, so a single zero almost always came from your own initialized buffer, not from the port. Log raw bytes at the receive boundary.
- Nothing at all after a PC restart: the port has changed hands. Fix ownership before touching the frame.
- Echo works but an output bit looks wrong: the read returns a whole word; the bit selection is yours.
The rejection is not unique to one controller, and a walkthrough of resolving a DF1 DLE NAK (0x10 0x15) rejection works the same framing checks byte by byte for a related serial link.
Correct the command byte and transaction number #
The echo command byte is 0x06; a frame with 0x00 in that position is not an echo at all, and the controller rejects it every time. The transaction number is two bytes and travels low byte first: transaction 1 goes out as 0x01 0x00. Pick a fresh transaction number for each request and require the reply to return the same two bytes before you trust its contents.
Send the frame once. Writing the same string twice back to back puts the second copy on the wire while the controller is answering the first, and the tail of the reply gets mixed with the head of the duplicate.
Rebuild the checksum over the final transmitted bytes #
An error check computed once and pasted into the code is valid only for the exact bytes it covered. Change the command byte, change the transaction number or insert a stuffed byte, and the old value is wrong, which is exactly what DLE NAK reports. Match the channel's configured selection (BCC is one byte, CRC is two) and compute it only after the frame is final.
Worked example, with BCC selected on the channel. Build the request in this order: header DLE STX; destination 0x01; source 0x00; command 0x06; status 0x00; transaction number 0x01 0x00; four echo data bytes 0x36 0x48 0x35 0x36; terminator DLE ETX.
Sum the bytes from the destination through the last data byte: 1 + 0 + 6 + 0 + 1 + 0 + 54 + 72 + 53 + 54 = 241. The BCC is the two's complement of that sum: 256 − 241 = 15, transmitted as 0x0F. The complete frame is 10 02 01 00 06 00 01 00 36 48 35 36 10 03 0F. A correct reply begins with DLE ACK (0x10 0x06), followed by the framed echo carrying your transaction number and your four data bytes; recompute the check over the received bytes before the terminator and compare it before accepting the reply.
Stuff a data byte that equals DLE #
If any data or address byte equals 0x10, DF1 requires it on the wire as 0x10 0x10 inside the frame body, and the error check must then cover the stuffed bytes exactly as they travel. On receive, remove the second copy of each escaped 0x10 before reading the data, and treat only an unescaped 0x10 0x03 pair as the terminator. Deleting bytes by position corrupts frames that legitimately contain the delimiter value. None of the bytes in the worked example equals 0x10, so no stuffing applies there.
Check port ownership and serial settings #
When the link dies on every PC restart and revives only after you launch other communication software, the frame is not the problem and there is no activation word to send. That software's server component starts with the PC and claims the serial port; when it lets go, your identical frame works untouched. In order:
- Identify the COM number assigned to your cable or adapter.
- Stop or reconfigure whatever holds that exact port.
- Close the port and release the serial object in your own program, then reopen it once.
- Log whether the open succeeded and whether each write reported the full byte count.
If nothing will release the port, no edit to the frame will help. If the port opens but every frame NAKs, match the baud rate, parity, stop bits, DF1 mode and error-check selection to the controller's channel configuration. The destination byte must be the controller's station address, and that address belongs to the channel rather than to your program, as why a MicroLogix 1500 DF1 node address cannot be changed covers.
Run the acknowledgment exchange #
Full-duplex DF1 acknowledges at the link layer before any application data moves. Clear stale receive data, send one framed request and read two bytes. On DLE ACK, keep reading until the framed reply, terminator and check byte have arrived; validate the check, the zero status and the transaction number, then send DLE ACK (0x10 0x06) to acknowledge the reply. On DLE NAK, correct the frame and retransmit the original request; never echo the NAK bytes back as a command. Bound the retries and report the final state to the caller, because an endless loop hides the difference between a malformed frame and a dead link.
The decision for each case #
- Echo frame returns DLE NAK: correct the command byte to 0x06, make the transaction number two bytes low first, and recompute the error check over the final transmitted bytes; retest with a single frame.
- Nothing at all after a PC restart: free the serial port from the software that claimed it; the protocol is irrelevant until your program can open the port exclusively.
- DLE ACK arrives but no framed reply: fix the receive path, reading past the two-byte acknowledgment until the terminator and check byte arrive.
- Echo passes but an output bit looks wrong: request one two-byte element rather than a multi-byte block, then select the bit from the word yourself.
When you move on to reads, the protected typed logical read with three address fields uses command 0x0F, function 0xA2 and byte size 2; its reply opens with a command field of 0x4F, which marks the message as a reply and is not data. And when you move on to writes, remember that a write from a PC moves real outputs with no logic interlock behind it: prove the frame against a machine held in a safe state first.
Questions asked
Which error check should the echo frame use, CRC or BCC?
Use whatever the controller channel is configured for, read from the channel configuration in the programming software. A BCC is one byte, the two's complement of the byte sum; CRC is two bytes. A frame checked with the wrong algorithm comes back as DLE NAK, so an otherwise correct frame that still NAKs points at the check type or the byte range it covers.
What values read the output word O:0/1 with three address fields?
Use a protected typed logical read with three address fields: command 0x0F (decimal 15), function 0xA2 (decimal 162), byte size 2, file number 0, file type 0x8B for the output file, element 0, subelement 0. The reply's command field reads 0x4F (decimal 79); that is a reply marker, not part of your data.
How do I get bit 1 out of the two data bytes in the read reply?
Strip the link framing and any stuffing first, then take the two data bytes before the terminator. Rebuild the word as the low byte plus 256 times the high byte, and select the bit with integer division and a remainder: divide by 2 raised to the bit position and keep the remainder. For O:0/1, that is bit position 1 of element 0.
