• No results found

Usb Interfacing With Pic Microcontroller[Step by Step]

N/A
N/A
Protected

Academic year: 2021

Share "Usb Interfacing With Pic Microcontroller[Step by Step]"

Copied!
5
0
0

Loading.... (view fulltext now)

Full text

(1)

USB 1.0 INTERFACING WITH PIC MICROCONTROLLER

[STEP BY STEP TUTORIAL]

NAASIF NOMAAN 8:08 AM INTERFACING, MICROCONTROLLER, PIC, PIC18F2550, STEP BY STEP, USB, USB 1.0, W IT H NO COMMENTS

USB communication is better than serial communication , i think . Hardware interfacing is very easier than Rs 232 . In USB 1.0 communication Low Speed -1.5Mbit/second & High Speed -12Mbit/second . The upgrade version brings upgrade speed than older . USB-3.0 has higher speed , 5Gbit/second and it's called super speed .For more information you can visit this page >> Wikipedia Usb.

In this tutorial i will use pic18f2550 microcontroller & it is very popular for usb .Now you can make a question , when usb gets high speed or low speed . At 6MHz clock we will get low speed and at 48MHz Clock we will get High speed . In this tutorial we will try to make higher speed connection .We are not going to use 48MHz ,because it is very noisy .We will try another technique instead of it .Microchip company provides internal PLL( Phase Locked Loop ) circuit in some of speciäc products and pic18f2550 has internal PLL Circuit .Now look at the picture :

PLL Circuit

The PLL circuit converts 4MHz clock to 48MHz clock .So, we need 4MHz clock . We have to divide the clock in such way so that we can get result 4MHz. Look at here , If we use 20MHz divide it by 5 and we get 4 .Example : (20/5)=4 ,(12/3)=4.. .We have to deäne this in the source code.

Now let's create a project in Proteus 8.

Proteus 8 Circuit :

Step 1:

How to Create Project in Proteus _1

Step 2:

How to Create Project in Proteus 8_2

Step3 :

How to Create Project in Proteus 8_3

Step 4:

Step 5:

Search Search in this Blog!

POPULAR POSTS ALL POSTS

Bookmark this Blog

Bookmark this Blog

POPULAR POSTS

Matrix [4x4] Keypad interfacing with PIC Microcontroller [ PIC18f2550 ] in Proteus [Step by Step]

Matrix Keypad interfacing with PIC Microcontroller [ PIC18f2550 ] in Proteus [Step by Step] Basically a matrix keypad[ 4x4] can be c...

Bipolar Stepper Motor Interfacing With PIC Microcontroller (PIC18F2550) in Proteus [step by step]

Stepper Motor (animation source : wikipedia) Stepper Motors and It's Working Princ...

Real Time Digital Clock Using DS1307 and PIC

Microcontroller [step by step ]

This tutorial contains description about microcontroller based digital clock and DS1307 .We know microcontroller is a computer and speciä...

How to make PCB (Printed Circuit Board) at Home [step by step]

Today i will show how to make PCB at home . PCB means Printed Circuit Board . Would you like to know more about PCB? , please follow the l...

Rs 232 , Serial Communication with PIC Microcontroller in Proteus [step by step details]

Basically a microcontroller or computer can communicate with other computer through serial communication. .If we would like to make a suc...

Microcontroller Project : Digital Voting Machine using PIC Microcontroller ( PIC18f2550 )

Generally Digital Voting Machine is one kind of microcontroller based machine which can be performed in election . Once i had made Di...

Servo Motor Interfacing With PIC Microcontroller ( PIC18F2550 ) in Proteus [step by step]

Servo Motor Servo motors are very popular in the äeld of robotics .In this tutorial i will show how to interface servo motor wit...

Usb 1.0 Interfacing With PIC Microcontroller [step by step tutorial]

USB communication is better than serial communication , i think . Hardware interfacing is very easier than Rs 232 . In USB 1.0 communic...

Lcd 16x2 Scrolling Display Using PIC Microcontroller [Step by Step]

In this tutorial , i will show how to make a Scrolling Display using LCD and PIC18F2550 . Generally LCD display has 16 pins . 16x...

Introduction to PIC 18F2550 Micocontroller

Microcontroller : Basically microcontroller is one kind of Integrated circuit (IC) which can be deäned as the single chip...

Powered by Blogger.

Live Trafäc Stats

ALL POSTS

▼ 15 (15) ► Jul (5) ► Jun (2) ▼ Jan (8)

PIC Experiment Kit [for 28pin] with PCB Design

Usb 1.0 Interfacing With PIC Microcontroller [step...

Rs 232 , Serial Communication with PIC Microcontro...

Servo Motor Interfacing With PIC Microcontroller...

DC Motor Interfacing with PIC Microcontroller ( PI...

Bipolar Stepper Motor Interfacing With PIC Microco...

Unipolar Stepper Motor Interfacing With PIC Microc...

Real Time Digital Clock Using DS1307 and PIC Micro...

► 14 (7)

TAGS

pic18f2550

(14)

microcontroller

(11)

using

(11)

How to

(9)

step by step

(9)

interface

(8)

pic microcontroller

(7)

proteus

(7)

Microcontroller Project

(6)

picmicrocontroller (5) PIC (4) interfacing (4)

microchip (4) microcontroller_project (4)

microcontrollers (4) with (4) Pic Tutorial (3)

microchips (3) microcontroller programming

(3) mikroC (3) simulation (3)

MICROCONTROLLER TUTORIAL [STEP BY STEP]

Pic Microcontroller Tutorial For Beginners With Step By Step Picture.

HOME FREE SOFTWARE DOWNLOAD

FREE DOWNLOAD

SOURCE AND DESIGN

FREE DOWNLOAD

ABOUT

Lcd 16x2 (2)

(2)

How to änd parts in Proteus 8

Step 6:

How to änd parts in Proteus 8

Step 7:

Usb 1.0 Interfacing With PIC Microcontroller Circuit

Now let's create a project in MikroC , because we need source hex äle to load .

MikroC Code :

Step 1:

Create New Project in MikroC_1

Step 2:

Create New Project in MikroC_2

Step 3:

Create New Project in MikroC_3

Step 4:

Include All Library

Step 5:

Editing MikroC project settings_1

Step 6:

Editing MikroC project Settings_2

GOOGLE+ FOLLOWERS

Your email Address... Subscribe

Be the first of your friends to like this

Microcontroller T

52 likes

Like Page

Like Page ShareShare Temperature (1) Thief Detector (1) USB (1) Unipolar (1) Water (1) at (1) battery (1) blinks (1) board (1) button (1) by step (1) circuit (1) clock (1) electronic (1) experiment kit (1) åash (1) åashing (1) home (1) how (1) i2c tutorial (1) in (1) key pad (1) keypad (1) lavel (1) led (1) level (1) lm35 (1) machine (1) make (1) making (1) matrix (1) max232 (1) membrane keyboard (1) meter (1) mikroc pro for pic (1) musical (1) printed (1) push (1) real (1) scroll (1) scrolling (1) sensor (1) serial port rs232 (1) step (1) step bystep (1) tank (1) time (1) tone (1) usb 1.0 (1) voltmeter (1) voting (1) work (1) Copyright © Microcontroller Tutorial [Step by Step] | Powered By Blogger

Distributed By Blogger Template | Blogger Theme By NewBloggerThemes

Back to Top ↑

(3)

1. As we know PLL circuit take input 4MHz clock . So we have to divide 12MHz by 3 so that we can get 4MHz clock .If we use 4MHz we have no need this part .

2 & 3 . We are using USB 1.0 and it's High Speed clock 48MHz .So we have to devide it by 2

4 . Here we are using 12MHz Crystal clock and the oscillator selection should be HS Oscillator

5 . We have to enable voltage regulator .Basically it is an internal 3.3 voltage regulator of pic18f2550.If we enable it , it is required to connect vusb pin with a 220 nf capacitor .

#Source Code :

unsigned char receivedata[64] absolute 0x500; // <--Variable Declaration unsigned char senddata[64] absolute 0x580;

int i=0; void Interrupt(){

USB_Interrupt_Proc(); //<--Interrupt function }

void main() //<--The Main Function {

HID_Enable(&receivedata,&senddata); //<--To Enable HID while(1){ //<-- Infinity LOOP

while(!HID_Read()); //<--for reading for(i=0;i<64;i++){

senddata[i]=receivedata[i]; //<--Sending received data to senddata[i] variable }

while(!HID_Write(&senddata,64)); //<--for writting }

}

1.

unsigned char receivedata[64] absolute 0x500;

unsigned char senddata[64] absolute 0x580;

Here we have created character type two array variable senddata & receivedata. During USB Communication we must have to keep all data in usb RAM ।PIC 18F2550

microcontroller's USB RAM memory address begins with 0x500 and ends with 0x7F.That's why, we kept the receivedata[64] in 0x500 location and senddata[64] in 0x580 .

2.

void Interrupt(){

USB_Interrupt_Proc();}

void Interrupt() is one User Deäne function which contains USB_Interrupt_Proc() function inside . Interrupt makes restriction for something .When we enable the interrupt function , the connection is disabled.When we disable the interrupt function , the connection is enabled .

3.

HID_Enable(&receivedata,&senddata);

This function will enable the USB1.0 .It keep received data at receivedata and send data which are stored in the senddata variable .

Note : HID means "Human Interface Device"

4.

char HID_Read();

This function receive data. If receiving is failed ,it returns 0

.Otherwise it returns character .

while(!HID_Read());

It means , this function tries to receive data until data are being received .

char HID_Write();

This function receive data. If receiving is failed ,it returns 0

.Otherwise it returns the numbers of data .while(!HID_Write());

It means , this function tries to send data until data are being sent .

5.

for(i=0;i<64 escaped-font=""

data-blogger-escaped-i="">

senddata[i]=receivedata[i];

}

This loop will run from 0 to 63 and will keeps the received data to senddata variable from receivedata variable.

#Descriptor File Addition

Descriptor File : This äle will make your pc understand about device's

informations.Like

Manufacture Name, Product ID , Vendor ID etc.

Now i will show you .How to create a Descriptor äle . Step 7:

Create Descriptor File_1

Step 8:

Create Descriptor FIle_2

Step 9:

(4)

Adding Descriptor File

Step 10:

Step 11:

Step 12:

How to upload hex äle in proteus_1

Step 13:

How to upload hex äle in proteus_2

Step 14:

How to upload hex äle in proteus_3

Step 15:

In proteus Simulation we need to install virtual usb .

Install Virtual USB in proteus

Step 16:

Run Project

Now go to the Proteus Circuit and Just Run the project .

Output:

Now go to the Tool >>HID Terminal >> click on Terminal .

(5)

? Facebook ? Twitter ? Google+ ? Stumble ? Digg

← Newer Post Older Post →

Related Posts Widget

HID Terminal Output

Download Proteus File & MikroC File

Just Click on

''

SKIP ADD

''

and You will get the

download link

Thank You!

Reactions: Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

References

Related documents

The main objective of this work was to develop, implement, and evaluate a web-based scheduling application for a collaborative preparation of class schedules at

altera showed a distinct effect on the emergence and survival of annual and perennial species 28.. and negatively affected the growth of individuals belonging to both groups

Mtech has unique venture creation experience and resources that it provides to faculty, staff and students (and we are actively. disseminating this outside of

Due to statements in the literature regarding the effectiveness, benefits, and likelihood of parents being more involved with younger children, the second hypothesis predicts that

Дітей шкільного віку (підготовчий, 1 – 12 класи загальноосвітніх спеціальних шкіл для дітей з порушеннями слуху (для глухих і слабочуючих);

Examples of predicates with modal, modality and phase verbs: 1a) Der Konsul musste diese Ida in Schtz nehmen. 1b) Konzul morade uzeti Idu u zańtitu. 2a) Unsere Tony soll

Depicted are the mutually adjusted odds ratios (OR) and 95% confidence intervals (95% CI) of the independent associations of lifetime ultraviolet radiation exposure (Panel A) or

My thesis deals with the impact advertisement creates on a customer’s preference of a brand. In other words, how does an ad in a