Hello Guest it is October 22, 2020, 11:08:13 PM

Author Topic: Helpme with Modbus Digital output And PWM - Brain Please!!!!  (Read 228 times)

0 Members and 1 Guest are viewing this topic.

Offline Marce

*
  •  10 10
    • View Profile

I need to send the speed signal from the spindle to an arduino uno to control the intensity of a laser or spindle if required through the Modbus protocol. As arduino pwm signal this should have a resolution of 0-255. I also require enabling an output pin on arduino to enable a relay with the M03 command and disable with M05. Unfortunately I am not an expert programmer of Brain. So I ask for your help. In the modbus tester stage. Everything works very well.
But in Brain something does not work. The two digital outputs that I have. when they are activated. They deliver a signal that is not constant. It varies with a frequency of 5.19Hz and a period of 190 milliseconds. which is bad because it does not work for me. And as much as I have tried I can not find the solution. In the attached brain photo. You can see that the DRO  169-CMD Spindle RPM acquires the value of spindle speed.  But it never leads out. In this out is the modbus register that I need to load to control the PWM signal. And this never happens.

On the other hand. I have three digital inputs that generally work fine. On occasions these signals are not activated when they should be. This happens when I start mach3. This I solve by performing a test on the modbus communication. After this the signals are communicated with mach3. But I wonder if this could be done automatically?

I think my syntax is very poor and that is the problem.  Is there a function that will help me solve the problem?

I would appreciate any help. Honestly I am very interested in learning this I / O expansion technique which I consider too interesting.