Did you know...
The Serial Wombat comes pre-programmed, ready to jump into action at your command. When you power-up your Serial Wombat, it begins listening on the serial pins for commands from its host.
The Serial Wombat is designed to carry out I/O tasks for the host, and generally provide an interface to the outside world. The Serial Wombat pins can be controlled directly by the host, or each pin can be configured to carry out common interfacing tasks which require faster or more precise transistions than could be achieved through individual serial commands.
The Serial Wombat supports up to 13 channels of A/D conversion. By default, 4 channels (pins 2,3,4, and 5) are configured for A/D conversion. Users can enable or disable A/D functionality for additional pins using the Configure Analog Channels property of the Set System Parameter command. Signals being measured by the Serial Wombat's internal A/D should have an input impedance of 2k Ohms or less to achieve 10-bit accuracy.
Each enabled A/D is sampled at the beginning of each frame (by default every 1ms). The Serial Wombat has a single A/D converter which is multiplexed among pins. Therefore, the A/Ds are not all sampled at the same time, but rather within a few uS of each other.
In order to understand A/D conversion, it's important to
understand a fundamental concept: All physical measurements
and their units are arbitrary. For instance, at some point
somebody in Europe decided that water was a good way to relate
mass and length. If you create a box 1cm by 1cm by 1cm and fill
it with pure water at a certain temperature, then it will weigh
1g, because it's defined that way. If that person had filled
their box with lead, or oil, or some other substance, then the
definition of a gram (or perhaps 1cm, depending on which they
arbitrarily chose first) would have been different. It's the same
way with Voltage, except that the story is longer and more
complicated, and requires a bunch more definitions of other
fundamental units along the way.
The Serial Wombat's on-board A/D converter provides 10 bits of resolution. All Serial Wombat analog quantities are expressed using 16 bits. This method is used because it provides compatibility between various resolution inputs and outputs. For instance, a 10 bit A/D measuring 2.73215 V on a 0 to 5 volt scale would return the value 0x8BC0 . (A 16 bit converter would convert it as 0x8BE2). Higher or lower resolution simply means more or less increments between 0 and 0xFFFF. The Wombat takes this concept to its extreme when an analog measurement is requested from a digital pin. Since the pin has only 1 bit resolution (high or low), a result of 0 or 65535 is returned, with no possible steps in-between. Analog values which represent the maximum value for a particular input (such as 0xFFC0 for a 10-bit A/D) are converted to 0xFFFF, so that 65,535 consistently means the maximum possible measured value for an input or output. But again, this value should be understood to be somewhere in a range, not necessarily equal to the highest possible voltage
Future versions of the Serial Wombat will support the use of off-board A/D converters attached to the Wombat via a SPI bus. This will allow higher resolution conversions. Use of reference voltages other than the Wombat's power supply will also likely be supported.
The Serial Wombat is based on a Microchip PIC 18F4620 microcontroller. The Serial Wombat firmware attempts to make use of as many of the chip's special hardware functions as possible. Because of this, some tasks, such as PWM generation, can most effectively be performed by pins which have special hardware to support that task. When a task is assigned to a pin without hardware assistance, then the task is done in software when possible. For example, pins 16 and 17 have support for hardware driven PWMs. When commanded to generate an Analog output, these pins will generate a PWM of approximately 31kHz, and 10 bit resolution. Pins without this hardware support, such as pin 15 will generate a PWM in software. The user can choose a trade-off between frequency and resolution, but in any case the performance will be much worse than the hardware assisted pins (by default 61 Hz at 4 bit resolution).
The Serial Wombat has one pin which can be used as a low-resolution D/A channel. Pin 4 can output 16 analog levels between 0 and 3.3 volts. This pin is the output of a 16 tap resistor ladder, and can only provide very low current output. It is suggested that this output be buffered with an op-amp or other circuit if used with a circuit requiring a lower output impedance. Note that software versions prior to 1.1.2 had a bug which caused incorrect setting of the D/A pin 4 when set through the 'W' command.
The Serial Wombat supports the Microchip MCP4821 12-bit D/A converter. This chip is interfaced to the Wombat through the SPI lines, with the selected pin being used for the chip-select. When a pin's hardware mode is set to MCP4821, any command which would set that Pin's PWM value is translated instead into a SPI command. Therefore, any pin mode or command which normally outputs a PWM can instead generate a true analog voltage from 0 to 4.095 volts in 1mV steps. Using this off-board chip requires that the pins 18 and 24 be dedicated to SPI bus usage, as well as the pin acting as the chip-select. Multiple D/A converters can be attached and share pins 18 and 24, as long as each has a separate chip-select.
Up to 32 pins on the Serial Wombat can be used for Digital I/O. In order to use pins which are analog-to-digital capable as digital I/O, the analog function must be turned off using the Configure Analog Channels property of the Set System Parameter command. Each pin can be configured as an input, or a high or low output. Pins 33 through 40 have internal pull-up resistors, allowing switches, rotary encoders and keypads to be used with no external components. The pull up resistors for these pins can be turned on or off as a group using the Set System Parameter command. When configured as inputs, all pins behave as Schmitt-Triggered inputs, except pins 2,3,4,5,7, 13, 14 and 33 through 40 which behave as TTL inputs. This difference will not matter to most users.
The Serial Wombat's I/O pins can sink or source up to 25mA per pin. This allows LEDs to be driven directly from the I/O pins with only a current-limiting resistor. However, the total amount of sourced and sunk current cannot exceed 200 mA. Therefore, the Serial Wombat cannot, for example, turn on 32 LEDs at once without additonal external hardware.
Each I/O pin of the Serial Wombat has its own state machine. In each frame (by default every 1ms) every pin's state machine is serviced. Pins are serviced in ascending order. By default all pins from 2 through 40 are serviced. However, the Start and End service pins can be changed with the Set System Parameter. Since the Serial Wombat has a single CPU core to share among all pins, the frequency with which it can service all the pin state machines is limited. For some applications it may be desired to update a pin's state machine 10,000 times per second or more, instead of the normal 1000. This can be achieved by using the Set System Parameter command to reduce the number of pins serviced. Since less pins are serviced, CPU time is freed up to service them more often. The update frequency can be set by altering the Frame Counter Update Value using the Set System Parameter command. See the CPU Throughput section below for more information.
Early documentation called each pin a channel. Therefore, pin modes and channel modes are the same thing. To avoid breaking existing Internet links, the two terms are used interchangably.
By default, pins 2,3,4, and 5 come up in A/D Raw mode at powerup. In this mode the Analog value present on the pin is converted to a number ranging from 0 to 65535. All other pins come up in Direct mode, set as inputs.
A list of all available pin modes can be found here.
Some pin modes require more than one pin in order to operate. A few examples of this are stepper motor control, rotary encoder input, matrix keypad scanning, and LCD display control. For each of these modes only a single pin is configured. However, when configuring that pin you also tell it what other pins to use. These other pins are set to Controlled Mode. Controlled pins do not need to be serviced. Only the main pin needs to be serviced. For example, an LCD driver mode which requires a total of 11 pins only requires the main configured pin to be serviced by the executive. The other pins are used only for I/O, and in some cases their state machine memory is used by the main pin. In some cases, controlled pins can be shared among multiple master pins. For example, it is permissible to share data pins among multiple LCD displays, enabling the Serial Wombat to drive 10 or more independent displays in some cases. See each pin mode's documentation for information about what pins play nice together.
There are four memory regions in the Wombat in which users may be interested: the Public Data area, the User RAM area, the EEPROM area, and the User Flash area.
Public Data Area
Each pin's state machine provides a single public 16 bit location. This location can be used to provide information to other pins or to the user. Many pin modes, such as hysteresis, rely on input from other pins' public data in order to operate. Additionally, many interesting system properties such as timers, a random number generator, and received byte counters can act as public data sources. See the public data page for more information.
All RAM not used by the Serial Wombat firmware is made available for use by the user. The amount of available User RAM may vary from release to release, but is guaranteed to be at least 512 bytes. The User RAM area is indexed from zero, regardless of where it actually falls in the physical RAM area of the 18F4620 for a particluar Wombat build.
Some pin modes expect the user to put data into RAM for the pin mode to read. A good example of this are the LCD driver modes, where the user puts the string to be displayed somewhere in the User RAM area, and tells the pin mode where to look as part of initialization. Data can be placed into RAM using the Set User Ram commands.
Queues can be created in User RAM. Some pin modes expect to read data out of queues. For example, the morse-code pin mode gets the characters to transmit out of a queue. Other modes put data into queues. For example, the matrix keypad decoder mode can put key presses into a queue for later retreival by the host. A number of commands exist for creating, reading, and writing to queues.
The Serial Wombat's EEPROM is used to store internal settings, such as the baud rate the Serial Wombat will use at Powerup.
Bytes at EEPROM addresses from 512 to 1023 are available for use by the user. This allows the user to store data such as a serial number in the Serial Wombat.
If EEPROM address 511 is set by the user to a value other than 0, then the value in address 511 is taken to be the number of commands stored in EEPROM which are to be executed at powerup. Each command will be processed as if it came in over the serial port. For example, if address 511 is set to three, then three sets of 8 bytes (addresses 512 to 519, 520 to 527, and 528 to 535) will be interpreted as 3 commands. This allows pins to be configured at powerup for certain functions. This is useful for achieving a safe state for a system if an unexpected Wombat processor reset occurs.
EEPROM programming strings for initialization sequences can be generated using the command processor CGI script. Enter the commands you wish to be executed at powerup, and submit. Connect to the Serial Wombat using Hyperterminal at a slow speed (300 baud works good, since the chip stalls momentarily while the EEPROM programming occurs), and paste the EEPROM string from the .cgi script to the Wombat. Then power cycle your Wombat and verify that programming was successful.
User Flash Area
16k of the Serial Wombat's internal flash has been reserved for use by the user. There is currently no support for this area, but future Serial Wombat firmware versions may support downloading of code or data to this area.
Copyright Wombat Interface Products, 2005-2008. All Rights Reserved.