#31, M1S: PIC Coprocessor

A blue M1S Tibbit.

Function: PIC coprocessor (PWM, ADC, UART, I/O)

Form factor: M1S

Category: Input/output module

Special needs: ---

Power requirements: 5V/20mA

Mates with: #19, #20, #21 (limited use)

See also: #13, #16, #17, #43-1, #52, #53



Details

Tibbit #31 is based on the PIC16F1824 microcontroller and takes advantage of the rich peripheral set available on this PIC device. The I²C interface is used for communications with the main CPU of the host Tibbo Project PCB (TPP) and also for PIC firmware upgrades. Four of the microcontroller's I/O lines act as lines IO1 ~ 4 of Tibbit #31:

Three PWM channels are exposed through lines IO1 ~ IO3. Each channel allows you to independently set its frequency and the pulse width (duty cycle). The frequency is controlled through a divider and a period value.

The divider selects the base frequency for the PWM channel. 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~1,024 base frequency periods in 4-period steps (i.e., 4, 8, 12 ... 1,020, 1,024). This gives you an output range from 8MHz down to 488Hz.

The PWM pulse width can be programmed to have the period equal to 1~1,024 base frequency periods in 1-period steps (1, 2, 3 ... 1,023, 1,024).

The analog-to-digital converter has a resolution of 10 bits and an input range of 0~5V.

The UART has standard capabilities that include programmable baudrate, parity bit, and the choice of 8-bit or 9-bit operation.  

Combine Tibbit #31 with #20 (nine terminal blocks) or #19 (DB9M connector). It's possible, but not common, to use the latter for wiring into this module. Tibbit #21 (four terminal blocks) can also be used, but you will have to steal the ground from elsewhere, as #21 doesn't have its own ground line and the PWM lines output voltages with respect to the system ground.


LEDs

There are two red, one yellow, and one green LED. The first red LED is connected to the SCL line of the I²C interface, while the second one is connected to the –RST line of the PIC microcontroller. The yellow LED is connected to the SDA line of the I²C interface. The green LED is on the –INT line.


PIC Microcontroller and GRA Firmware

Tibbit #31 ships with general register access (GRA) firmware, which allows you to access internal PIC registers and memory through the I²C interface. The firmware implements a very simple communications protocol that essentially consists of two important commands — address read and address write. These two commands are used to write to and read from the PIC's internal RAM and registers. This facilitates simple and versatile access to all microcontroller resources. A Tibbo BASIC library sits on top of the GRA firmware and uses the communications protocol to control the microcontroller.

As the GRA firmware does not do anything intelligent and all the setup work is essentially scripted in Tibbo BASIC, it is possible to modify the PIC behavior without changing its firmware.

The GRA firmware can be updated or replaced using the update_pic_firmware Tibbo BASIC project (see below). You can, therefore, create and run PIC applications that go far beyond providing simple register and memory access.


Sample Project

The use of Tibbit #31 is illustrated by a Tibbo BASIC test project. You can find it here: https://github.com/tibbotech/CA-Test-Tibbits-16-17-31.


#31, M1S: PIC Coprocessor

Details

LEDs

PIC Microcontroller and GRA Firmware

Sample Project