Sei sulla pagina 1di 41

Tutorial for MPLAB Starter Kit for PIC18F

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 1

Welcome to the tutorial for the MPLAB Starter Kit for PIC18F. My name is Marius Voicu, and I am an Applications Engineer at Microchip Technology. In this tutorial, I will be guiding you through the PIC18F Starter Kits hardware and software, and showing you the powerful features of the PIC18F J-series Flash microcontrollers that you can utilize in your own application.

Agenda
Agenda
Hardware Overview
Starter Kit Contents Board Key Components

PIC18F46J50 Features Demo Applications


Connecting the hardware Bootloader Precompiled Demo Applications

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 2

In this webinar we will discuss the hardware features of the PIC18F Starter Kit, the features available on the PIC18F46J50 family devices, and discuss the demos that are included with this kit.

Starter Kit Contents

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 3

The starter kit consists of a software installation disk, the starter kit board, a USB mini-B cable to connect the starter kit to a PC and a MicroSD Memory Card with the precompiled demo applications. Before connecting the starter kit to the PC, install the starter kit software by inserting the CD and following the instructions. The installer program will install the MPLAB IDE, a student version of the MPLAB C18 C compiler, the bootloader, the demo applications, and the starter kit documentation.

Board Key Components

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 4

Lets take a look at the starter kit board.

Board Key Components

On Board Debugger

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 5

Note the white rectangle on the bottom of the board. The circuitry inside of this rectangle is an in-circuit debugger. This circuitry allows you to debug an application on the starter kit without the need of an external debugger. The circuitry outside of the white rectangle is the demonstration application.

Board Key Components

PIC18F46J50

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 6

PIC18F46J50: At the heart of the application is a PIC18F46J50, a 44-pin member of the PIC18F J-series Flash microcontroller family with USB Capability. The microcontroller features 64 Kbytes of Flash program memory and 3776 bytes of RAM.

Board Key Components


Capacitive Touch Buttons and Scroll Bar

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 7

Capacitive Touch Buttons and Scroll Bar: The 4-element keypad is an integral part of the boards top layer. The application responds to capacitive changes induced by direct contact with the user by monitoring each of the touch pads elements with the microcontrollers integrated CTMU module.

Board Key Components

Organic LED display

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 8

OLED Display: A 128 x 64 pixel, monochrome organic LED array provides a wide range of graphics and alphanumeric display options.

Board Key Components

3 Axes Acceleration Sensor

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 9

3 Axes Acceleration Sensor: This digital sensor measures the acceleration on all the three axes and can be used in different applications to determine the tilt of the board which can be used for example to control the movement of the cursor in a USB Mouse demo.

Board Key Components

S1 Menu Button

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 10

Menu Button: This switch can be used an any time within the demo applications to load the bootloader menu.

10

Board Key Components


MicroSD Memory Card

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 11

MicroSD Memory Card: MicroSD memory card provides storage space for precompiled application files. The Bootloader can load applications from the MicroSD card and program them to the microprocessors Flash memory.

11

Board Key Components


Potentiometer

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 12

Potentiometer: Provides an analog input to the microcontroller for certain demo applications.

12

Board Key Components

minimini-B USB Receptacle

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 13

mini-B USB Receptacle: Provides system power and bidirectional communication between the host PC and the starter kit.

13

PIC18F46J50 Features

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 14

The PIC18F microcontrollers have many features and peripherals that make them powerful, versatile platforms for embedded projects. Lets discuss the features that are available in the PIC18F46J50 family devices, the device that in included on this board.

14

PIC18F46J50 Features
Parallel Master Port (PMP)

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 15

The Parallel Master Port, or PMP, is a parallel 8-bit I/O module specifically designed to communicate with a wide variety of parallel devices, such as communications peripherals, LCDs, external memory devices, and microcontrollers. Because the interface to parallel peripherals varies significantly, the PMP module is highly configurable.

15

PIC18F46J50 Features
Parallel Master Port (PMP) Real-Time Clock and Calendar (RTCC)

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 16

The Real-Time Clock and Calendar module is a 100-year clock and calendar with automatic leap year detection. It runs off a 32.768 kHz input from the secondary oscillator, and is optimized for low-power usage in battery powered applications.

16

PIC18F46J50 Features
Parallel Master Port (PMP) Real-Time Clock and Calendar (RTCC) USB Device Capability

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 17

The Universal Serial Bus module contains the analog and digital components to provide a USB 2.0 full-speed and low-speed device implementation with a minimum of external components. USB Device support allows an application to easily interface to a PC.

17

PIC18F46J50 Features
Parallel Master Port (PMP) Real-Time Clock and Calendar (RTCC) USB Device Capability Charge Time Measurement Unit (CTMU)

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 18

The Charge Time Measurement Unit is a flexible analog module that provides accurate differential time measurement between pulse sources, as well as asynchronous pulse generation. The CTMU allows an application like the starter kit to utilize capacitive touch sensors for user input.

18

PIC18F46J50 Features
Parallel Master Port (PMP) Real-Time Clock and Calendar (RTCC) USB Device Capability Charge Time Measurement Unit (CTMU) Master Synchronous Serial Port (MSSP)

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 19

PIC18F46J50 microcontroller has two MSSP modules, that can be configured for either I2C or SPI communication with other peripheral or microcontroller devices. These peripheral devices include digital sensors, serial memories, shift registers, display drivers and A/D Converters. The accelerometer and MicroSD card are both utilizing the same SPI bus.

19

PIC18F46J50 Features
Parallel Master Port (PMP) Real-Time Clock and Calendar (RTCC) USB Device Capability Charge Time Measurement Unit (CTMU) Master Synchronous Serial Port (MSSP) Enhanced Capture/Compare/PWM (ECCP)

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 20

PIC18F46J50 microcontroller has two Enhanced Capture/Compare/PWM (ECCP) modules. These modules contain a 16-bit register, which can operate as a 16-bit Capture register, a 16-bit Compare register or a PWM Master/Slave Duty Cycle register.

20

PIC18F46J50 Features
Parallel Master Port (PMP) Real-Time Clock and Calendar (RTCC) USB Device Capability Charge Time Measurement Unit (CTMU) Master Synchronous Serial Port (MSSP) Enhanced Capture/Compare/PWM (ECCP) 10-Bit, 13-Channel Analog-to-Digital Converter

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 21

The 10-Bit Analog-to-Digital Converter allows conversion of an analog input signal to a corresponding 10-bit digital number with auto-acquisition capability and selfcalibration. On the starter kit, the Analog Channel 0 to Channel 3 are used together with the CTMU for the Capacitive Touch Buttons and Scroll Bar, while the Analog Channel 4 is used for the Potentiometer.

21

PIC18F46J50 Features
Parallel Master Port (PMP) Real-Time Clock and Calendar (RTCC) USB Device Capability Charge Time Measurement Unit (CTMU) Master Synchronous Serial Port (MSSP) Enhanced Capture/Compare/PWM (ECCP) 10-Bit, 13-Channel Analog-to-Digital Converter Two Enhanced USART

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 22

Two Enhanced USART modules with Auto-Wake-up on Start bit that supports RS485, RS-232 and LIN/J2602.

22

PIC18F46J50 Features
Parallel Master Port (PMP) Real-Time Clock and Calendar (RTCC) USB Device Capability Charge Time Measurement Unit (CTMU) Master Synchronous Serial Port (MSSP) Enhanced Capture/Compare/PWM (ECCP) 10-Bit, 13-Channel Analog-to-Digital Converter Two Enhanced USART Peripheral Pin Select
2006 Microchip Technology Incorporated. All Rights Reserved. WebSeminar Title Slide 23

A major challenge in general purpose devices is providing the largest possible set of peripheral features while minimizing the conflict of features on I/O pins. Peripheral Pin Select also allows peripherals to overlay each other. For example, mapping an interrupt on change input onto a UART receive pin allows the device to wake up from Sleep when a character is received. In addition, Peripheral Pin Select allows multiple pins to be used for a single output function, increasing the drive strength. In this demo the Peripheral Pin Select is used to multiplex the SPI communication lines with the PMP communication lines allowing for flexible usage of the I/O pins available on the part.

23

Connecting the Hardware

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 24

Now that we have discussed what is on the board and what features are available on the PIC18F46J50 product family, lets discuss how to use the PIC18F Starter Kit.

24

Connecting the Hardware

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 25

Once the starter kit software is installed, connect the provided USB cable (A to mini-B) to any available USB port on the PC or powered hub, then to the starter kit at the mini-B receptacle, on the application side of the board. The PC USB connection provides communication and power to the board. A MicroSD memory card used to story the demo applications may be connected to the starter kit at any time. If the cable is connected correctly, the green Power (D3) is lit. The OLED will display Microchip PIC18F Starter Kit startup menu and the application processor will wait for the Menu button to be pressed in order to load the MicroSD Bootloader.

25

Bootloader

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 26

The PIC18F Starter Kit is built around an MicroSD card bootloader. This bootloader allows multiple demos to be loaded into the SD-card and loaded into the microcontroller when they are selected from the bootloader menu.

26

Bootloader
Up S C R O L L Down Bootloader Firmware

User Interface

OLED Display

MDD File System

MicroSD Memory Card

Flash Program Memory

HEX File Parser

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 27

The Flash program memory of Microchips PIC18F46J50 device is readable, writable and erasable during normal operation over the entire VDD range. This feature gives the user the ability to perform bootloading operations. To demonstrate this feature, the MPLAB Starter Kit for PIC18 comes with a preprogrammed MicroSD card Bootloader that gives the ability to load, program, and run PIC18 applications from a MicroSD card. The MicroSD Bootloader accepts user inputs from the Capacitive Touch Buttons and Scroll Bar and uses the OLED display for user outputs. The MicroSD Bootloader uses substantial parts of the Microchip Memory Disk Drive File System to read files and folders from a MicroSD memory card.

27

Loading the Bootloader


Microchip PIC18F Starter Kit Press the menu button to load a new demo 9 Use up and down buttons to navigate. Press the accept button to select a file. Press menu button to continue

Card not detected! Please insert a valid MicroSD card to continue

>>HIDDEMO CDC_DEMO.HEX MSD_DEMO.HEX

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 28

When the board is powered, an welcome screen is displayed and the board waits for the Menu button to be pressed in order to load the bootloader. If the counter reach 0, the last programmed application will be loaded. A MicroSD memory card can be inserted at any time. When it will be detected by the MicroSD Bootloader, the MDD File System will be initialized, and the file structure will be displayed on the OLED. Please note, that only folders and HEX files will be displayed.

28

Loading Application Files


>>. .. MOUSE.HEX CUSTOM.HEX JOYSTICK.HEX
The following demo will be loaded: CUSTOM.HEX Press the R button to accept, or the L button to cancel Application image file: CUSTOM.HEX has been loaded. Press the R button to start the application or L button to cancel

File is loading. Please wait.

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 29

The user can press the Up and Down buttons to select a specific file or folder. If the Accept button will be pressed when a folder is selected, the MicroSD Bootloader will display on the OLED the content of that specific folder. To return one level up, the user can either press the Cancel button, or can use the Accept button when the .. folder is selected. If the Accept button is pressed when a HEX file is selected, the MicroSD Bootloader will prompt the user for a confirmation to load the file from the MicroSD memory card and to program it to the microcontrollers Flash memory. After this operation is finished, the user may choose to execute that application or to remain in the bootloader. If the Cancel button is pressed in the root directory, the MicroSD Bootloader will exit, and the last programmed application will be executed.

29

Precompiled Demo Applications

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 30

There are several precompiled demos that come loaded on the MicroSD card ready for testing on the PIC18F Starter Kit. These include a mouse demo using the accelerometer, a joystick demo again using the accelerometer, a custom Human Interface Device (HID) application that allows custom application data to be sent over the bus, a CDC demo that allows the board to appear like a serial port to the computer, and a mass storage demo that allows the board to appear like a drive on the computer.

30

Mouse Demo

PIC18F Starter Kit Mouse Demo v1.0

Press Menu to proceed

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 31

In this demo, the board will act like a USB mouse using the accelerometer as a tilt sensor. Hold the board flat relative to the ground for no movement. If you have difficulty finding the mouse cursor on the screen or if you keep losing it, please make sure that the board is flat relative to the ground. Tilt the board to move the cursor. Press the L button to left click and the R button to right click. Hold the menu button to return to the demo menu and to load a different application.

31

Joystick Demo

PIC18F Starter Kit Joystick Demo v1.0

Press Menu to proceed

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 32

In this demo, the board will act like a USB joystick. Tilt the board to move the joystick on the X or Y axes; use the scroll bar to move it on the Z axes. Use the potentiometer to rotate around the Z axes, touch the L and R capacitive pads to control the first and second buttons. A test program is included in the application folder for the joystick demo that allows testing of the joystick features. The Game Controllers option from the Microsoft Windows Control Panel can also be used to show the joystick behavior. Hold the menu button to return to the demo menu and to load a different application.

32

Custom HID Demo

PIC18F Starter Kit HID Custom Demo v1.0

Press Menu to proceed

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 33

In this demo, the board will act like a USB custom HID device. Connect the board to the host computer and run the HID PnP Demo.exe provided on the CD-ROM disk.

33

HID PnP Demo.exe

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 34

The PC application is reading the raw data from the capacitive pads, acceleration sensor and potentiometer. To demonstrate the bidirectional communication, the mTouchCalibrate button on the user interface is triggering the calibration routine of the mTouch library on the PIC18 Starter Kit. Hold the menu button to return to the demo menu and to load a different application.

34

CDC Demo

PIC18F Starter Kit CDC Demo v1.0

Press Menu to proceed

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 35

In this demo, the board will act like a USB Communication Device. When this demo application is connected for the first time to a host computer, it will ask for an INF file. In this case, point to the INF file provided on the CD-ROM disk in the CDC demo folder. After the complete enumeration, the board will appear like a serial port (COM) on the host computer and will start to send the raw data from the acceleration sensor. Use your preferred HyperTerminal software and connect to the COM port created by the board to see the data. Hold the menu button to return to the demo menu and to load a different application.

35

Card Reader Demo

PIC18F Starter Kit Card Reader Demo v1.0

Press Menu to proceed

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 36

In this demo, the board will act like a USB Mass Storage Device.

36

Card Reader Demo

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 37

Insert a MicroSD memory card and connect the board to the host computer. Files can be read, deleted and manipulated like any other drive on the computer. Hold the menu button to return to the demo menu and to load a different application.

37

Resources

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 38

Next we will see what resources are available for future study.

38

Application Development
Starter Kit Users Guide
Installed with the Starter Kit Shows how to create and debug your own application

MPLAB IDE and MPLAB C18 C compiler


Extensive on-line help

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 39

When you are ready to try your own application, or simply modify the demonstration project, refer to the starter kits Users Guide, which is installed in the Starter Kits Documentation directory. You can also refer to the extensive online help available for the MPLAB IDE and the MPLAB C18 C compiler.

39

Web Sites
www.microchip.com
Libraries Application Notes Data Sheets Family Reference Manuals

www.microchip.com/usb

2006 Microchip Technology Incorporated. All Rights Reserved.

WebSeminar Title

Slide 40

Go to the Microchip website, www.microchip.com, for the full, most recent version of the libraries and application notes used in this demonstration. You can also find the appropriate data sheets and Family Reference Manual chapters at this site. For more information about the USB Library, go to www.microchip.com/usb.

40

Tutorial for MPLAB Starter Kit for PIC18F


2006 Microchip Technology Incorporated. All Rights Reserved. WebSeminar Title Slide 41

Thank you for taking your time viewing this webinar. We hope you found it useful and would love to hear any comments, suggestions, or requests that you have.

41

Potrebbero piacerti anche