Mechatronics Lab with PIC16F877 and I/O Board

This page provide information and handouts of Mechatronics lab for the course EGME361 Robot Actuators and Sensors and EGME362 Introduction to Mechatronics. Please note that all the documents are written in Thai language.

A hardware set is developed to give students hand-on experience in programming and interfacing with various actuators and sensors. The hardware set consists of:

  • PIC16F877 Bootloader Board
    PIC16F877 Bootloader BoardThe PIC16F877 Bootloader board is designed to use with Tiny PIC Boot Loader, which allows the PIC to be programmed through serial port. This configuration eliminates the need of a PIC programmer and allows a user to use serial port for both programming the PIC and serial communication (e.g. with HyperTerminal) without modifying the hardware.

    Before using the board, PIC16F877 must be programmed with Tiny PIC Boot Loader firmware (file: tinybld_16F876A_20MHz.HEX). Of course, a PIC programmer is only needed at the first time to program the firmware. And after this, we will no longer need the programmer. Tiny Bootloader software is used to program the PIC through serial port.

  • ET-EXP4 I/O Board
    ET-EXP4 I/O BoardET-EXP4 I/O Board is developed by ETT company. It contains many input/output modules that is often used in mechatronic systems such as LEDs, 7-segment, dot-matrix LED, LCD display, matrix switches, stepper and dc motor, relay, speaker, and DAC. The PIC16F877 Board is designed to conveniently connect with ET-EXP I/O Board through 14-pin IDC connectors.

  • Software
    There are many languages can be used to program PIC microcontroller such as assembly, C, Basic. I chose C language from Hi-Tech and CCS for my class. In this case you will need following software.

    • MPLAB IDE is the developing environment, which you can use to write program and build the source code for PIC microcontroller. Assembly language compiler is built-in with the MPLAB IDE. It can be download for free from Microchip website.
    • Compiler (You need only one compiler. The source codes are provided for all)
      • Hi-Tech PICC compiler from Hi-Tech is a compiler that can be added on to the MPLAB IDE program. Hi-Tech PICC is not a freeware, but an evaluation software is available on the Hi-Tech website.
      • CCS C compiler from Custom Computer Service, Inc. Compare with Hi-Tech and other C compilers for PIC, this compiler is most user friendly. User doesn't have to know any special function registers (SFR) in the microcontroller. The program provides adequate special function to setup the registers for most tasks. The buttom line is if you want to setup a quick project, go with CCS, but if you want to learn microcontroller, go with Hi-Tech
      • PicBasic Pro compiler from microEngineering Labs. Like most compiler, PicBasic Pro is not a freeware, but a demo software is available on the microEngineering Labs website. I recommend to use this compiler with MicroCode Studio IDE (free) from Mecanique website.
    • Tiny PIC Bootloader software (just file: tinybldWin.exe) is required to program the PIC through serial port.

Lab documents (Thai language)

Documents
Source Codes
Hi-Tech PICC CCS C PicBasic Pro
Lab1: Seven-Segment & LED Display Lab01.zip Lab01_CCS.zip Lab01_PBP.zip
Lab2: Character LCD Display Lab02.zip Lab02_CCS.zip Lab02_PBP.zip
Lab3: Dot-Matrix LED Display Lab03.zip Lab03_CCS.zip Lab03_PBP.zip
Lab4: Matrix Keyboard & Switch Lab04.zip Lab04_CCS.zip Lab04_PBP.zip
Lab5: Stepping Motor, Speaker and Relay Lab05.zip Lab05_CCS.zip Lab05_PBP.zip
Lab6: Serial Communication Lab06.zip Lab06_CCS.zip Lab06_PBP.zip
Lab7: Digital-to-Analog Converter (DAC) Lab07.zip Lab07_CCS.zip Lab07_PBP.zip
Lab8: DC Motor Control Lab08.zip Lab08_CCS.zip Lab08_PBP.zip
Lab9: PWM Lab09.zip
Lab10: Analog-to-Digital Converter (ADC) Lab10.zip
Lab11: Data Acquisition System (DAS) Lab11.zip
Lab12: Window Application with C# Lab12.zip
cs_ex12_1.zip
Lab13: Design and Fabrication of a PCB with Eagle Lab13.zip