Jump to content
OMRON Forums

daves

Members
  • Posts

    261
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by daves

  1. The missing or present CPLCs can each be started and stopped at will using UserAlgo.BgCplc[xx]=1/0. They are not running by default on download.
  2. Running September release I still cannot get any of the Character Buffer Functions or String Manipulation Functions to work in my PLCs: open plc 1 strcpy(256, "123") p4 = strtod(256, 0) close These are detailed in "Power PMAC Script Mathematical Feature Specification.pdf", "Power PMAC Command Summary 2011-08.pdf", and "Power PMAC V1-3 Firmware Additions.pdf". I cannot get them to download, and the intellisense has no knowledge of them. What am I doing wrong? Dave
  3. As well as changing the read-only attribute I am finding the IDE fires a save (or something) on all open .pmh files (even if unmodified). They then appear as modified in my source control program. This can easily be updated based on contents, but the file modified date/time has been changed unnecessarily and in my opinion this is bad. If I start looking for files changed on certain dates I will be lost.
  4. Thanks Atul. I didn't mean to make unreasonable requests of the system, I was just excited about the libraries. If you think you can achieve this then this is really good news. I appreciate your help and interest in what would make my (and possibly other people's) development easier. Dave
  5. Thanks for the reply KEJR. This all sounds very interesting to me (coming from a programming background). However my bosses (coming from a real-world engineering background ;)) just want our Turbo PMAC projects up and running on PowerPMAC as soon as possible. The route chosen, for now, has been to keep the existing structure as closely as possible (there is a lot of fiddly synchronization architecture we don't want to refactor yet). This means 'translating' PLCs into PLCs, PLCCs into CPLCs, and my simulated Dual Port RAM communications running as a CApp. I will also be adding the newly planned features (including logging, and on-board data-capture to the file system) as CApps. I am just thinking of 'clever' ways to improve efficiency and coding style as I go through our existing project (and possibly expecting unreasonable features from the IDE). I will try to read up more on xenomai RTOS if I get chance and will probably have some questions for you in the future! Thanks again Dave
  6. Thanks for the replies. This is disappointing. I am sure you can see how useful it would be to have a standard library of functions which can be shared between CApps and CPLCs. The project folder structure hints this is the intention. I will have to continue having my functions in .h files and #including them to each file. Perhaps this should not build or download. The naming here is slightly confusing: 'Background CPLCs' are not run in 'Background Space' like 'Background Programs' but executed by the Real-Time scheduler (I guess something has to schedule them, "Writing C Programs in Power PMAC 2011-01.pdf" starts to explains this). I'll take your word for it and accept that Libraries currently do not work with things in the C Language folder except the Linux apps. I would suggest this would be a useful enhancement for the January release. Thanks for the explanations Dave
  7. This is a complicated combination of things and I'm not sure of the logic but I have managed to recreate with a simple project: * $$$*** * New project * Add CPLCs 20, 21, 24 (empty programs will do) * Add Libraries alib, blib (empty programs will do) * Build and Download All Programs * Open TaskManager CPLC20 is missing. Some interesting points: If you then delete libblib.so from "var/ftp/usrflash/Project/C Language/CPLCs/user" and hit Refresh List, you get CPLC20 but not 21 and 24. If you then delete libalib.so from the same place and refresh, the list is fixed. This is very confusing on a bigger more complicated project and needs fixing. Maybe this is a clue to the other Library issues... Thanks Dave
  8. Two questions about the download Easy to recreate: * $$$*** * New project ISSUE 1 - New to Sept Release * Add CPLCs 1 and 2 (just empty programs will do) * Build and Download All Programs Downloading capp1.out to Power Pmac. Downloading libplcc1.so to Power Pmac. Downloading libplcc2.so to Power Pmac. Downloading libplcc1.so to Power Pmac. Downloading libplcc2.so to Power Pmac. The CPLCs are downloaded twice. They seem to be going to "/var/ftp/usrflash/Project/C Language/CPLCs/user" and "/var/ftp/usrflash/Project/C Language/Libraries". Is this necessary? (Also any of the newly supported libraries seem to go to both places which seems odd to me) ISSUE 2 * Now Exclude CPLC 2 from the project. * Build and Download All Programs All the original (1 and 2) CPLCs are downloaded (again twice). And they appear in the TaskManager. You have to do a Clean or manually remove the .so file from the Bin/Debug. Is this normal VS behaviour, it confused me for a while. Thanks Dave
  9. daves

    EncLoss

    This looks like it is working in the 1.4.0.27 Sep 15 2011 release. Thank you, Dave
  10. A bit of info in case anyone is going to install Delphi XE2 after installing PPMAC IDE. The Delphi XE2 install puts its own bin folder at the start of the PATH environment variable. The latest version includes a MAKE.EXE which then gets used by the PPMAC IDE and fails to build c programs (with not a very useful error message) I have put "C:\Program Files (x86)\Delta Tau Data Systems Inc\2.0\Power PMAC Suite\powerpc-460-linux-gnu\bin" back to the front of my PATH and this fixes PPMAC. I am concerned this fix will now break DXE2 cross-platform stuff but have not investigated... Could the IDE not be tied to its version of make.exe in a better way than being on the path. How can I run multi-development environment systems? Dave
  11. Hi Atul, thanks for responding. Yes, I saw the Modbus example. This example only uses Background C apps as well. I have no problem getting that to work (maybe that was not clear from my original post where I said I "can happily" call that). I am having difficulty in using it in CPLCs, either BgCplcs or RtiCplc. Dave
  12. Thanks Charles. I am at home now (the UK working day has finished). I will send tomorrow.
  13. Hi I have the September release of the IDE and firmware. One of the things I was really looking forward to was the ability to have libraries of functions available to C programs. This is reportedly included in this version, but I am struggling a little. I have the following library under "C Language/Libraries/lib1", h and c files: void DoThing(int Value); #include #include // Global Rt/Gp Shared memory pointers //------------------------------------------------------------- // The following is a projpp created file from the User defines //------------------------------------------------------------- #include "../../Include/pp_proj.h" void DoThing(int Value) { char buffer [50]; sprintf(buffer, "Thing %d", Value); Send(2, buffer); } In a background C app I add #include "../../Libraries/lib1/lib1.h" and then I can happily call DoThing(1); Great. Now in a CPLC I can add the include line and the call to the function. The project builds and downloads with no errors. However I cannot start the CPLC any more (or it immediately bails out with no error status I can see) and it certainly does not execute the library function. Am I doing something wrong? Dave
  14. daves

    Global Struct

    I was thinking about something like this a while back. My experiment worked as far as I took it and may help you... I assume the only 'global' memory you have access to as memory is the 'user shared memory' area. So in "C Language/Include/mystruct.h" I define typedef struct { int A; float B; char C[6]; } MyStruct; Then I can decide to reserve an area of user shared memory for this struct, say from USHM[1000] onwards (the amount depends on the size of your stucture). Then in one C app I have //-------------------------------------------------------------------------------- #include // Global Gp Shared memory pointer //------------------------------------------------------------- // The following is a projpp created file from the User defines //------------------------------------------------------------- #include "../../Include/pp_proj.h" #include "../../Include/mystruct.h" int main(void) { struct timespec mSecSleeper = {0}; // Initialize time structure mSecSleeper.tv_nsec = 1e6; // 1e6 nanoseconds, which equals 1 msec InitLibrary(); MyStruct *mine = (MyStruct *)(&((int *)pushm)[1000]); while (1) { mine->B = 3 * mine->A; mine->C[0] = 0x48; mine->C[1] = 0x65; mine->C[2] = 0x6C; mine->C[3] = 0x6C; mine->C[4] = 0x6F; mine->C[5] = 0x00; nanosleep(&mSecSleeper, NULL); } CloseLibrary(); return 0; } which gets the pointer to my reserved area as a pointer to my structure, then manipulates the data every millisecond. In another C app I have //-------------------------------------------------------------------------------- #include // Global Gp Shared memory pointer //------------------------------------------------------------- // The following is a projpp created file from the User defines //------------------------------------------------------------- #include "../../Include/pp_proj.h" #include "../../Include/mystruct.h" int main(void) { struct timespec mSecSleeper = {0}; // Initialize time structure mSecSleeper.tv_nsec = 1e6; // 1e6 nanoseconds, which equals 1 msec InitLibrary(); MyStruct *mine = (MyStruct *)(&((int *)pushm)[1000]); while (1) { // Input mine->A = pshm->P[0]; // Debug output pshm->P[1] = mine->B; if (pshm->P[1] == 30) Send(2, mine->C); nanosleep(&mSecSleeper, NULL); } CloseLibrary(); return 0; } This allows you to put a number in P0 which then goes into the structure. The other app manipulates the number and this app allows us to view the effect in P1 in a watch. I also output a message to the unsolicited view which is stored in the structure, if P1 equals 30 (set P0 to 10). This shows some of the user shared memory being divided into a structure (I have not really examined byte boundary issues or anything more involved than this). I hope this is useful (and correct). Basically the definition goes in a .h file included where you want to reference it, and the instance of the structure has to reside somewhere in user shared memory so everything can get at it. Obviously you have to remember you have reserved some ushm and not use it again somewhere else. Dave
  15. daves

    Disabling CPLCs

    After a brief vacation and then a lot of investigation I have found that this mechanism does not have quite the same result as the equivalent Turbo code. I think this might be informative to explain and I would like to confirm my approach is safe... In Turbo you could have the following: OPEN PLCC 15 CLEAR WHILE(p5=0) p6=p6+1 ENDW DIS PLCC 15 CLOSE OPEN PLCC 16 CLEAR DIS PLCC 15 DIS PLCC 16 CLOSE Calling 'ena plcc 15' would show p6 incrementing. Calling 'ena plcc 16' would show it no longer incrementing and checking plcc status would show nothing running. In PPMAC // bgcplc15 void user_plcc() { struct timespec mSecSleeper = {0}; mSecSleeper.tv_nsec = 1e6; while (!pshm->P[5]) { pshm->P[6]++; nanosleep(&mSecSleeper, NULL); } SetPmacVar((char *)"UserAlgo.BgCplc[15]", 0); } // bgcplc16 void user_plcc() { SetPmacVar("UserAlgo.BgCplc[15]", 0); SetPmacVar("UserAlgo.BgCplc[16]", 0); } Calling 'UserAlgo.BgCplc[15]=1' shows P6 incrementing, calling 'UserAlgo.BgCplc[16]=1' does not stop incrementing P6. Now I understand why, because the while loop is still running, just the flag that PPMAC should call this procedure again after it returns is not set. (And Turbo used to take the execution pointer out of a program when doing whiles somehow). I realise while loops are dangerous but the structure of the code I am converting relies on the behaviour (more complexly then this example). I have come up with the following but am worried about the effect on the scheduler: // bgcplc15 void user_plcc() { struct timespec mSecSleeper = {0}; double dRunning; mSecSleeper.tv_nsec = 1e6; dRunning = 1; while ((dRunning) && (!pshm->P[5])) { pshm->P[6]++; nanosleep(&mSecSleeper, NULL); GetPmacVar((char *)"UserAlgo.BgCplc[15]", &dRunning); } SetPmacVar((char *)"UserAlgo.BgCplc[15]", 0); } I think this replicates Turbo behaviour enough for me. Does it look acceptable?
  16. daves

    ConfigLoadErr

    I happened to notice the on Global Status page (which I do not have visible all the time) I was getting a ConfigLoadErr. I didn't know when this started or what it meant. The help says this means there is an error loading the user-saved configuration. I don't know exactly what this means. The procedure for finding the exact cause I used was starting from a blank project, build, download, save, quit IDE, cycle power, start IDE, check ConfigLoadErr. Then add in the files from the 'bad' project one by one until the error occurs. Doing this I found my pp_startup.txt was the start of the problem. Then the procedure is remove all lines, add each line back in, reboot as above until the error comes back. Doing this I found "enable plc 1" was causing it so comment out all of PLC1 and uncomment/comment half the code iteratively, reboot as above to identify the offending line. I eventually found the line Motor[0].pEncLoss = Gate1[4].Chan[0].EncLossN.a; which I have enquired about in another post. I would like to request more help in locating such errors. It took me a number of hours to locate one line. Something in the system knows an error occurs as it sets ConfigLoadErr, it must be possible to provide more information on the source of the error?
  17. daves

    EncLoss

    I am having issues with Motor[0].pEncLoss = Gate1[4].Chan[0].EncLossN.a; I think I am following exactly as described in the "Using ACC-24E2S with Power PMAC 2010-08.pdf" and "Power PMAC V1-3 Firmware Additions.pdf" documents. RP22 and RP24 are reversed on both boards correctly. The system starts as Motor[0].pEncLoss=0 Gate1[4].Chan[0].EncLossN.a=$b9e00040 If I execute the command above I am left with Motor[0].pEncLoss=??? What could be wrong? This fails in the terminal and I had this command in a PLC which runs on startup and it created a ConfigLoadErr which took hours to find.
  18. daves

    Disabling CPLCs

    Thanks for these very useful and interesting tips (sorry for the long reply post) I did a timing test and found the pshm->P[MyGlobal] was over twice as fast as GetGlobalVar. I now have to decide if I want to make time to alter my C programs. I know our company has requested access to be provided to the build chain to insert a custom preprocessor executable (we would write) which would allow MyGlobal to be used directly in C code at the writing stage and substituted for pshm->P[] before compilation. This came from 'real-world' engineers who use Turbo and don't like the software engineer syntax of C. If this is likely to come in the July release I'll hold off, otherwise I'll recode the GetGlobalVar calls. I then found http://forums.deltatau.com/showthread.php?tid=378 which agrees with my test. I see from there that GetPtrVar is pretty slow (comparatively) I guess there is no quicker access to these as they could point all over the place? If not, I think I'll have to consider doing manually initiated copies of speed-sensitive Ptr variables (when they change) to Globals similar to a mechanism we used to get dual port ram info into P-variables in Turbo for speed. I have replaced all usleeps with nanosleeps. I have replaced structure access to UserAlgo.BgCplc[] with the recommended SetPmacVar call. This seems to work well. I do however have to change the call to SetPmacVar((char *)"UserAlgo.BgCplc[0]", 0); to avoid warnings being generated which then cause further syntax errors not being reported in the IDE but only in the err.log file as reported in Bugzilla bug 489. Thanks again for the help, progress on my conversion is now going great. Dave
  19. daves

    Disabling CPLCs

    Thanks, this works great. Now I'm having issues with the following code: SetGlobalVar(PLC2RunFlag, 0); pshm->UserAlgo.BgCplc[2] = enum_threadenable; Send(2, (char *)"Waiting for PLCC 2..."); // Hold here until PLC 2 has finished while (!GetGlobalVar(PLC2RunFlag)) { usleep(1); } Send(2, (char *)"PLCC 2 done"); We used to launch one PLCC from another and wait for it to finish. This mechanism no longer seems to work and locks up in the while loop. Would you expect this? Is there a way to launch another CPLC asynchronously and wait on it?
  20. Thanks shansen, I did see those as I posted but didn't get around to editing/addig to the post. I could not get them to work. The download said strtod was illegal (I am definitely running latest released firmware/IDE)
  21. In Turbo we used to have PLCCs which had lines in like DISABLE PLCC 29 DISABLE PLCC 1..30 This could make a PLCC self-disabling or have control over other PLCCs. In PowerPMAC I have guessed the first line is now: Command((char *)"UserAlgo.BgCplc[29]=0"); which seems to work. Is this correct or is there a pshm-> entry for doing this properly? How do I do the second line? BTW: I tried: pshm->UserAlgo.BgCplcActive[2] = 0; pshm->UserAlgo.BgCplc[2] = enum_threadshutdown; The first line did not work. The second crashed the IDE on download "Object reference not set to an instance of an object" Dave
  22. I am grateful you have implemented #define #ifdef #else #endif Firstly I would also like to see #if #elif defined to complete the conditional preprocessing to a C level. In particular I find I want to do things like: #if defined BUFSIZE && BUFSIZE >= 1024 #endif #if RIGNUMBER == 15 || RIGNUMBER == 14 #endif Secondly I would like the conditional directives to work inside the pmh files, for example: #define RIGHALF //#define RIGFULL #ifdef RIGHALF global gFourWheelsTrue = 0; #endif #ifdef RIGFULL global gFourWheelsTrue = 1; #endif This (only) warns of redefinition, i.e both lines are included after preprocessing.
  23. Thanks, this works for my needs. Also I found I started using: #define SHAREDVALUE 42 #ifndef __GNUC__ global ScriptOnlyVariable; #endif to allow non-C stuff in there for script use but in the end I reworked things to not need this, but useful to know anyway maybe.
  24. I see in V1.3 FIRMWARE UPDATES details of string functions on particular strtod looks useful to me. I cannot get it to work or find any examples... Any advice?
  25. Thanks KEJR I will look into using this...
×
×
  • Create New...