Hello Guest it is September 17, 2021, 02:39:53 AM

Author Topic: Helpme with Modbus Digital output And PWM - Brain Please!!!!  (Read 706 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.
Re: Helpme with Modbus Digital output And PWM - Brain Please!!!!
« Reply #1 on: July 18, 2021, 10:34:17 AM »
I am not expert. why do not use mcode macro for send spindle speed to arduino.

Offline ZASto

  •  388 388
    • View Profile
Re: Helpme with Modbus Digital output And PWM - Brain Please!!!!
« Reply #2 on: July 18, 2021, 04:01:43 PM »
I don't get it :(
Why you want to use Arduino for setting laser intensity?
Are you using parallel port or have an external motion controller?
Make no mistake between my personality and my attitude.
My personality is who I am.
My attitude depends on who you are.