13. Orangutan SVP Functions

This section of the library provides commands that are only available on the Orangutan SVP.

For a higher level overview of how the library works on the Orangutan SVP, please see Section 3.j of the Pololu AVR C/C++ Library User’s Guide.

Reference

C++ and Arduino methods are shown in red.

C functions are shown in green.

static void OrangutanSVP::setMode(unsigned char mode)

void svp_set_mode(unsigned char mode)

This command sets the mode of the Orangutan SVP’s auxiliary processor. The mode parameter determines the functions of the auxiliary lines A, B, C, and D.

  • If mode is SVP_MODE_RX, then lines A, B, and C will be analog inputs (Section 2) and D/RX will be used as the serial receive line. TTL-level serial bytes received on D/RX will be sent to the computer on the Pololu Orangutan SVP TTL Serial Port. The D/RX line, along with the TX line (which is always the serial transmit line), let you use the Orangutan as a two-way USB-to-serial adapter. This is the default mode; the auxiliary processor will be in this mode whenever it starts running, and will revert to this mode whenever the AVR is reset for any reason.
  • If mode is SVP_MODE_ANALOG, then lines A, B, C, and D will be analog inputs.
  • If mode is SVP_MODE_ENCODERS, then lines A and B together are inputs for a quadrature encoder (called encoder AB), and lines C and D together are inputs for a quadrature encoder (called encoder CD). The functions below whose names end in AB or CD provide access to the output from these encoders.

Additionally, the mode parameter can be inclusively ored with the keyword SVP_SLAVE_SELECT_ON to enable the SPI slave select feature.

  • If SPI slave select is not enabled (default), then the ADC/SS line will be an analog input. This line is hardwired to a user trimpot, so the name of the analog channel is TRIMPOT. However, if you want to use this analog input for something else, you can cut the labeled trace between POT and ADC/SS on the bottom of the board. This is the default mode; the auxiliary processor will be in this mode whenever it starts running, and will revert to this mode whenever the AVR is reset for any reason.
  • If SPI slave select is enabled, then the line will be used as the SPI slave select line, SS. When SS is high, the auxiliary processor will ignore all bytes received on SPI and will not drive the MISO line. This allows the AVR to communicate with other SPI devices using the hardware SPI module. See Section 12. When SS is driven low, then the AVR can communicate with the auxiliary processor over SPI as usual. The SS line is pulled high through a 100 kilo-ohm pull-up resistor.
  • static unsigned char OrangutanSVP::usbPowerPresent()

    unsigned char usb_power_present()

    Returns 1 if the voltage on the power line of the USB connector is high. This indicates that the device is plugged in to a computer or USB power supply. Returns 0 otherwise. This function is useful if you want your Orangutan to behave differently when it is plugged in to USB (for example, by not running its motors).

    static unsigned char OrangutanSVP::usbConfigured()

    unsigned char usb_configured()

    Returns 1 if the device has reached the USB Configured State as defined in the USB 2.0 Specification. This indicates that the device is plugged in to a computer and the right drivers might be installed. Returns 0 otherwise.

    static unsigned char OrangutanSVP::usbSuspend()

    unsigned char usb_suspend()

    Returns 1 if the device is in the USB Suspend State. If the device is connected to a computer, this usually indicates that the computer has gone to sleep, but on some computers the Suspend State occurs several times whenever the device is plugged in.

    static unsigned char OrangutanSVP::dtrEnabled()

    unsigned char dtr_enabled()

    Returns either 0 or 1, indicating the value of the DTR virtual handshaking line on the Pololu Orangutan SVP USB Communications Port. This line is controlled by the computer’s virtual serial port driver and terminal software. This line corresponds to the DtrEnable member of the .NET System.IO.Ports.SerialPort class. This line defaults to 0. Several standard terminal programs set this line to 1 when they connect to a serial port, and then set it to 0 when they disconnect. Therefore this command can be used to determine whether a terminal program is connected to the Orangutan, and make the Orangutan’s behavior dependent on that.

    static unsigned char OrangutanSVP::rtsEnabled()

    unsigned char rts_enabled()

    Returns either 0 or 1, indicating the value of the RTS virtual handshaking line on the Pololu Orangutan SVP USB Communications Port. This line is controlled by the computer’s virtual serial port driver and terminal software. This line corresponds to the RtsEnable member of the .NET System.IO.Ports.SerialPort class. This line defaults to 0.

    static int OrangutanSVP::getCountsAB()

    static int OrangutanSVP::getCountsCD()

    int svp_get_counts_ab()

    int svp_get_counts_cd()

    Returns the number of counts measured on encoder AB or CD. For the Pololu wheel encoders, the resolution is about 3 mm/count, so this allows a maximum distance of 32767 × 3 mm or about 100 m. For longer distances, you will need to occasionally reset the counts using the functions below. The counts will be increase if A/C changes before B/D, and decrease if B/D changes before A/C.

    static int OrangutanSVP::getCountsAndResetAB()

    static int OrangutanSVP::getCountsAndResetCD()

    int svp_get_counts_and_reset_ab()

    int svp_get_counts_and_reset_cd()

    Returns the number of counts measured on encoder AB or CD, and resets the stored value to zero.

    static int OrangutanSVP::checkErrorAB()

    static int OrangutanSVP::checkErrorCD()

    int svp_check_error_ab()

    int svp_check_error_cd()

    These commands check whether there has been an error on AB or CD; that is, if both A/B or C/D changed simultaneously. They return 1 if there was an error, then reset the error flag to zero.

    static unsigned char OrangutanSVP::getFirmwareVersion()

    unsigned char svp_get_firmware_version()

    This command asks the Orangutan SVP’s auxiliary processor what version of its firmware is running. The return value of this function for all Orangutans released so far should be 1. This command can be useful for testing or debugging the SPI connection to the auxiliary processor.

Related Products

Pololu 42×19mm Wheel and Encoder Set
Encoder for Pololu Wheel 42x19mm
Orangutan SVP-1284 Robot Controller (assembled)
Orangutan SVP-1284 Robot Controller (partial kit)
Orangutan SV-168 Robot Controller
Baby Orangutan B-328 Robot Controller
QTR-L-1A Reflectance Sensor (2-Pack)
QTR-L-1RC Reflectance Sensor (2-Pack)
QTR-3A Reflectance Sensor Array
QTR-3RC Reflectance Sensor Array
QTR-1A Reflectance Sensor (2-Pack)
Orangutan LV-168 Robot Controller
Orangutan SVP-324 Robot Controller (partial kit)
QTR-1RC Reflectance Sensor (2-Pack)
Orangutan SV-328 Robot Controller
Pololu 3pi Robot
Baby Orangutan B-48 Robot Controller
QTR-1A Reflectance Sensor
QTR-1RC Reflectance Sensor
Orangutan SVP-324 Robot Controller (assembled)
QTR-8A Reflectance Sensor Array
QTR-8RC Reflectance Sensor Array
Orangutan X2 with VNH3
Log In
Pololu Robotics & Electronics
Shopping cart
(702) 262-6648
Same-day shipping, worldwide
Menu
Shop Blog Forum Support
My account Comments or questions? About Pololu Contact Ordering information Distributors