CYO
Hi guys,
i tried to implement a pwm_controller function block to drive a stepper motor with hardware pwm. First i couldn't compile my runtime and had to modify the controllino_maxi.cpp by basically copying some lines (avr_pwm library implementation) of the duemega.cpp file as it uses the same atmega2560 microcontroller. Now everything compiles fine and the runtime runs on my controllino - however im unable to get an physical pwm output. In the plc debugging simulation everything works and i get an pwm output. The desired frequencies vary from 400-2000Hz so nothing special. Im a bit lost right now on what to try next. Maybe the avr_pwm library is somehow not compatible with the controllino maxi?
Reply 0 0
thiagoralves
It depends on how the controllino is wired internally. You could be successfully activating the PWM hardware on the 2560 chip inside, but that might not be reflecting on the actual output if the pin is not directly tied to the output. This should be a Controllino question. Indeed they should be the ones writing the driver for their hardware.
Reply 0 0
CYO
Hey,
so after a good night of sleep i decided to ditch the FB PWM_Controller approach and revert to the original controllino_maxi.cpp file. I wrote my own "PWM_Controller" with the avr_pwm library in an arduino sketch function and now everything works fine!
Reply 0 0
thiagoralves
Ah, good to know it works!
Reply 0 0
Reply