Skip to content

Commit 1d5bfa3

Browse files
authored
Merge pull request #5 from phantom1299/master
FIX function code of modbus error response
2 parents 33e2a7f + 36d23b6 commit 1d5bfa3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

PetitModbus.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ unsigned char PetitSendMessage(void)
117117
void HandlePetitModbusError(char ErrorCode)
118118
{
119119
// Initialise the output buffer. The first byte in the buffer says how many registers we have read
120-
Petit_Tx_Data.Function = ErrorCode | 0x80;
120+
Petit_Tx_Data.Function = Petit_Rx_Data.Function | 0x80;
121121
Petit_Tx_Data.Address = PETITMODBUS_SLAVE_ADDRESS;
122122
Petit_Tx_Data.DataLen = 1;
123123
Petit_Tx_Data.DataBuf[0] = ErrorCode;

0 commit comments

Comments
 (0)