Jump to content
OMRON Forums

Adding M-codes to existing project


Recommended Posts

I'm not a controls programmer, just someone who knows a little programming and am in charge of adding some functionality to a home-built system.


Base machines with Delta Tau controllers have a base project. Different shops have added various tech to them and so base control project can't be the one used on our own franken-machine. We have a guy who had done a lot of the controls programming but isn't always available to help so I'm going to risk being the oblivious annoying newbie on here and reach out to some experts as well.


We have a camera lens cover, pneumatics/solenoid all in place. Not sure which Acc65E data reg. output it is associated with, but not quite my problem (yet). My progress with help so far: (1) I made a backup TAR of the current machine, unzipped it with WinRAR, grabbed out the C Language -> CPLCs, PMAC Script Language, and Configuration folders and overwrote the generic project folders with those. (2) I opened this ppproj (actually the solution file) on the machine (because we don't have a separate development station), and added the m-codes to the custom m-code file, and the new ptr variables to potential data registry bits. (3) I did a "build" and everything was successful. We /are/ working in IDE on these machines and unless it is completely safe to upgrade, I won't be rocking any more boats than necessary.


ASSUMING I've got the code right, and found the right output (highly unlikely, the team and I will cross that bridge later because it's not in the wiring diagram), what's my next step? The current manuals are for version 4+ so not sure how to download the program to the controller to test the new m-codes.


Sample code -


// ---------- trial m-codes for lens cover - on



dwell 0;

Out_Spare_4-6 = 1;

dwell 5000;




// ---------- trial m-codes for lens cover - off



dwell 0;

Out_Spare_4-6 = 0;

dwell 5000;






// Outputs Card 2

Ptr OUT2_Byte0 ->Acc65E[5].DataReg[3];

Ptr OUT2_Byte1 ->Acc65E[5].DataReg[4];

Ptr OUT2_Byte2 ->Acc65E[5].DataReg[5];




ptr Out_SupportDown ->Acc65E[5].DataReg[4].0;

ptr Out_SupportLock ->Acc65E[5].DataReg[4].1;

ptr Out_WorkLight ->Acc65E[5].DataReg[4].2;

ptr Out_DoorLock ->Acc65E[5].DataReg[4].3;

ptr Out_CrashDetectEnable ->Acc65E[5].DataReg[4].4;

ptr Out_TE_Flush ->Acc65E[5].DataReg[4].5;

ptr Out_Spare_4-6 ->Acc65E[5].DataReg[4].6; // <-- lens cover trial

ptr Out_Spare_4-7 ->Acc65E[5].DataReg[4].7;

Link to comment
Share on other sites

  • 3 weeks later...

It sounds like you've made a backup of the current machine using our "Backup Restore tool". You could also use the "Device Imaging" tool to make a full backup of your PMAC's flash memory (which includes the project).

To recover the project from PMAC, you should be able to navigate to "File" -> "Upload Project from Power PMAC" and avoid messing with a tar file.

For a software manual matching your IDE version, navigate to "Help" -> "Power PMAC IDE Manual". The short answer is add the pointers to a header file within "PMAC Script Language" -> "Global Includes". Right click the project/solution name to build and download all (or just download).

If the changes don't work you can revert back with "$$$", if they do you can issue "save" to keep them on the PMAC. Make sure you have a good backup before issuing save.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...