A quandary has come up.  I have added some new features to my PPMC
encoder board firmware.  Velocity estimation via encoder timestamp was easy,
just enable the feature as on the UPC.  But, I also added a way to vary
the encoder digital filter clock, giving 4 possible clock rates.  There are
no available switches on the existing board to make the setting.

There is a method already in the driver to enable a feature on a
particular board by giving a feature name and a board address.
So, you add something like "timestamp=0x12" which means
enable the encoder timestamp feature on parallel port
1 and board address 2.  Now, I need to add an additional
parameter to this, not just turning the feature on on a specific
board.   I COULD use the upper two bits of the byte
to give the setting, so the byte becomes
VVPPSSSS where VV is the value, PP is the parallel port number,
and SSSS is the board address.  This seems a bit messy, but I know
it will work.

Does anybody have an idea for a cleaner way to handle this?
The code is scattered around in src/hal/drivers/ppmc.c,
but the code that senses the settings looks like this:
            if ( timestamp[n] == bus_slot_code ) {

where bus_slot_code is an int with the 00PPSSSS combination
for the board that is currently being setup.  Timestamp is
declared like this :
RTAPI_MP_ARRAY_INT(timestamp, MAX_BUS*8, "bus/slot locations of 
timestamped encoders");

(Part of the reason for the convoluted arrangement is so that setup-time
parameters like this are written once to the board and don't have to
be written EVERY servo cycle.)

So, any suggestions of what is the most logical way to specify this
setting from the command line and how to read it in the driver
would be greatly appreciated.

Thanks,

Jon

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to