PIC18F Hands-on Workshop with PTK40A

PIC18F Hands-on Workshop with PTK40A

We have been using PTK40A for the PIC Microcontroller workshop since it is launched in 2010. With it, we have 3 different PIC Workshop, Module 1, 2, and Advance. All these workshops use the famous Mid-Range PIC microcontroller – PIC16F877A. Frankly, PIC16F877A is a pretty mature PIC microcontroller as it has been around for more than 20 years.

Last year, we received feedback and inquiries to adopt PIC18F into PTK40A and also the workshops. Sure! After 1 year of preparation and choosing the famous model of PIC18F, we are ready to upgrade the PIC workshops to PIC18F and we will be using PIC18F4550 and PIC18F4520.

Currently, we will be launching PIC18F Microcontroller Hands-on Workshop module 1 and 2, we are working on module advance. Allow me to talk about PIC18F vs PIC16F generally and why we choose PIC18F4550. Do check out our training calendar here.

PIC16F vs PIC18F:

  • PIC18F can run up to 48MHz while PIC16F (conventional) can only run up to a maximum of 20MHz
  • PIC18F has up to 32Kbytes (18F4550 and 4520) while PIC16F (conventional) has only 14Kbytes
  • PIC18F has more RAM (data memory) compared to PIC16F
  • PIC18F offers a better ADC module compared to PIC16F
  • PIC18F may have more special peripherals such as USB, CAN, ECCP, EUSART, etc compared to PIC16F (conventional)

So can PTK40A support PIC18F, yes and no? Yes, which is good because when Microchip designed PIC18F, they made the microcontroller to be pin to pin compatible with PIC16F, as far as I know, 40-pin, and 28-pin are compatible. It is good because you can simply change the PIC16F on PTK40A with another 40-pin PIC18F and it works, at least the circuit is correct, what we need to focus on is the program. No, not all peripheral pins are compatible. On PTK40A, the SPI and I2C is designed for PIC16F877A, PIC16F887, PIC18F4520, not for PIC18F4550. Because on PIC18F4550, with additional USB peripherals, the MSSP (Master Synchronous Serial Port) the I2C and SPI pins are being shifted to other pins.

That is one of the reasons why we choose PIC18F4550 and PIC18F4520 to be on PTK40A. Most of the exercises are developed based on PIC18F4550 as it comes with USB and with this; we have a choice to use the USB Bootloader. Only when in I2C and SPI exercises, we will change to PIC18F4520. Anyway, all other examples and libraries are designed for both models of PIC18F.

MPLAB X IDE

Besides the upgrade of PIC18F, now PTK40A comes with an MPLAB X IDE installer, and also the exercises and examples are developed in MPLAB X IDE (in CD/DVD). Check out the user-friendly features offered by this IDE:

Not to forget we have also now using the new compiler, MPLAB XC8 for this workshop.

Is there any restriction on the PTK40A with this upgrade? No, not at all, in fact, PTK40A comes with the features:

  • Build in USB PIC Programmer that is compatible with PICkit2. Using it with MPLAB X IDE will be easy as it is 1 click to compiler and load the program into the PIC on PTK40A. No additional 3rd party software is needed to load the program.
  • You can always change it back to PIC16F877A, and we include three PIC models in PTK40A.
  • Changeable Crystal, we are still using 20MHz.
  • 2 digit of 7-segment
  • 2×16 Parallel LCD
  • 4×4 Keypad
  • DS1307 as I2C communication example
  • External EEPROM for SPI communication
  • 32.768KHz Crystal as Real Time Clock interrupt
  • Connector ready for UC00A, UART communication to PC’s USB
  • Connector reader for Cytron’s SKPS, SKKCA, SKXBee
  • Standard RC Servo, C17S
  • Stepper motor which can be driven with the unipolar or bipolar method
  • Relay to control an external device such as magnetic lock
  • SPG10 DC motor with rotary encoder feedback
  • The output pin is connected to LED as an indicator
  • ADC input which offers a reading of onboard variable resistor, external analog sensor, and temperature sensor, LM35
  • Buzzer for sound indication
  • External digital input connector
  • 1 reset button
  • 3 programmable push buttons
  • All pin of PIC is extended out on the turn pin for experimental purpose
  • USB is supported with PIC18F4550.
  • Single power supply for all onboard experiments, including DC brush motor and stepper motor
  • Suitable for laboratory experiment works

Let’s talk about the workshops. Though it is upgraded to PIC18F, we will still be following most of the syllabus from previous workshops: All these workshops will take 3 days each and every participant brings back a PTK40A home after the workshop.

  • Module 1: We will be introduced to PIC18F’s architecture, and discuss the development tools which include the MPLAB X IDE and programmer. A basic circuit for your own development will also be discovered. Then we will start with the real hands-on:
    • Lab 0, where we have an overview of the features and hardware of PTK40A, install MPLAB X IDE and the XC8 C compiler, and then we will continue with basic digital input and output of PIC, also the 1st project of your own. Compile and download your code into PTK40A.
    • Lab 1: Parallel interface 2×16 character LCD, this is the most common and popular display device in embedded systems. The circuit/interface will be elaborated and with the help of code development, the understanding is strengthened.
    • Lab 2: DC Brushed Motor, as the name shows, we are going to learn how to control the DC brush motor from PIC. This lab will include the new peripheral – PWM (Pulse Width Modulation). Again, I always start with a circuit/interface explanation.
    • Lab 3: Stepper motor, another type of DC motor – Stepper motor is another type of popular motor being used in most open-loop positions or speed control systems such as 3D printers and antenna direction adjustment.
    • Lab 4: RC Servo motor. Yes, another type of DC motor. RC Servo is not a standard industry motor, but it is quite a popular and low-cost motor for students, armatures, and hobbyists.

  • Module 2: We will be introduced to PIC18F’s architecture, and discuss the development tools which include the MPLAB X IDE and programmer. A basic circuit for your own development will also be discovered. Then we will start with the real hands-on:
    • Lab 0, where we have an overview of the features and hardware of PTK40A, install MPLAB X IDE and the XC8 C compiler, and then we will continue with basic digital input and output of PIC, also the 1st project of your own. Compile and download your code into PTK40A.
    • Lab 1: Analog to Digital Conversion, ADC. We will explore ADC in this lab. Besides the configuration of the ADC in PIC, we then develop code for the actual hardware to read analog voltage, and also an actual sensor, the LM35. Finally, convert the value into temperature.
    • Lab 2: 4 x 4 Matrix keypad. A matrix keypad is a good device that allows us to learn to multiplex between inputs and output.
    • Lab 3: Password Door Security. In this lab, we will learn the integration of a keypad, LCD, LED, buzzer, also relay to control a door lock, by using a program. At the end of the lab, you get yourself a password door security that you can build for your office J
    • Lab 4: Bonus lab – UART. Universal Asynchronous Receiver and Transmitter, a mature yet popular serial communication standard between microcontrollers, sensors, and controllers. Yes, we will be learning about it and there is a lab for it too.

  • Module 3 (Advance): We are yet ready with module advance for PIC18F but the syllabus will be as described here. We will be introduced to PIC18F’s architecture, and discuss the development tools which include the MPLAB X IDE and programmer. A basic circuit for your own development will also be discovered. Then we will start with the real hands-on:
    • Lab 0, where we have an overview of the features and hardware of PTK40A, install MPLAB X IDE and the XC8 C compiler, and then we will continue with basic digital input and output of PIC, also the 1st project of your own. Compile and download your code into PTK40A.
    • Lab 1: Interrupt and timer 1. In the advanced module, the 1st actual lab will discuss interrupt and how to utilize it in one of the peripherals – Timer 1. We will talk about the theoretical operation on both the interrupt and timer 1, also finally, create a real-time clock with timer 1.
    • Lab 2: I2C – Inter IC communication. One master and multiple slaves communicate. Under the MSSP peripheral in PIC, I2C is one of the synchronous serial communication standards. Again, we will discover the theoretical operation and develop actual code for communication with the DS1307 real-time clock, configuration, and also reading the information.
    • Lab 3: SPI – Serial Peripheral Interface. Another synchronous serial communication is mostly being used for high-speed combinations such as SD card or MP3 decoder, etc. Besides exploring the operation, we will develop the code for communication with external EEPROM via SPI.
    • Lab 4: UART, another UART lab where we will communicate with an interesting device, the SKPS. We will have with SONY PS2 dual-controller joystick.

Currently, we are launching the 1st PIC18F Microcontroller Hands-on Workshop at Penang Science Café, Krystal point, Bayan Lepas, Penang. There is an early bird discount, please get yourself registered and pay by 22nd July to enjoy the discount.

BUY