Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PrevEnc and Index4

I have to report the position of a single encoder through a motor structure without InPos and DacLimit problems due to absence of feedback signal. So I was trying to create a second reference signal (Apart from DesPos signal) to input an EncTable structure pointed to the single encoder (without motor). So I was performing some tests with virtual motors modifications to attempt this second reference signals by the following snippets of code:

EncTable[31].type=1 // 32-bit register read
EncTable[31].pEnc=Sys.Idata[9].a // Same as Motor[5].pDac
EncTable[31].pEnc1=Sys.pushm // Dummy read (not used)
EncTable[31].index1=0 // No shift right of source data
EncTable[31].index2=0 // No shift left of source data
EncTable[31].index3=0 // No accel limiting
EncTable[31].index4=1 // Single integration
EncTable[31].PrevDelta=0 // No bias before integration
EncTable[31].MaxDelta=0 // No velocity limit
EncTable[31].ScaleFactor=1/65536 // 32 bits -> 16 bits

EncTable[32].type=9 // 32-bit register read
EncTable[32].pEnc=EncTable[31].PrevEnc.a // Same as Motor[5].pDac
EncTable[32].pEnc1=Sys.Idata[10].a // Same as Motor[5].pDac
EncTable[32].index1=0 // No shift right of source data
EncTable[32].index2=0 // No shift left of source data
EncTable[32].index3=0 // No accel limiting
EncTable[32].index4=0 // Single integration
EncTable[32].MaxDelta=0 // No velocity limit
EncTable[32].ScaleFactor=1 // 32 bits -> 16 bits


When I set


I would expect that the motor 9 position start running to infinite since Index4 of EncTable[31] is 1 and so it perform a single integration. When I set


The motor 9 position behave as I expect (incrementing due to integration).

I suppose that PrevEnc ignore the integration (as it does with ScaleFactor) but I just find this behaviour with ScaleFactor on software manual.

I would like to know if my hypothesis is correct.

Forum Jump:

Users browsing this thread: 1 Guest(s)