Omron Forums Support Posted August 17, 2015 Share Posted August 17, 2015 Edit: removed my original code because it was incorrect. Here is the code you can use to read Coord[x].ProgActive, ProgRunning, and ProgProceeding in C: int ProgIsRunning(unsigned int n) { if ((pshm->Coord[n].Ldata.Status & 0x2E) == 0x20) return 1; else return 0; } int ProgIsActive(unsigned int n) { if ((pshm->Coord[n].Ldata.Status & 0x20) == 0x20) return 1; else return 0; } int ProgIsProceeding(unsigned int n) { if (((pshm->Coord[n].Ldata.Status & 0x2E) == 0x20) && (pshm->Coord[n].FeedHold != 1)) return 1; else return 0; } Link to comment Share on other sites More sharing options...
KEJR Posted September 8, 2015 Share Posted September 8, 2015 Hello, Charles and I worked on this one and identified some issues. We got the proper code as used in the firmware and it should be like this. I gave the routines names such that they can be used in C conditional statements nicely. double ProgIsRunning() { if ((Coord[n].Ldata.Status & 0x2e) == 0x20) return 1; else return 0; } double ProgIsActive() { if ((Coord[n].Ldata.Status & 0x20) == 0x20) return 1; else return 0; } double ProgIsProceeding() { if (((Coord[n].Ldata.Status & 0x2e) == 0x20) && (Coord[n].FeedHold != 1)) return 1; else return 0; } ex usage: //sleep for 1ms intervals until motion prog is done. while(ProgIsRunning()) MySleepSeconds(0.001); Link to comment Share on other sites More sharing options...
KEJR Posted September 8, 2015 Share Posted September 8, 2015 BTW, I used double type return because that is what many of the PPMAC variables are. replace with int if you like (or bool if you have C++). KEJR Link to comment Share on other sites More sharing options...
Recommended Posts