These examples are designed to demonstrate how to use a PIC18F4410 to communicate with our modules, most of these examples use the LCD03 display module to show the results. All the modules which use the I2C bus have 1k8 pull-up resistors to 5v. You only need one set of resistors for the whole I2C bus regardless of however many I2C devices you have connected to it. You can find more information about the I2C bus in our I2C tutorial. All code was written for microchips C18 toolsuit.
| Index: | |
| CMPS03 | Magnetic Compass |
| CMPS12/11 | Tilt Compensated Magnetic Compass |
| SRF01 | Ultrasonic Ranger |
| SRF04/05 | Ultrasonic Ranger |
| SRF05 | Ultrasonic Ranger |
| SRF06 | Ultrasonic Ranger |
| SRF08 | Ultrasonic Ranger |
| SRF02 | Ultrasonic Ranger |
| SRF10 | Ultrasonic Ranger |
| SRF235 | Ultrasonic Ranger |
| SRF485(WPR) | Ultrasonic Ranger |
| TPA81 | 8 Pixel Thermal Sensor |
| SD20 | Servo Controller |
| SD21 | Servo Controller |
| MD03 | 24V 20A Motor Driver |
| MD22 | Dual 24V 5A Motor Driver |
| MD25 | RD02 Motor Driver |
| MD49 | RD03 Motor Driver |
| RLY08 | Relay Module |
CMPS03 Magnetic Compass
This uses the I2C bus to connect the PIC18F4410 to the CMPS03.
It reads the bearing as a 16 bit integer and also reads
the bearing as a byte. These are then displayed to the LCD03.

| Download the CMPS03_pic18f.zip file |
CMPS12/11 Tilt
Compensated Magnetic Compass
This uses the Serial mode to connect the PIC18F4410 to the CMPS11.
It reads the bearing as a 16 bit integer and also reads
the bearing as a byte. These are then displayed to the LCD05 along
with pitch and roll. This example includes push buttons connected
to the PIC to allow it to perform calibration and to restore
factory calibration..

| Download the CMPS12_pic18f.zip
file Download the CMPS11_pic18f.zip file |
SRF01
Ultrasonic Ranger
The SRF01 uses a single wire for both serial input and output. We
have connected this to 2 pins of the PIC18F4410 for input and
output. A diode is put in place to stop the SRF01 from driving the
output pin when sending data back. Range is displayed on an LCD03
module.

| Download the SRF01_pic18f.zip file |
SRF04
Ultrasonic Ranger
As the SRF04 and SRF05 use the same method of communicating this
example is compatible with both the SRF04 and SRF05.

| Download the SRF04_pic18f.zip file |
SRF05
Ultrasonic Ranger
This example uses the SRF05 in one pin mode, where the Trigger and
Echo signals appear on the same pin. Note the SRF05's mode pin is
connected to ground to place it in one pin mode.

|
Download the SRF05_pic18f.zip file |
SRF06
Ultrasonic Ranger
The SRF06 produces between 4mA at minimum range and 20mA at
maximum range. By passing this current through resistor we
can use the PIC18F4410 A/D converter to sample a voltage and
turn it into a range value. The result is then printed to the
LCD03.

|
Download the SRF06_pic18f.zip file |
SRF08
Ultrasonic Ranger
The SRF08, SRF02, SRF10 and SRF235 all use the same I2C interface
and the basic ranging commands are the same. This example works
for all these rangers. The light reading is only available on the
SRF08.

|
Download the SRF08_pic18f.zip file |
SRF485
Ultrasonic Ranger
The SRF485 and SRF485WPR uses RS485 communications. This
example show how to connect it to a PIC18.

|
Download the srf485_pic18f.zip file |
TPA81 Thermal
Sensor
The TPA81 connects to the PIC18F4410 using the I2C bus. This
example displays the ambient temperature and 8 temperatures from
the thermal sensor on an LCD03 module and also drives a servo.

| Download the TPA81_pic18f.zip file |
SD20 Servo
Controller
This example shows how to drive servos by using the SD20 chip.

| Download the SD20_pic18f.zip file |
SD21 Servo
Controller
The SD21 is a ready wired module which can save a lot of time
compared to the SD20 above. This example moves all servos through
their maximum range.

| Download the SD21_pic18f.zip file |
MD03 24V 20A
Motor Driver
This example runs the motor at varying speeds forward and
reverse, displaying the temperature, motor current, and
speed on the LCD03.
| Download the MD03_pic18f.zip file |
MD22 24V
5A Motor Driver
This example drives both motors and uses the turn register to
alter their speeds. It displays the speed and turn register values
to the LCD03.

| Download the MD22_pic18f.zip file |
MD25 RD02
Motor Controller
This example drives the RD02 motors and displays the encoder
values on the LCD03 in hex format, as well as the battery voltage
and current for each motor. It runs the motors back and forth
between 2 values output by the encoders.

| Download the MD25_pic18f.zip file |
MD49 RD03
Motor Controller
This example drives the RD03 motors and displays the encoder
values on the LCD03 in hex format, as well as the current for each
motor. It runs the motors back and forth between 2 values output
by the encoders.

| Download the MD49_pic18f.zip file |
RLY08 Relay Module
Example of switching relays on and off by passing values to the
relay states register.

| Download the RLY08_pic18f.zip file |