daves Posted July 5, 2011 Share Posted July 5, 2011 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 Link to comment Share on other sites More sharing options...
curtwilson Posted July 5, 2011 Share Posted July 5, 2011 Dave: 1. Gate1[8].Chan[0].PhaseCapt is the raw count value latched every phase clock cycle, as close to the running counter as the processor can get. This register is at offset $608024 (not $608004) in the I/O space. The chapter on I/O register offsets does show this as offset $024 from the IC base address. A technique you can use to find the address of a register like this without the manual: First, query the (absolute) address of this register -- Gate1[8].Chan[0].PhaseCapt.a Then, query the base address of this space -- Sys.piom Subtract the second value from the first, and you get your offset in I/O space. 2. As a data structure element, it is treated as an unsigned 32-bit value. You can treat it as a signed value by using the pointer definition you have suggested (with the correct address offset, of course), with the "i" instead of "u" format. 3. Yes, you have found the "counter reset" control bit. We have not documented in the manual to date because it is potentially very dangerous when used on a feedback or master encoder. Remember that the AmpEna output bit in the same register must be 0 for the resetting function to work. The name of this single-bit element is "PosClear" (not documented anywhere, so far). This is a "use at your own risk" function; we would prefer you to just use a software offset value for an effective zeroing. Curt Link to comment Share on other sites More sharing options...
daves Posted July 7, 2011 Author Share Posted July 7, 2011 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. Link to comment Share on other sites More sharing options...
Recommended Posts