Fix issue of sometimes failed to read multiple points in the coil area

* The functional tester "Read multiple points in the coil area"
  sometimes fail, because there is a mistake when writing bit to coil area
  register. I fix this mistake.
This commit is contained in:
Parker Liu
2021-12-11 11:01:19 +08:00
parent f69610ed1e
commit 606356d6fd
+2 -2
View File
@@ -216,7 +216,7 @@ int main()
w_res->n_reg = w_req->n_reg;
for (int i = 0; i < ntohs(w_req->n_reg); i++) {
uint8_t x = w_u8[ntohs(w_req->n_reg) / 8] << (7 - (i % 8));
uint8_t x = (w_u8[ntohs(w_req->n_reg) / 8] >> (i % 8)) & 0x1;
if (x > 0) {
coil[ntohs(w_req->start_addr) + i] = 1;
@@ -250,4 +250,4 @@ int main()
neu_tcp_server_close(server);
return 0;
}
}