Settings Functions


Detailed Description

Use these functions to change communications and platform configuration settings.


Typedefs

typedef enum _wc_baud WC_BAUD
typedef enum _wc_pwm_frequency WC_PWMFREQ

Enumerations

enum  _wc_baud {
  BD_1200, BD_4800, BD_9600, BD_19200,
  BD_38400, BD_57600, BD_115200, BD_230400,
  BD_460800
}
 Baud Rate Values. More...
enum  _wc_pwm_frequency {
  PF_2KHZ, PF_4KHZ, PF_8KHZ, PF_16KHZ,
  PF_32KHZ, PF_64KHZ
}
 PWM frequencies. More...

Functions

NDICMDC_API BOOL NdiCmd_SetBaud (int handle, WC_BAUD baud)
 Set Baud.
NDICMDC_API BOOL NdiCmd_GetBaud (int handle, int *baud)
 Get Baud.
NDICMDC_API void NdiCmd_SetBlueRadio (BOOL enable, BOOL fast)
 Set Blue Radio.
NDICMDC_API void NdiCmd_GetBlueRadio (BOOL *enable, BOOL *fast)
 Get Blue Radio.
NDICMDC_API BOOL NdiCmd_SetI2CAddress (int handle, int addr)
 Set I2C Address.
NDICMDC_API BOOL NdiCmd_GetI2CAddress (int handle, BYTE *addr)
 Get I2C Address.
NDICMDC_API BOOL NdiCmd_SetCommMode (int handle, BOOL slow_comms, BOOL notify, BOOL short_mode)
 Set Comm Mode.
NDICMDC_API BOOL NdiCmd_SetPlatformSpecs (int handle, BOOL polarity, BOOL counter_axis, BYTE wheel_base, BYTE wheel_diameter)
 Set Platform Specs.
NDICMDC_API BOOL NdiCmd_SetMotorMode (int handle, BOOL pwm, BOOL locked_antiphase, BOOL dual_dir_lines, WC_PWMFREQ pwm_frequency)
 Set Motor Mode.
NDICMDC_API BOOL NdiCmd_GetEncoderProperties (int handle, BOOL *quadrature, WORD *ticks_per_rotation)
 Get Encoder Properties.
NDICMDC_API BOOL NdiCmd_SetEncoderProperties (int handle, BOOL quadrature, WORD ticks_per_rotation)
 Set Encoder Properties.


Enumeration Type Documentation

enum _wc_baud

Baud Rate Values.

These values are passed to NdiCmd_SetBaud().

Enumerator:
BD_1200  1200 baud
BD_4800  4800 baud
BD_9600  9600 baud
BD_19200  19200 baud
BD_38400  38400 baud
BD_57600  57600 baud
BD_115200  115200 baud
BD_230400  230400 baud
BD_460800  460800 baud

PWM frequencies.

These values are passed to NdiCmd_SetMotorMode().

Enumerator:
PF_2KHZ  2KHz
PF_4KHZ  4KHz
PF_8KHZ  8KHz
PF_16KHZ  16KHz
PF_32KHZ  32KHz
PF_64KHZ  64KHz


Function Documentation

NDICMDC_API BOOL NdiCmd_GetBaud ( int  handle,
int *  baud 
)

Get Baud.

This function gets the current PC serial port baud rate, which will also be the value it expects the WheelCommander and optional BlueRadios module to be set to.

Parameters:
handle an integer WheelCommander handle
baud integer pointer to the returned baud rate value
Returns:

NDICMDC_API void NdiCmd_GetBlueRadio ( BOOL *  enable,
BOOL *  fast 
)

Get Blue Radio.

This function lets you query the state of BlueRadio handling.

Parameters:
enable a pointer to a BOOL value returning the enable state
fast a pointer to a BOOL value returning the fast data mode
Returns:

NDICMDC_API BOOL NdiCmd_GetEncoderProperties ( int  handle,
BOOL *  quadrature,
WORD *  ticks_per_rotation 
)

Get Encoder Properties.

This allows the user to retrieve the current encoder properties.

Parameters:
handle an integer WheelCommander handle
quadrature a pointer to a boolean having a value of TRUE if the encoder has quadrature outputs, or FALSE if it has sign/magnitude outputs (the default)
ticks_per_rotation a pointer to a 16 bit integer indicating the number of encoder ticks per wheel rotation (128 by default)
Returns:
BOOL

NDICMDC_API BOOL NdiCmd_GetI2CAddress ( int  handle,
BYTE *  addr 
)

Get I2C Address.

This function returns the slave I2C address of the Unicoder encoder.

Parameters:
handle an integer Unicoder handle
addr a pointer to a BYTE, containing the returned slave address
Returns:

NDICMDC_API BOOL NdiCmd_SetBaud ( int  handle,
WC_BAUD  baud 
)

Set Baud.

This function sets the WheelCommander baud rate, the BlueRadio Bluetooth module's baud rate (if enabled), and finally the PC's serial port baud rate, to the specified rate. This change takes place immediately, and is stored in EEPROM on the WheelCommander as well as in the Windows registry on the PC. If BlueRadio support is turned on via NdiCmd_SetBlueRadio(), the baud rate will also be stored in the BlueRadio module's EEPROM.

Parameters:
handle an integer WheelCommander handle
baud integer baud rate value
Returns:

NDICMDC_API void NdiCmd_SetBlueRadio ( BOOL  enable,
BOOL  fast 
)

Set Blue Radio.

This function allows you to change the WheelCommander's BlueRadio settings. You can enable or disable BlueRadio functionality, and optionally turn on fast data mode. NOTE: fast data mode can only be turned off by power cycling the BlueRadio module.

Parameters:
enable a BOOL value to turn on BlueRadio handling
fast a BOOL value to enable fast data mode
Returns:

NDICMDC_API BOOL NdiCmd_SetCommMode ( int  handle,
BOOL  slow_comms,
BOOL  notify,
BOOL  short_mode 
)

Set Comm Mode.

This routine provides a simplified interface to the bit-encoded MODE parameter byte in the WheelCommander. With it, one can change the slow_comms bit (for BasicStamp compatibility), the notify bit (for asynchronous motion completion notification), and the short_mode bit, for enabling shorter return strings (especially useful in I2C mode on an OOPIC). Changes are stored in the WheelCommander's EEPROM, and take place immediately.

Parameters:
handle an integer WheelCommander handle
slow_comms a BOOL set to 1 to insert a 40 millisecond delay between each transmitted character
notify a BOOL set to 1 to delay response to GO until the WheelCommander is at speed or has reached the goal position; 0 by default
short_mode a BOOL, set to 1 to prevent echoing of the command character at the start of the return packet
Returns:

NDICMDC_API BOOL NdiCmd_SetEncoderProperties ( int  handle,
BOOL  quadrature,
WORD  ticks_per_rotation 
)

Set Encoder Properties.

This allows the user to set up the WheelCommander for encoders with specifications other than those of the Nubotics WheelWatcher product line.

Parameters:
handle an integer WheelCommander handle
quadrature a boolean having a value of TRUE if the encoder has quadrature outputs, or FALSE if it has sign/magnitude outputs (the default)
ticks_per_rotation a 16 bit integer indicating the number of encoder ticks per wheel rotation (128 by default)
Returns:
BOOL

NDICMDC_API BOOL NdiCmd_SetI2CAddress ( int  handle,
int  addr 
)

Set I2C Address.

This function allows you to change the WheelCommander's I2C 7 bit address, whether connected via I2C with the PC or not. The value specified is stored in the WheelCommander's EEPROM; changes take place immediately. Recommended values are:

  • 0x10
  • 0x11 ...
  • 0x17 where bits 3-6 contain the recommended device ID of 0010b (2), and the least significant 3 bits contains the slave address (0-7).
    Parameters:
    handle an integer WheelCommander handle
    addr an integer containing the new device ID
    Returns:

NDICMDC_API BOOL NdiCmd_SetMotorMode ( int  handle,
BOOL  pwm,
BOOL  locked_antiphase,
BOOL  dual_dir_lines,
WC_PWMFREQ  pwm_frequency 
)

Set Motor Mode.

This function allows you to enable either servo mode (by setting pwm FALSE), or DC motor mode. In DC motor mode, the locked_antiphase, dual_dir_lines, and pwm_frequency parameters are used to specify how the H bridges should be controlled.

Parameters:
handle an integer WheelCommander handle
pwm a BOOL value, where 1 = TRUE enables DC motor mode
locked_antiphase a BOOL value enables duty-cycle based speed and direction control
dual_dir_lines a BOOL value enables use of D2 and D3 as the inverted values of the DIR lines
pwm_frequency a member of the WC_PWMFREQ enumeration
Returns:

NDICMDC_API BOOL NdiCmd_SetPlatformSpecs ( int  handle,
BOOL  polarity,
BOOL  counter_axis,
BYTE  wheel_base,
BYTE  wheel_diameter 
)

Set Platform Specs.

This simplifies access to other mode bits, as well as other EEPROM values, that deal with configuration of the robot platform.

Parameters:
handle an integer WheelCommander handle
polarity a BOOL, used to control the forward direction of the platform
counter_axis a BOOL, used to enable inverted motion of the two wheels relative to each other
wheel_base a BYTE containing the distance between the centerlines of the wheels in the current distance units
wheel_diameter a BYTE containing the wheel diameter, in the same distance units (multiples of .1" or mm work well)
Returns:


Generated on Mon Mar 2 17:01:02 2009 for Nubotics Device Interface DLL by  doxygen 1.5.5