I am struggling with SDK's interface for working with decoders (we always call them 'encoders' in out part of the world ???). The relevant section in the SDK Targetting manual seems quite confusing, and there are no relevant examples that I can find ,where the encoder interface is being used, as opposed to being linked through to a Timer. I am assuming I have to do the following:- 1. Declare a structure of type decoder_sSTate for receiving data from the decoder interface. 2. Open the interface e.g. decFD=open(BSP_DEVICE_NAME_DECODER...) 3. ioctl(? ... Not sure here... There are ioctl commands for reading position, pos change, and revolutions, however the data return format is inconsistent between the 3. There is also a command to read the hold data register. What I don't understand is that the hold data will only contain data transferred from the last read of the position, revolution, and difference counters. Also, I don't know which switch matrix mode to specify - presumably it doesn't matter as I am not using the (en) decoder with the associated timer ? Can somebody provide example code ? Thanks, Ian Duncan |
|
SDK Quadrature Decoder usage.
Started by ●June 18, 2003
Reply by ●June 21, 20032003-06-21
SDK includes many peripheral applications (source codes). You can find some quadrature decoder applications in SDK ...motorola\embeddedSDK\DSP56F805\scr\application directory. Charlie --- cmafatcontroller <> wrote: > I am struggling with SDK's interface for working > with decoders (we > always call them 'encoders' in out part of the world > ???). The > relevant section in the SDK Targetting manual seems > quite confusing, > and there are no relevant examples that I can find > ,where the encoder > interface is being used, as opposed to being linked > through to a > Timer. > > I am assuming I have to do the following:- > > 1. Declare a structure of type decoder_sSTate for > receiving data from > the decoder interface. > 2. Open the interface e.g. > decFD=open(BSP_DEVICE_NAME_DECODER...) > 3. ioctl(? ... Not sure here... > > There are ioctl commands for reading position, pos > change, and > revolutions, however the data return format is > inconsistent between > the 3. There is also a command to read the hold data > register. What I > don't understand is that the hold data will only > contain data > transferred from the last read of the position, > revolution, and > difference counters. Also, I don't know which switch > matrix mode to > specify - presumably it doesn't matter as I am not > using the (en) > decoder with the associated timer ? > > Can somebody provide example code ? > > Thanks, > > Ian Duncan > __________________________________ |