Jump to content
OMRON Forums

daves

Members
  • Posts

    261
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by daves

  1. The following line in a motion program reports no errors in the IDE but will not download:

     

    Motor[1].HomeVel = -Motor[1].HomeVel;
    

     

    Is there something wrong with this syntactically?

     

    The error message is (unhelpfully) "Error : ( error #31) invalid parameter number in equation".

     

    The following similar lines work (the last one being how I get around the error):

     

    Motor[1].HomeVel = -100;
    Motor[1].HomeVel = -GlobalVar;
    Motor[1].HomeVel = -(Motor[1].HomeVel);
    

  2. A quick question concerning something new I was taught off topic from another post.

     

    I like the concept of initialising global variables in my pmh file:

     

    global ThisIsOK = 100;
    global ThisIsImpossible(6) = (2,4,6,8,10,12);
    
    global ThisWorks(6);
    ThisWorks(0)=5;
    

     

    The first line is good.

    I cannot guess the syntax to make the second line work (does it exist? could it be included next release?)

    The last two lines will do the kind of thing I want but give me red squiggly line language service errors.

  3. Thanks for the information. I will have to try one of your suggestions and work out which status I want.

     

    (I am currently converting a Turbo UMAC project to PowerPMAC, and my background is software development rather than motion control, so a lot of my questions are hoping to find the direct conversion until I am more familiar with the whole system)

     

  4. Thanks for the reply. I am familiar with the ideas shown in the example program. I notice it does use a #define constant but then only accesses that from script. I have come to the conclusion that at the moment I wall share constants between script and C using variables.

     

    The example does not show any conditional compilation and only uses one pmh file.

     

    I would still be interested to know about the defined order of pmh inclusion, and the likelihood of #defines spanning script/C in the future for example to control which blocks of code are compiled.

     

    Dave

  5. Hi Curt

     

    Thanks for your reply. I understand the mechanism of global and ptr variables from script/C (although the MyIntConstant->i.user:$10C = 42 initialising of the variable was new to me and looks useful).

     

    For the last part of my second post, I was hoping for some true notion of a constant.

     

    Your workaround of using a variable to hold a value and read it from script/C does handle the requirement in a practical way. I guess I was coming more from the direction of a software engineer and didn't like the expense of using a variable (a #define would be substituted straight in the code) and the insecurity that any process can modify this variable (the #define would be unchangeable).

     

    I am happy to use variables to hold constants that must be shared between script and C.

     

    I am still hoping for some insight into the workings of the conditional compilation possibilities...

     

    Dave

  6. In UMAC I looked at bit 0 in the coordinate system status word to get the Program Running flag:

     

    coordSysStatus->X:$002040,0,16

    programRunning->X:$002040,0,1

     

    This address doesn't translate in the TP2PP program.

     

    1: I found the Coord[1].ProgRunning parameter in the manual. Is this the new thing to look at and is it exactly the same?

     

    2: Or should it be Coord[1].ProgActive? (Turbo talks of executing, not running/active)

     

    3: Or should it be bit 16 in Coord[1].Status[0] labelled as TimerEnabled?

     

    4: If it is one of the first two then how do I get that in a C program? They are not part of the pshm->Coord[] structure... Why?

     

    Thanks

    Dave

  7. How do I use the 'Libraries' folder under 'C Language'?

     

    I have chosen 'Add->Existing Item...' and the closest choice to a "C" library I guessed was 'Background C Source'. I removed the includes and main function as I guessed they were unnecessary background app stuff. I added one of my desired library functions.

     

    Building fails with:

     

    C:\ABD\PowerPMAC\SPMM\Centre\Centre\Centre.ppproj(146,5): Error : /usr/local/bin/../lib/gcc/powerpc-405-linux-gnu/4.2.2/../../../../powerpc-405-linux-gnu/bin/ld: cannot open output file ../../../Bin/Debug/: No such file or directory
    C:\ABD\PowerPMAC\SPMM\Centre\Centre\Centre.ppproj(146,5): Error : collect2: ld returned 1 exit status
    

     

    I see the make file difference between a working C app and this library is the missing PROG definition:

     

    PROG = "../../../Bin/Debug/"
    

     

    Normally there would be a xxx.out filename in there. Is this a clue?

     

    Dave

  8. Excellent, thanks for all those tips. I have my encoders working nicely now. Sorry I missed the register address manual. I only use the encoder zeroing (carefully) on purely measurement encoders (i.e. not motors) and my front end software relies on this mechanism for UMAC and I want PPMAC to require few(ish) changes to that software.
  9. We have an ACC24E2S card and connect a general purpose draw-wire encoder to give us some position readings.

     

    In Turbo PMAC the card was set up as follows:

     

    Base Address: Y:$079200 [ON-ON-OFF-ON-ON-ON]

    I7410=7

    Encoder9->X:$079201,0,24,s

     

    This gave us simple access to x4 quadrature decode of the first channel on the card.

     

    I'm trying to get the same access to the counts on PowerPMAC. I have done the following:

     

    Base Address: $608000 [ON-ON-OFF-ON-ON-ON]

    Gate1[8].Chan[0].EncCtrl = 7;

    ptr Encoder9->i.io:$608004.0.32;

     

    I have tried various combinations of bits to look at at that address but the only value I seem to get is some sort of strange velocity or delta numbers, not the counts.

     

    Questions

     

    1: I found looking at Gate1[8].Chan[0].PhaseCapt I think I get the counts I want, almost. Please can you confirm this is where I should be looking?

     

    2: If it is, it is unsigned so do I have to manipulate the value myself to allow signing of the result? or is there a way to get it signed?

     

    3: Also I use "zeroEnc9->X:$079205,10,1" in Turbo to perform a zeroing of the encoder. I found "ptr zeroEnc9->u.io:$608034.18.1;" works in PowerPMAC but I cannot find the documentation. Is this the correct way to zero the counts? Is there access to it in a structure?

     

    Cheers

    Dave

     

     

     

  10. With further investigation I find that no #defines make it out of the script area into the C area, making them not 'Global' enough for me.

     

    I have worked around that issue with

     

    #define FOO
    global FOO;
    

     

    in a file named 'aa defs.pmh'. The first line makes #ifdef blocks work in the script code. The second line fools #ifdef blocks in the C code to work (at the expense of a variable).

     

    This will not help when I need

     

    #define IMPORTANTCONSTANT 42

     

    to work at some point. Could you implement, or is there a way to get truly global (hard-coded) parameters/conditions like these in script and C?

     

    Cheers, Dave

  11. I have a number of organised pmh include files. It seems there is possibly some single-pass issue when they are processed relating to conditionals. Here is a condensed example:

     

    If I have "global definitions.pmh"

     

    #ifdef FOO
    global Bar;
    #endif
    

     

    and "more definitions.pmh"

     

    #define FOO
    

     

    I get errors referencing Bar in script or C code. If I rename the second file "another.pmh" it is fine.

     

    I am guessing there is an alphabetical order to the files. Can you confirm? Also is it possible to fix the next release so this is not an issue?

     

    Thanks, Dave

×
×
  • Create New...