PIC_and_USB.pdf
(
433 KB
)
Pobierz
PIC Communication with USB
By Roy Seifert
PIC Communication with USB
This page intentionally left blank
Revised July 17, 2010 for use with mikroBASIC PRO for PIC version 3.80
ii
PIC Communication with USB
Table of Contents
TABLE OF CONTENTS ..................................................................................................................................................................... III
INTRODUCTION ................................................................................................................................................................................. 13
HARDWARE ......................................................................................................................................................................................... 13
D
EVELOPMENT
B
OARD
........................................................................................................................................................................ 14
SOFTWARE........................................................................................................................................................................................... 14
PERSONAL THANKS.......................................................................................................................................................................... 14
USB COMMUNICATION .................................................................................................................................................................... 15
M
ICROCONTROLLER
C
ONFIGURATION
................................................................................................................................................. 15
USB
D
ESCRIPTOR
................................................................................................................................................................................ 17
A Few Words about Descriptors .................................................................................................................................................... 17
mikroBASIC Pro Descriptor Tool .................................................................................................................................................. 17
Modifying the Descriptor ............................................................................................................................................................... 18
How to Check if Your Descriptor is Working or Can the PC See My Device? .............................................................................. 23
SUMMARY ............................................................................................................................................................................................ 27
REFERENCES....................................................................................................................................................................................... 27
iii
PIC Communication with USB
This page intentionally left blank
iv
PIC Communication with USB
Introduction
The purpose of this article is to explain how to interface a PIC microcontroller to a PC via the USB port.
Although the concepts are universal, the examples are specifically for use with mikroElektronika’s
MikroBASIC Pro for PIC.
My journey into PIC microcontrollers and USB communication began with my interest in Microsoft® Flight
Simulator 2004. I am an instrument-rated private pilot, but due to medical reasons, I can no longer fly. FS
2004 gives a very good simulation of instrument flight. There are some things it won’t do, nor allow me to do,
but overall it satisfies my urge to fly in an instrument environment. Plus, it allows me to fly aircraft that in real
life I couldn’t afford to really learn how to fly. My wonderfully patient wife thinks it’s a dumb game because
she can’t ever see anything happening, but I know I’m cruising at 24,000 feet at 180 knots in pressurized
comfort and in total control!
I already had a flight yoke, throttle quadrant and rudder pedals, but I wanted to increase the realism of flight
simulator by using real physical switches and knobs instead of mouse clicks to activate avionics and cockpit
functions. I purchased the
Super Rotary Encoder
from Desktop Aviator which allowed me to interface 16
rotary or 32 push-button switches and up to 8 axes. By doing some fancy programming and installing a
program called FSUIPC I was able to interface with over 100 push-button switches and 10 rotary switches.
Unfortunately, I needed to add one more rotary switch, but I was out of room.
The
Super Rotary Encoder
was built with a PIC18F2450 microcontroller. I have a background in computers
and programming, so I figured I could build my own switch interface, and so my journey began.
Hardware
Usually the first place I look for inexpensive goods is Ebay®. I found a large number of PIC programmers, but
I felt I needed more. Searching the internet I found mikroElektronika, a company in Serbia, that produces both
the hardware and software that I needed.
13
Plik z chomika:
marek7771
Inne pliki z tego folderu:
Poradnik modelarski aerografy - Payo.pdf
(3894 KB)
Elektronika-http.pdf
(39909 KB)
dc20_win_2000_xp___b5(1).exe
(1209 KB)
dc20_win_2000_xp___b5.exe
(1209 KB)
Electronics_Projects_18.pdf
(98976 KB)
Inne foldery tego chomika:
Elektronic Ebook
elektronika 2
Epe Magazine
Heathkit
Radiotechnika Odbiorniki Lampowe i Tranzystorowe - H.Meluzin
Zgłoś jeśli
naruszono regulamin