How to convert ACR9040 code to MATLAB?

3 views (last 30 days)
Brandon
Brandon on 8 Mar 2022
Edited: Simar on 31 Jan 2024
Hello,
I'm trying to convert code from the Parker ACR9000 Motion Controllers to a code in MATLAB, but I'm not too sure how to go about this. I am currently using the ACR Motion controller to control a printer by connecting the ACR's usb to the computer and using the ACR-View to control and input the code. I understand that I must first connect MATLAB to the motion controller by using a command to connect the USB port that is connect to the motion controller. If anyone has any knowledge to help me with this, it would be creatly appreciated. A sample of the ACR code I'm trying to convert to MATLAB is posted below.
X-110 Y20
DIM LA(2)
DIM LA0(400)
DIM LA1(400)
DIM LV(5)
LV0=0
LV4=400
WHILE (LV0 < LV4)
LA0(LV0)=0
LA1(LV0)=1
LV0= LV0+1
LA0(LV0)=0
LA1(LV0)=0
LV0= LV0+1
WEND
PLS0 SRC P12290
PLS0 RES
PLS0 FLZ 0
PLS0 RATIO 0.001667

Answers (1)

Simar
Simar on 29 Jan 2024
Edited: Simar on 31 Jan 2024
Hi Brandon,
I understand that you are seeking assistance in converting proprietary motion control code, used with Parker ACR9000 Motion Controller, into MATLAB code. To communicate with Parker ACR9000 Motion Controllers from MATLAB, one typically uses the Instrument Control Toolbox, which provides functions for communicating with instruments such as motion controllers, oscilloscopes, signal generators, and more.
Please follow the steps as mentioned below:
1.Install the Instrument Control Toolbox: Check by typing ver in the MATLAB command window to see a list of installed toolboxes in MATLAB. If not present, then install it from get apps.
2.Connect to ACR9000 Motion Controller: Establish a connection to the ACR9000 Motion Controller using the appropriate communication protocol (e.g., USB, serial port, TCP/IP). If using USB, it might be a virtual COM port. Here is an example of how to create a serial port object in MATLAB:
% Replace 'COM3' with the actual COM port the ACR9000 is
connected to
s = serial('COM3', 'BaudRate', 9600, 'Terminator', 'CR/LF');
fopen(s);
3.Send Commands to the Controller: Once connected, send commands to the controller using the fprintf function. Here is an example of how to send a command to move the X and Y axes:
% Send the command to move X and Y axes
fprintf(s, 'X-110 Y20');
4.Convert the ACR Code to MATLAB: Translate the ACR code logic into MATLAB syntax. Code provided seems to initialize some arrays and loop through them. Here is a translation into MATLAB code:
% Initialize arrays
LA0 = zeros(1, 400);
LA1 = ones(1, 400);
% Loop to modify the arrays
LV0 = 0;
LV4 = 400;
while LV0 < LV4
LA0(LV0 + 1) = 0;
LA1(LV0 + 1) = 1;
LV0 = LV0 + 1;
LA0(LV0 + 1) = 0;
LA1(LV0 + 1) = 0;
LV0 = LV0 + 1;
end
% Send other ACR-specific commands
fprintf(s, 'PLS0 SRC P12290');
fprintf(s, 'PLS0 RES');
fprintf(s, 'PLS0 FLZ 0');
fprintf(s, 'PLS0 RATIO 0.001667');
5.Close the Connection: After sending commands, close the connection to the motion controller:
fclose(s);
delete(s);
clear s;
Please note the above code is a basic template and may need to be adjusted based on the specifics of ACR9000 controller, communication protocol in use, and the actual commands supported by controller. Refer to the ACR9000 Motion Controller's programming manual for the exact command syntax and functionality. If issue persists, consider contacting Parker's technical support for assistance.
Please refer to the following links:
  1. Instrument Control Toolbox- https://www.mathworks.com/help/instrument/?s_tid=srchbrcm
  2. ver- https://www.mathworks.com/help/matlab/ref/ver.html?searchHighlight=ver&s_tid=srchtitle_support_results_1_ver
  3. fprintf- https://in.mathworks.com/help/matlab/ref/fprintf.html?searchHighlight=fprintf&s_tid=srchtitle_support_results_1_fprintf
  4. ACR9000 Motion Controller's programming manual- https://www.manualslib.com/products/Parker-Acr9000-3650550.html
  5. Parker Technical Support- https://help.parker.com/us/en/support
Hope it helps !
Best Regards,
Simar

Categories

Find more on Data Import and Analysis in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!