PDA

View Full Version : iospod newbie: quadrature decoders?


slow
06-07-04, 12:09 PM
I am confused on how to use the ISOPOD quadrature decoders. My understanding is that the DSP56F805 has two built in high performance quadrature decoders. My application requires three quadrature decoders. My hope is to use the the two hardware decoders and implement a third decoder in software.

In the TMR_QUAD_32 bit example on the 'Pod download page I see six channels of quadrature decoders. TEST displays two counters for channels A and B and one for C and D. It looks like A is channel 0 and 1, B is 2 and 3, C is the first channel 4, and D is the second channel 4.

1) Are channels A and B the hardware quadrature decoders?
How do I use these? Can I just run INIT and then read counters?
Can I simply set counters if I want to initialize them to a particular value?

2) Are channels C and D quadrature decoders? Are the inputs simply TMRC0/1 and TMRD0/1 on the J6 connector? Are these implemented in software? What is the performance of these decoders?

I appreciate any help or advice or example code that you can give me.

Thank you kindly,

slow

Dave
06-07-04, 02:45 PM
1) Yes, TA0 and TA1 correspond to the hardware A and B inputs for the hardware quadrature inputs, they are also labeled as PHASEA0 and PHASEB0. TMRB0 (PHASEA1) and TMRB1 (PHASEB1) pins are the A and B inputs for the second hardware quadrature decoder. And yes, INIT zeros the counters, that can be then read by fetching the memory locations as shown later in the example :

E47 2@ D. ( while in HEX, for PHASE 0
E57 2@ D. ( for PHASE 1

2) Any pair of timers can be configured as inputs for Quadrature decoding, it's the TA0 & 1 and TB0 & 1 that are preconfigured as such. Using TC0 and TC1 as the pair to read a quadrature input is shown in the TMR_QUAD_32 example shows up as the QUAD CH 4. The example is taking the hardware decoders of Channel 0 as the initial pair, then the next pair of timers normally reserved for the HOME and INDEX of channel 0 for the next quadrature encoder, then the hardware for for Channel 1 to be a third pair input, then the channel 1 HOME and INDEX to be a forth pair. This continues with the TMRC pins. It is primarily a hardware configuration issue, setting the registers for quadrature reading, then reading the memory locations for current count. If your application does not need the HOME and INDEX inputs from the quadrature encoder, then things can be configured similarly to the example. If they are needed, then perhaps diffrerent configurations according to the DSP56F80x User Manula can be used and the third channel with A, B, INDEX and HOME can be configured on TC0, TC1, TD0, and TC1.
The Users manual (large download) http://e-www.motorola.com/files/dsp/doc/user_guide/DSP56F801-7UM.pdf has the appropriate hardware set up, and perhaps can be correlated to the initial commments shown on the TMR_QUAD_32 example. On page 116 of the PDF, it shows the Timer A0 base to read for getting a current count. Additional quadrature readings can be taken as shown in th TEST word of the example. I believe the performance of all the timers is such that they can read 5 million counts per second in a quadrature decoding method