We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In Function:
CPU_INT16U MBM_FC16_HoldingRegWrN (MODBUS_CH *pch, CPU_INT08U slave_node, CPU_INT16U slave_addr, CPU_INT16U *p_reg_tbl, CPU_INT16U nbr_regs) { CPU_INT16U err; CPU_BOOLEAN ok; CPU_INT08U nbr_bytes; CPU_INT08U i; CPU_INT08U *p_data; MBM_TX_FRAME_NBYTES = (CPU_INT16U)(nbr_regs * sizeof(CPU_INT16U) + 5); MBM_TX_FRAME_SLAVE_ADDR = slave_node; /* Setup command */ MBM_TX_FRAME_FC = 16; MBM_TX_FRAME_FC16_ADDR_HI = (CPU_INT08U)((slave_addr >> 8) & 0x00FF); MBM_TX_FRAME_FC16_ADDR_LO = (CPU_INT08U) (slave_addr & 0x00FF); MBM_TX_FRAME_FC16_NBR_REGS_HI = (CPU_INT08U)((nbr_regs >> 8) & 0x00FF); MBM_TX_FRAME_FC16_NBR_REGS_LO = (CPU_INT08U) (nbr_regs & 0x00FF); nbr_bytes = (CPU_INT08U) (nbr_regs * sizeof(CPU_INT16U)); MBM_TX_FRAME_FC16_BYTE_CNT = nbr_bytes; p_data = MBM_TX_FRAME_FC16_DATA; for (i = 0; i < nbr_bytes; i++) { *p_data++ = (CPU_INT08U)((*p_reg_tbl >> 8) & 0x00FF); /* Write HIGH data byte */ *p_data++ = (CPU_INT08U) (*p_reg_tbl & 0x00FF); /* Write LOW data byte */ p_reg_tbl++; }
Two times more data is rewritten than it should be because we increment the number of bytes (nbr_bytes) but rewrite the whole register.
*p_data++ = (CPU_INT08U)((*p_reg_tbl >> 8) & 0x00FF); /* Write HIGH data byte */ *p_data++ = (CPU_INT08U) (*p_reg_tbl & 0x00FF); /* Write LOW data byte */
The text was updated successfully, but these errors were encountered:
No branches or pull requests
In Function:
Two times more data is rewritten than it should be because we increment the number of bytes (nbr_bytes) but rewrite the whole register.
The text was updated successfully, but these errors were encountered: