Can anyone advise where I can find a pin map for the Portenta Machine Control unit for the mapping of the Digital Outputs and Programmable I/Os when using the PLC IDE?
To summaries my issue I'm having with the PLC IDE;
I have a Portenta Machine Control (PMC) unit which I am attempting to use the digital outputs to control a stepper motor. I've used the standard Arduino IDE to upload code to the built in Portenenta H7 to test that the digital outputs could control a stepper and it worked satisfactorily. The test was using the the code below to continuously rotate the stepper. The purpose of the test was sufficient to know that a similar code should work using the PLC IDE.
For reference, the stepper is controlled via a TB6600 immation controller and here's the code I used.
#include <Arduino_PortentaMachineControl.h>
void setup() {
MachineControl_DigitalOutputs.write(0, HIGH);
}
void loop() {
MachineControl_DigitalOutputs.write(1, HIGH);
delayMicroseconds(500);
MachineControl_DigitalOutputs.write(1, LOW);
delayMicroseconds(500);
}
I've chosen to use the PLC IDE to run the stepper so that it can interact with functions in a Ladder Diagram (LD) which are easier to setup/modify and debug far easier than using a basic Arduino Uno board. It's also far easier to update and change the code as it grows and requires additional capabilities.
I've managed to do something similar with the Arduino OPTA so that a sketch looks for a LD contact state change and then responded by activates one of the LEDs via a sketch, (rather than using a coil to turn on that LED). This was done using the pinmap outputs as shown here.
Heres my Opta example:
void setup()
{
pinMode(LED_D3, OUTPUT); // LED_D3 is the 4th LED on the front of the unit.
}
void loop() {
testLoop1();
}
void testLoop1() {
if (PLCOut.outLedTest == true){ // checks the status of the shared variable in the LD
PLCIn.inLedTest = true; // updates the shared variable in the LD for proof that its was communicating
digitalWrite (LED_D3, HIGH); // turns on the LED on the front of the Opta
} else { PLCIn.inLedTest = false;
}
}
Replicating this on the PMC is proofing difficult for me. Although there is a pin map for the PMC here there are too many similarities between the pin numbers for them to be used (unless I'm miss-reading it). For the inputs, outputs and programmable I/Os they all go from 00 to either 07 or 12 without a prefix that determines their location or type.
I've tried a lot of variations of different pin numbers, names and variable tags similiar to what you may find/create when setting up the Local IO Mapping, but cant get it to work in any way. I have tested the sketch using some shared variables which acts as a switch on a LD rung with a coil to turn on/off an I/O, but this is a bodge of sorts that I dont accept to be the correct way of doing things.
Can someone tell me what im doing wrong or link the pin map that would have a list of working pinouts?
Also, it appears that all the online examples and tutorials are for code that's uploaded via the Normal IDE and so uses coding with prefix such as "MachineControl_DigitalOutputs.write" and not meant for uploading into the PLC IDE.
Thanks in advance.