This is a Tibbit module — part of the Tibbo Project System that allows you to build your own custom embedded device with only the components you need. Start with a Tibbo Project PCB, add Tibbits like this one, then place the built design into a Tibbo Project Box to complete your product.
Tibbit #31: ADC, PWM, and I/O from PIC16F1824 microprocessor.
This Tibbit has a PIC16F1824 microcontroller and takes advantage of the rich set of peripherals available on that PIC device. The I2C interface is utilized for communications with the main CPU of the TPP board and also for PIC firmware upgrades.
Four of the micro's I/O lines act as IO1~4 lines of the Tibbit module:
- Three lines have PWM capability
- All four lines can work as ADC inputs
- Two lines can act as TX and RX of the PIC's UART
- Each line can also function as a a regular input/output
Three PWM channels are exposed through lines IO1~3. Each channel allows you to set its frequency and the pulse width (duty cycle) independently. 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 then can 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 an output range from 8MHz down to 488Hz. The PWM pulse width can be programmed to have the period equal to 1~1024 base frequency periods in 1-period steps (1, 2, 3, ..., 1023, 1024).
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 baud rate, parity bit, and the choice of 8-bit or 9-bit operation.
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 this module. Tibbit #21 (four terminal blocks) also can be used but you will have to steal the ground elsewhere, as #21 doesn't have its own ground line and the PWM output voltages are 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.
Tibbit #31 ships with the GRA (general register access) firmware, which gives you access to 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 the PIC's internal RAM and registers. This facilitates 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 control the micro.
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 the PIC behavior without making any changes to the PIC firmware.
The GRA firmware can be updated or replaced using the update_pic_firmware Tibbo BASIC project (see below). Thus you can create and run PIC applications that go far beyond providing simple register and memory access.
- Function: PIC co-processor (PWM, ADC, UART, I/O)
- Form: M1S
- Power: 5V consumes 20mA
- Mates with: #19, #20, #21 (limited use)
- Similar to: #16, #17
Sample Projects The use of this and other I2C Tibbits is illustrated by a group of Tibbo BASIC test projects. There are two projects related to this Tibbit. The first one is titled test_tibbit_16_17_31_(PIC copro). Run the project in the TEST_PWM_1 or TEST_PWM_2 mode. If this last statement sounds cryptic, please read the release notes published on the test projects page linked above. The second project is update_pic_firmware. Use it to update the firmware running on the PIC micro.
M1S Tibbit Modules Overview M1S Tibbits are single-width modules occupying one standard M socket on a Tibbo Project PCB (i.e. TPP2 or TPP3). Their footprint is roughly 7 × 14 "squares" (one "square" is 2.54 × 2.54 mm). The M1S modules are 12.5mm high.
M1 modules have two rows of 6 pins:
Pins 8-11 are control lines A-D. They provide the interface to programmable modules or other microcontrollers. On Tibbo Project PCBs, these pins are connected to the main processor.
Pins 2-5 are I/O lines facing the outside world. On Tibbo Project PCBs, they go to C Tibbits.
Pins 6 and 12 are the GROUND and +5V power pins. Most Tibbit Modules consume (take) 5V power. There are also power supply Tibbits that generate 5V power from a variety of sources. Those output 5V through pin 12.
Pins 1 and 7 are for the additional +15V and -15V voltages. These are optional and only needed by few Tibbits. A special power supply Tibbit (#12) generates ±15V from the main 5V power.