Larsinator
Hi, I was wondering if it was possible to run dc motors with the analog signal pins on OpenPLC without additional hardware. I have tested the motors and know they'll work with the digital output pins, so in theory I just need the analog output pins to act like digital pins. The reason I want to do this is that I've run out of digital output pins. How is this done in OpenPLC?
 
I only need them to rotate in a set speed without the need of changing the RPM.
 
Thanks
 
Edit: I want to use digital bits for inputs, but if analog input is easier, I'm able to use that as well
Reply 0 0
thiagoralves
Just reconfigure the pins on the upload dialog under IO config and give yourself more digital output pins
Reply 0 0
Larsinator
Just reconfigure the pins on the upload dialog under IO config and give yourself more digital output pins
Can this also be done on a Arduino H7 board? I've opened the upload dialog but can't seem to find I/O config anywhere
 
Edit: I've also used up %QX0.0 - %QX0.7 so I don't know if I will be able to use a digital adress for the output pins, since they are out of range
[203128%2F8370805%2Fmceclip0]
Reply 0 0
thiagoralves
Update your editor
Reply 0 0
Larsinator
Update your editor
Hi, I've updated my editor, but I'm wondering what addressing I should use for the Arduino PMC. I've tried several methods, but it seems to corrupt the software on the Arduino. Atleast I get a message that the USB device has a fault. The program compiles perfectly fine, any suggestions of what might be the problem?
Reply 0 0
thiagoralves
From that pin configuration screen shot it looks like you’re using the portenta machine control. As far as I can tell, the pins on that board are not configurable. They are set in hardware. 
Reply 0 0
Larsinator
From that pin configuration screen shot it looks like you’re using the portenta machine control. As far as I can tell, the pins on that board are not configurable. They are set in hardware. 
Ah, yeah I'm using a PMC. Any suggestions of how I could run the motors from the analog pins? I was able to make an analog switch for an input, but I still haven't made it work for the analog outputs. Thanks
Reply 0 0
thiagoralves
You can't. As I said, that's defined in the hardware. You would have to build a new board. An analog input will forever be an input, no matter what. The circuit around the pin was designed to handle inputs only.
Reply 0 0
Larsinator
You can't. As I said, that's defined in the hardware. You would have to build a new board. An analog input will forever be an input, no matter what. The circuit around the pin was designed to handle inputs only.
I'm sorry if I wasn't clear enough. I was wondering if I could use OpenPLC to make the analog outputs act like digital outputs. I understand I can't change them on the hardware.
Reply 0 0
thiagoralves
Ah, got it! Maybe I misread that, sorry. Yeah, you can do that in logic. Use two MOVE blocks with the conditional execution checked so that you can control the EN pin whenever you want the MOVE to happen. Then when you want that output being set as TRUE, just use one MOVE block to move the maximum output value of 65535 to the output. When you want that as FALSE, use the other MOVE block to move 0 to the output.
Reply 0 0
Larsinator
Hi again, I tried your suggestion, but I couldn't make it work. Do you see anything in the code that might be wrong? (It doesn't seem to do anything with the analog pins since Q_Conv and the sensors works normally)
Reply 0 0
thiagoralves
Coils are the last elements of a rung. You put a coil before your move block, and that’s wrong. Also, you’re missing your second move block that turns off your analog output moving zero to it
Reply 0 0
Larsinator
Still doesn't work
Reply 0 0
thiagoralves
I don't have your full program, so it's hard to judge if that works or not. That snippet looks fine to me. Can you control the analog outputs at all? If you just have a simple program writing 65000 to %QW0, does that show some voltage output?
Reply 0 0
Larsinator
That is the full program, in addition to the variables I added further up. I wrote it as a test program before implementing it into another program. I tested the voltage earlier on the pin and it doesn't seem like the analog output have any voltage. So I'm not sure what the problem could be.
Reply 0 0
Reply