#17, M1S: Three PWMs With Power Outputs
Function: Three PWMs with power outputs (the power must be supplied externally)
Form factor: M1S
Category: Output module
Special needs: ---
Power requirements: 5V/20mA
Mates with: #19, #20, #21 (limited use)
See also: #16, #31
This Tibbit is based on the PIC16F1824 microcontroller and takes advantage of the PWM channels available on this PIC device. The PIC micro has four PWM channels but one of the channels cannot be used because it shares I/O lines with the I2C interface. The I2C interface is utilized for communications with the main CPU of the TPP board and also for PIC firmware upgrades.
The frequency and the pulse width (duty cycle) are set independently for each PWM channel. The frequency is controlled through a divider and a period value. The divider allows you to select the base frequency applied to the divider. Available choices are 32MHz, 8MHz, 2MHz, and 500KHz. The output signal of the PWM can then be programmed to have the period equal to 4
1024 base frequency periods in 4-period steps (i.e. 4, 8, 12,...1020, 1024). This gives you the output range from 8MHz down to 488Hz. The PWM pulse width can be programmed to have the period equal to 11024 base frequency periods in 1-period steps (1, 2, 3,... 1023, 1024).
Each PWM channel uses one Singreat Electronics GT430PSB P-channel FET transistor which is rated for 4A continuous current at room temperature.
Combine this Tibbit with #20 (nine terminal blocks) or #19 (DB9M connector). It's not common but possible to use the latter for wiring into the PWM outputs. The Tibbit #21 (four terminal blocks) can also be used but you will have to steal the ground elsewhere, as #21 doesn't have its own ground line and the PWM Tibbit outputs voltages with respect to the system ground.
There are two red, one yellow, and one green LED. The first red LED is connected to the SCL line of the I2C interface, the second one -- to the -RST line of the PIC micro. The yellow LED is connected to the SDA line of the I2C interface. The green LED is on the -INT line.
PIC micro and GRA firmware
Tibbit #16 ships with the GRA ( general register access) firmware, which allows you to access internal PIC registers and memory through the I2C interface. The firmware implements a very simple communications protocol which essentially consists of two important commands -- address read and address write. These two commands are used to write to and read from PIC's internal RAM and registers. This facilitates a simple and versatile access to all microcontroller resources. The available Tibbo BASIC library sits on top of the GRA firmware and uses the communications protocol to access and set the PWM channels.
Since the GRA firmware does not do anything intelligent and all the setup work is essentially scripted in Tibbo BASIC, it is possible to modify PWM setup (and PIC behavior) without making any changes to the PIC firmware.
The GRA firmware can be updated or replaced using the pic_firmware_upgrade Tibbo BASIC project (see below). You can, therefore, create and run PIC applications that go far beyond providing simple register and memory access.
The use of this Tibbit is illustrated by a Tibbo BASIC test project. Yo can find it here: https://github.com/tibbotech/CA-Test-Tibbits-16-17-31.