Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trouble reading incremental encoder signals
#1
We are currently using our Power PMAC to collect some external data. We are recording 2 digital inputs:

1. Linear quadrature incremental encoder
2. Linear hall effect sensor

and one analog input:

3. Load cell (voltage)

I have set up the linear quadrature encoder as shown in the users manual but I am still not seeing any change in the input (Acc24E2[6].Chan[0].ServoCapt). I am sure the encoder works because we can view the data through the software provided by the manufacturer.

I'm guessing there is an error in my motor setup (since I've never set up a pure slave motor before). I did notice that my motors are both "ClosedLoop" and I have a feeling I want them to be in open-loop mode but could not find a way to set them to open-loop mode. (I tried setting Motor[1].pAdc=0 but that had no effect).

Global Defs
Code:
#define LoadCellSens    1 //Enter Load cell sensitivity in V/lbf

//Gate Setup
Gate1[6].PwmPeriod = 5896;  // Set Max Phase Freq to 10 kHz (MaxPhase Freq. = 117,964.8 kHz / [2*Gate1[i].PwmPeriod+3])
Gate1[6].PhaseClockDiv = 0;  // Set phase clock freq to 10 kHz
Gate1[6].ServoClockDiv = 1;  // Set servo clock freq to 5 kHz (Servo Clock Freq. = Phase Clock Freq. / (Gate1[i].ServoClockDiv +1))
Gate1[6].HardwareClockCtrl = 2258;  // Set Encoder sample clock to 9.83 MHz (default)
Gate1[6].PwmDeadTime = 0;  // Dead time to zero per Copley/Delta Tau app note
Gate1[6].Chan[0].EncCtrl = 3; //Set x4 quadrature deocde CW for Linear Encoder (set 7 for CCW)
Gate1[6].Chan[1].EncCtrl = 11; //Set x6 quadrature decode CW for Hall Sensor (set 15 for CCW)

//Linear Encoder data (as suggested in manual)
EncTable[1].Type = 3;    //Software 1/T extension of count value
EncTable[1].pEnc = Acc24E2[6].Chan[0].ServoCapt.a;
EncTable[1].pEnc1 = Acc24E2[6].Chan[0].TimeBetweenCts.a;
EncTable[1].ScaleFactor = 1/(512);

//Hall Sensor data
EncTable[2].Type = 3;
EncTable[2].pEnc = Acc24E2[6].Chan[1].ServoCapt.a;
EncTable[2].pEnc1 = Acc24E2[6].Chan[1].TimeBetweenCts.a;
EncTable[2].ScaleFactor = 1/(512);

//Load Cell data
EncTable[3].Type = 1;
EncTable[3].pEnc = Acc28E[3].AdcSdata[0].a;  // Point to A-D Channel 1 on Acc28E (J3 pins 1-3)
//EncTable[3].pEnc1 = Sys.pushm;
//EncTable[3].index1 = 16;
//EncTable[3].index2 = 16;
//EncTable[3].index3 = 0;
//EncTable[3].index4 = 0;
EncTable[3].ScaleFactor = 1/(3276.8*2.205/LoadCellSens)  // Scale counts to kg (signed 16 bit register)
//(3276.8 [counts/v])*(2.205 [lb/kg])*(LoadCellSens [V/lb])

//Motor 1 setup (Linear Encoder)
Motor[1].ServoCtrl=1;
Motor[1].PhaseCtrl=0;
Motor[1].pLimits=0;
Motor[1].pEnc = EncTable[1].a;
Motor[1].pEnc2 = EncTable[1].a;
Motor[1].FatalFeLimit = 0; //Prevent disable from over error limit
Motor[1].AbortTa = -1; //Disable auto abort over acceleration

//Motor 1 setup (Hall Sensor)
Motor[2].ServoCtrl=1;
Motor[2].PhaseCtrl=0;
Motor[2].pLimits=0;
Motor[2].pEnc = EncTable[1].a;
Motor[2].pEnc2 = EncTable[1].a;
Motor[2].FatalFeLimit = 0; //Prevent disable from over error limit
Motor[2].AbortTa = -1; //Disable auto abort over acceleration

Program 1
Code:
global end = 0; //set end parameter

open prog 1

//Setup Gather Routine
/****************************************/
Gather.Enable = 0; //Disable Gather

Gather.Type[0] = 1; //Set Gather type signed 32-bit
Gather.Type[1] = 1; //Set Gather type signed 32-bit
Gather.Type[2] = 1; //Set Gather type signed 32-bit
Gather.Type[3] = 1; //Set Gather type signed 32-bit

Gather.Addr[0] = sys.Time.a //Time since last powerup (seconds)
Gather.Addr[1] = Motor[1].ActPos.a //Linear Encoder Position (mm)
Gather.Addr[2] = Motor[2].ActPos.a //Hall Sensor Position (mm)
Gather.Addr[3] = Acc28E[3].AdcSdata[0].a //Load Cell Data (kg)

Gather.Items = 4;
Gather.Period = 1; //Sample every servo cycle (5kHz)

Gather.MaxLines = 100000;
Gather.MaxSamples = 400000;

//Main Loop
/****************************************/
while (end == 0)
{
    while (Acc24E2[6].Chan[0].UserFlag == 1) //Check for high from Copley
    {
        if (Gather.Enable == 0)
        {
            Gather.Enable = 2;
        }
        else{}
    }
    Gather.Enable = 0;
}

close
/****************************************/
Reply
#2
I have only taken a quick look and do not fully understand your application, but I do see motor #2 is referencing the same feedback device as motor #1.
You mention a slave relationship. Generally this is done by using the Master motors actual position in the command reference of the slave motor. DT has a number of options for doing this. Any way you implement the relationship, each motor closes its own loop using its own feedback device. Even in a gantry system where both feedback devices are used for both motors, the servo loop is closed by the device local to that motor; the feedback from the 'matching' motor allows for a weighted combination of absolute position and minimized delta error.
For your basic master/slave relationship take a look at Motor[x].pMasterEnc .MasterCtrl .MasterPosSf .PosSf .Pos2Sf .pAbsPos
In the PPMAC Users Manual, take a look at 'Position Following' under the section titled "Synchronizing Power PMAC to External Events".
Hope I didn't miss the point of your question.
Reply
#3
Monitor the actual hardware register value(s) of the ASIC like Gate1[6].Chan[0].ServoCapt in the IDE Watch window while you move the encoders. The values reported have nothing to do with conversion table or motor setup, so if there is a problem, you have isolated it to the ASIC setup or a signal problem.
Reply
#4
(08-15-2014, 01:53 PM)curtwilson Wrote: Monitor the actual hardware register value(s) of the ASIC like Gate1[6].Chan[0].ServoCapt in the IDE Watch window while you move the encoders. The values reported have nothing to do with conversion table or motor setup, so if there is a problem, you have isolated it to the ASIC setup or a signal problem.

Thanks Curt. I was pretty sure that was the register to be monitoring. I found that our EE (yeah, throw him under the bus!) wired the encoder into the card wrong. I'm getting signal now.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)