Page 1 of 1

Strange behavior of modbus function

PostPosted: Thu Feb 13, 2025 12:02 pm
by Ruslan
Hi. As I told earlier, I'm making a control panel for UCCNC. The USB part for entering letters, numbers and symbols works well, but there are questions about the operation of the macro program for interaction with the keyboard function buttons. I have 32 functional buttons for controlling the spindle, coolant, etc. When I press a button on the keyboard, a logical 1 is written in the modbus bitfield. Using the Read Coils function of plugin, I successfully read all states of the buttons into the UCCNC register table. In the macro program, I first read the state of all buttons with the function exec.GetModbusregisters(0, 32, out data); to array ushort[] data = new ushort[32]; then if a certain element of the array is equal to 1, then I do some action and after that I have to write logical 0 back to the keyboard to clear bit in keyboard bitfield. I am using if(data[CW_button_state_reg] == 1) {data[CW_button_state_reg] = 0; exec.Callbutton(114); Console.Beep(); exec.SetModbusregister(CW_button_state_reg, 0); }. I see that in the UCCNC register table, instead of a logical 1, a 0 appears, but it changes back to 1 and the Write Multiple Coils function sends a logical 1 in its frame to keyboard. I'm wondering if I made a mistake somewhere or is this a plugin problem?
M20310.txt
(806 Bytes) Downloaded 19 times

Re: Strange behavior of modbus function

PostPosted: Fri Feb 14, 2025 8:01 am
by Ruslan
Good technical support for buyers.