Jump to content
OMRON Forums

tweekzilla

Members
  • Posts

    38
  • Joined

  • Last visited

Posts posted by tweekzilla

  1. Hi,

     

    I'm trying to extract the coordinate system parameter ProgRunning from a C program. I almost get it to work with the following code, except that the enum returned is either 0 or 1 - It does not for example return 2 if I engage a limit switch

     

    I've posted the enum definition here for clarity:

     

    enum progstatus {PROG_RUNNING, PROG_STOP_ON_PAUSE_STEP, PROG_STOP_ON_LIMIT, PROG_STOP_ON_BKPT, PROG_STOP_CODE_ERR, PROG_STOP_STACK_ERR,

    PROG_STOP_LVAR_STACK_ERR, PROG_STOP_CALL_ERR, PROG_STOP_AXIS_ASSIGN_ERR, PROG_STOP_KINEMATICS_ERR, PROG_NOT_IN_USE = 16};

     

    And my code:

     

    #include // Global Gp Shared memory pointer

    #include "../../Include/pp_proj.h"

    #include

     

    static volatile GateArray3 *TickGate3IC; //ASIC structure pointer

     

    int main(void)

    {

    enum progstatus pp;

    int coor_status;

    InitLibrary();

    pp = CoordStatus(1);

    printf("%d\n", (int)pp);

    CloseLibrary();

     

    return -1;

    }

  2. Hi All,

     

    If I edit motion control program on the pmac (/var/ftp/userflash/Project/PMAC..../Motion.../proc2.pmc) and then run the program from the webgui - (&1b2r) it doesn't seem to reflect any of the edits I made to the file. Do I need to somehow reload/compile the programs after editing them?

  3. Reading the manual I don't think this is possible but I would like to be able to read the Pfm value that is pointed to by Motor[x].pDac - i.e. I don't want to have to keep a record of which motor is pointed to which hardware channel (hence the pointer in the first place).

     

    If I try and read the value via:

     

    int *temp;

    temp = pshm->Motor[1].pDac;

    printf("%i", *temp);

     

    My code just quits - no error no nothing. The problem is when you try and get the value from temp - i.e the printf statement. Reading the Pfm directly from the channel works fine.

     

    Is it possible to do this or would I need to keep a separate lookup for my C programs between motors and channels

  4. I just started to use the digital amplifier board for pulse and direction. There was no signal being produced on on the D output (with the usual setting for pulse and direction output). I then went to the PMAC system setup and Enabled the output on Acc24E3[0].Chan[0] and moved the PWM sliders around. There was no output as seen on an oscilloscope for either top/bottom A-D. The only output that appeared to be working was the PHACLK, ADCCLK and ADCSTB.

     

    Am I missing something obvious or is this a sign of a broken board?

  5. Some more information - Our current setup uses a 300hz Xenomai thread to log pmac variables into a posix message queue. A 10hz Xenomai thread then sends that data over the network and receives new position information from the control computer. The idea is that this thread then puts the new positions into the Rotary Buffer - the whole transaction is psudo deterministic with error checking etc. This gets really ugly if we have to open a telnet session in a xeonmai thread, log in, run gpascii and set things up. Ideally would be able to append the new positions directly from the C-code as they come in to the memory location of the next buffer command.

     

    An alternative would be if we could connect to a port on the PMACSERVER and send commands that way. This would be somewhat cleaner from a C-thread.

  6. Just to update on this - The following works fine (along with an expected lag due to the lookahead), unless you make P12=P13 then it will get stuck in a loop - i.e. setting P12 != P13 after setting P12=P13 does not execute the move. You also cannot exit the loop by setting P10 = 0. Maybe this is expected?

     

    open prog 3
    dwell 0
    EncTable[3].type = 10; //setup for trigger;
    EncTable[3].pEnc1 = Acc24E3[1].Chan[2].Status.a; //point to arming flag
    linear;
    X0 F180;
    while(P10 != 0) {
    X(P12) F100;
    x(P13) F50;
    }
    X1000 F100;
    close
    

  7. I'd like to be able to pass new position (and feed-rates) to a motion control program via P variables - The code below does indeed see the P-variables at startup but does not recheck the values whilst running. Is it possible to do the following?

     

    open prog 3
    dwell 0
    EncTable[3].type = 10; //setup for trigger;
    EncTable[3].pEnc1 = Acc24E3[1].Chan[2].Status.a; //point to arming flag
    linear;
    X0 F180;
    while(P0 != 0) {
           X(P1) F100;
           }
    X1000 F100;
    close
    

  8. I have a TCP server that currently transmits various status/Positions etc on a deterministic basis (xenomai user-space task) to a python client. I would like to be able to use the same socket to transmit from the python client to the PMAC updated positions in a rotary buffer.

     

    Is there a way in a C program to add commands to the Rotary buffer?

  9. As an update I can confirm that the following works ok but as soon as you try and address the P variable the ISR hangs

     

    void CaptCompISR (void)
    {
    volatile GateArray3 *TickGate3IC; //ASIC structure pointer
    int *CaptCounter; //Logs number of ticks
    int *CaptPosStore; //Storage pointer
    
    TickGate3IC = GetGate3MemPtr(1); //Pointer to IC base
    CaptCounter = (int *)pushm + 0; // Sys.Idata[0] 
    CaptPosStore = (int *)pushm + 1;
    (*CaptCounter)++; //Increment Counter
    *CaptPosStore = TickGate3IC->Chan[2].HomeCapt;
    //pshm->P[1]++; //This is the thing that crashes!!!
    TickGate3IC->IntCtrl = 0x04; //Clear interrupt
    }
    

  10. Hi,

     

    Yes I can confirm that I have the prototype in the header file and that the usrcode.c is set to compile. (usrcode.h is set to Content but I think that's correct).

     

    I can also confirm that the ISR does indeed work if you are not writing to a variable. I can also clear the PosCapt flag with a TickGate3IC->Chan[2].HomeCapt without the PMAC freezing

     

    I'm checking the equ status, however, I'm assuming the ISR should not interrupt unless the relevant bit in IntCtrl (23-16) are set.

  11. I've taken the example of the Capture Interrupt Routine from the manual in order to try and capture the encoder count on a channel that is being used as the external time-base. The idea is to latch the encoder count on an accurate tick. I'm using the USER flag input on Chan[2] of an ACC24E3[1].

    I have tested that the external time-base and triggering work as expected - the problem is that whenever I enable the ISR and send the tick the PMAC CPU locks up.

     

    The code is shown below and is almost the same as the manual. I also set Acc24E3[1].IntCtrl = $40000 //Chan[2].PosCapt

     

    void CaptCompISR (void)
    {
    volatile GateArray3 *TickGate3IC; //ASIC structure pointer
    int *CaptCounter; //Logs number of ticks
    int *CaptPosStore; //Storage pointer
    
    TickGate3IC = GetGate3MemPtr(1); //Pointer to IC base
    CaptCounter = (int *)pushm + 65535; // Sys.Idata[65535]
    CaptPosStore = (int *)pushm + *CaptCounter + 65536;
    *CaptPosStore = TickGate3IC->Chan[2].HomeCapt; //Store position
    (*CaptCounter)++; //Increment Counter
    TickGate3IC->IntCtrl = 0x04; //Clear interrupt
    }
    

     

    Note that I am setting the tick by a simple switch that is pressed - I mention this incase there is a bounce issue.

  12. Thanks - I got it working (almost) - The signal was placed on the SIN input and the following register set: Acc24E3[1].Chan[2].EncCtrl = 13

     

    1) It would not count using a TTL/CMOS square wave - I suspect the 220 Ohm termination packs may have something to do with this but I need to think about that - I possibly need a driver before the PMAC.

    2) Using a standard 50 Ohm output on a function generator (1Vpp square wave) worked fine.

     

    I also wanted to clarify the serial encoder settings as the manual differs to your suggested settings - Can I confirm that if you wanted to use the serial encoder input as a supplemental quadrature encoder then as per the manual

     

    gate.SerialEncCtrl = 0

    gate.chan[j].SerialEncEna = 1 //difference here

  13. You need to follow these steps in a PLC with proper flag control, but the main idea is the same:

     

    1. Since you're using sinusoidal encoder on ACC-24E3, set Motor[x].EncType = 6. This will setup all of the following parameters to proper values required for sinusoidal encoder on ACC-24E3: AmpEnableBit, AmpFaultBit, CaptFlagBit, CaptPosLeftShift, CaptPosRightShift, CaptPosRound, LimitBits

     

    (This is assuming you have a limit flag. If you want to reference to hard stop follow the steps 2, *3*, 4* and 5* instead)

     

    (Actual Over-travel Limit Flag)

    2. Disable the limits by setting Motor[x].pLimits=0 and Motor[x].CaptureMode=0.

    3. Setup ACC24E3.Chan[j].CaptCtrl and ACC24E3.Chan[j].CaptFlagChan accordingly to capture based upon the limit flag input.

    4. Adjust the home velocity with proper direction toward the hardware over-travel limit and issue a home command and wait until homing is complete to the limit.

    5. Move out of the limit and re-enable the flags by setting Motor[x].pLimits to proper address.

     

    (Referencing to hard-stop)

    2*. Set Motor[x].CaptureMode=2. This will allow the motor position to be captured as home position if the following error exceeds the Motor[x].WarnFeLimit.

    3*. Adjust the home velocity with proper direction toward the hard-stop and issue a home command and wait until homing is completed.

    4*. Move out of the hard-stop.

     

    (Common: homing to index pulse)

    6. Set Motor[x].CaptureMode=0.

    7. Setup ACC24E3.Chan[j].CaptCtrl and ACC24E3.Chan[j].CaptFlagChan accordingly to capture based upon the index pulse.

    8. Adjust the home velocity with proper direction toward the first index into the work space and out of the limit.

    9. Issue a home command and wait until homing is completed.

     

    Thanks Sina,

     

    Sorry for the slow response but I manged to get the above to work fine

  14. The analog (sinusoidal) encoder card can take 5V digital signals and process them properly.

     

    Thanks Curt - I now know it's possible!

     

    I've been trying to setup the pulse counter by inputting it into SENCDAT+- and trying to use it as a quadrature encoder (30khz 50% duty cycle)- The following have been set but I do not see ACC24E3[1].Chan[2].ServoCapt increasing.

     

    //setup pulse on Chan[2] for external timebase

    ACC24E3[1].SerialEncCtrl = 0; //Quadrature interface

    ACC24E3[1].Chan[2].EncCtrl = 0;

    Acc24E3[1].Chan[2].TimerMode = 0;

    ACC24E3[1].Chan[2].SerialEncCmd = 0;

    Acc24E3[1].Chan[2].SerialEncEna = 1;

     

    //External timebase setup

    EncTable[3].type=1; //Single-register read conversion

    EncTable[3].pEnc = Acc24E3[1].Chan[2].ServoCapt.a; //Combind pos reg

    EncTable[3].index1 = 0; //No left shift

    EncTable[3].index2 = 0; //No right shift

    EncTable[3].index3=0;

    EncTable[3].MaxDelta=0;

    EncTable[3].ScaleFactor = 1/(256*30) //for 1ms timebase

     

    I'm not even sure you can input a single pulse in the quadrature encoder for it to start counting incrementally. Also the manual hinted that you should be able to do this through the SIN/COS inputs but I have not worked that out yet.

  15. I noticed a post where DT was thinking of adding RTnet to the xenomai kernel. This would be very interesting for our project and I was wondering what the status of this was?

     

    Cheers

     

    Ross

  16. Hi All,

     

    I'm driving a stepper motor using a linear encoder as the feedback for the position. I would like to setup a deadband of say 0.3 mu from the Position error. This works fine using Kbreak and BreakPosErr so long as I don't have the integral term enabled. However to get the following error I need I do need to have a small integral term.

     

    I looked into using OutDbon and OutDboff but they are only valid when the DesVelZero is True and with the integral term on that value switches from false to true.

     

    Is there a way to use the integral term when moving and then setup the deadband such that Ki is disabled inside of 0.3mu?

     

    Cheers,

     

    Ross

×
×
  • Create New...