SEARCH
TOOLBOX
LANGUAGES
Register    Login    Forum    Search    FAQ

Board index » Electronics Projects » PIC18F USB development




Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: understanding the PIC18F USB project code
 Post Posted: Thu Apr 26, 2012 12:37 pm 
Offline

Joined: Thu Apr 26, 2012 12:24 pm
Posts: 1
i have successfully built the PIC18F USB device and it work just well, but now i want to use the same concept of using vb in creating the interface in order to control 2 motors, but before i can do that, i have to understand the code behind it.

I need to know which code in VB that sends the data to the uC in order for the uC to execute the command. Does it work like this, the VB send a string command, then the uC interpret the string to appropriate function in the uC source file?. but which code in the vb.

here is the project that i referred to.
http://www.waitingforfriday.com/index.php/Building_a_PIC18F_USB_device


Top 
 Profile  
 
 Post subject: Re: understanding the PIC18F USB project code
 Post Posted: Tue May 15, 2012 3:00 pm 
Offline

Joined: Tue May 15, 2012 2:50 pm
Posts: 6
Hello.

I'm a begginner in this world of pic's programming...

I do a little IO Board with Pic18F2550... this:

h--p://electronics-diy.com/USB_IO_Board.php

Now i need the Hex file for pic but i can't find... I search in google and i found this wonderfoul site. With many information.

I like to ask if i can use this files http://www.waitingforfriday.com/index.p ... USB_device for my pic???

regards
joshuac


Top 
 Profile  
 
 Post subject: Re: understanding the PIC18F USB project code
 Post Posted: Tue May 15, 2012 8:54 pm 
Offline

Joined: Thu Apr 01, 2010 6:23 am
Posts: 885
Hi

The projects on this site will work with your board as long as it is fitted with a PIC18F2550.

You will (of course) need to add in any other components (like LEDs and switches) as required.

To get the hex file first download the source code for the project. Then you will need the appropriate microchip compiler and MPLAB. This can all be downloaded for free from microchip's website. Once you have this you can build the source into a hex file and load it on your PIC.

/Simon


Top 
 Profile  
 
 Post subject: Re: understanding the PIC18F USB project code
 Post Posted: Tue May 15, 2012 9:46 pm 
Offline

Joined: Thu Sep 22, 2011 2:35 am
Posts: 77
Location: Carlisle England
If you do a search for 0x80 in the VB source file you will come across the basic commands.


Top 
 Profile  
 
 Post subject: Re: understanding the PIC18F USB project code
 Post Posted: Wed May 16, 2012 9:56 am 
Offline

Joined: Tue May 15, 2012 2:50 pm
Posts: 6
Hello

Thanks for yours support. For me is important.

I try to build the project in MpLab but i have one error. see log:

----------------------------------------------------------------------
Debug build of project `C:\WFF_Generic_HID_Demo_3_firmware\WFF Generic HID Demo 3\WFF_GenericHID_Demo_3.mcp' started.
Language tool versions: MPASMWIN.exe v5.45, mplink.exe v4.43, mplib.exe v4.43
Preprocessor symbol `__DEBUG' is defined.
Wed May 16 09:54:40 2012
----------------------------------------------------------------------
Make: The target "C:\WFF_Generic_HID_Demo_3_firmware\WFF Generic HID Demo 3\main.o" is out of date.
Executing: "C:\Program Files (x86)\MCC18\bin\mcc18.exe" -p=18F4550 /i"..\Microchip Solutions v2011-07-14\Microchip\Include" "main.c" -fo="main.o" -D__DEBUG -mL -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
C:\WFF_Generic_HID_Demo_3_firmware\WFF Generic HID Demo 3\main.c:30:Error [1027] unable to locate 'string.h'
C:\WFF_Generic_HID_Demo_3_firmware\WFF Generic HID Demo 3\debug.h:30:Error [1027] unable to locate './USB/usb.h'
C:\WFF_Generic_HID_Demo_3_firmware\WFF Generic HID Demo 3\debug.h:31:Error [1027] unable to locate './USB/usb_function_hid.h'
C:\WFF_Generic_HID_Demo_3_firmware\WFF Generic HID Demo 3\main.c:42:Error [1027] unable to locate './USB/usb.h'
C:\WFF_Generic_HID_Demo_3_firmware\WFF Generic HID Demo 3\main.c:43:Error [1027] unable to locate './USB/usb_function_hid.h'
Halting build on first failure as requested.
----------------------------------------------------------------------
Debug build of project `C:\WFF_Generic_HID_Demo_3_firmware\WFF Generic HID Demo 3\WFF_GenericHID_Demo_3.mcp' failed.
Language tool versions: MPASMWIN.exe v5.45, mplink.exe v4.43, mplib.exe v4.43
Preprocessor symbol `__DEBUG' is defined.
Wed May 16 09:54:40 2012
----------------------------------------------------------------------
BUILD FAILED

can help?? i read error 1027 and say:

EM-3 Compiler error: “Error [1027] unable to locate ‘p18cxxx.h’”

regards
joshuac


Top 
 Profile  
 
 Post subject: Re: understanding the PIC18F USB project code
 Post Posted: Wed May 16, 2012 10:19 am 
Offline

Joined: Thu Apr 01, 2010 6:23 am
Posts: 885
Hi

Did you follow the instructions correctly and install the Microchip Application Library as instructed?

http://www.waitingforfriday.com/index.p ... ource_code

Make sure you have followed this (especially the part marked 'Note').

/Simon


Top 
 Profile  
 
 Post subject: Re: understanding the PIC18F USB project code
 Post Posted: Wed May 16, 2012 10:39 am 
Offline

Joined: Tue May 15, 2012 2:50 pm
Posts: 6
ok i try to explain what i do.

a Create a folder in C:\ with the name: Pedro

Then i install the microchip-application-libraries-v2011-07-14-windows-installer in this folder. (c:\Pedro\)

Unzip the WFF_Generic_HID_Demo_3_firmware to this folder.

Then i have a folder Pedro with sub-folders:
- Microchip Solutions v2011-07-14
- WFF_Generic_HID_Demo_3_firmware


Go to folder WFF_Generic_HID_Demo_3_firmware open subfolder WFF Generic HID Demo 3 and open WFF_GenericHID_Demo_3.mcp with mplab.

Next go to Project - Build options - Project
Tab Directories select include Search Path - New and select the folder C:\Pedro\Microchip Solutions v2011-07-14\Microchip\Include - OK

now if i do Build ALL i have this:

----------------------------------------------------------------------
Debug build of project `C:\Pedro\WFF_Generic_HID_Demo_3_firmware\WFF Generic HID Demo 3\WFF_GenericHID_Demo_3.mcp' started.
Language tool versions: MPASMWIN.exe v5.45, mplink.exe v4.43, mplib.exe v4.43
Preprocessor symbol `__DEBUG' is defined.
Wed May 16 10:38:13 2012
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "C:\Program Files (x86)\MCC18\bin\mcc18.exe" -p=18F4550 /i"C:\Pedro\Microchip Solutions v2011-07-14\Microchip\Include" "main.c" -fo="main.o" -D__DEBUG -mL -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
C:\Pedro\WFF_Generic_HID_Demo_3_firmware\WFF Generic HID Demo 3\main.c:30:Error [1027] unable to locate 'string.h'
C:\Pedro\Microchip Solutions v2011-07-14\Microchip\Include\GenericTypeDefs.h:63:Error [1027] unable to locate 'stddef.h'
C:\Pedro\Microchip Solutions v2011-07-14\Microchip\Include\Compiler.h:62:Error [1027] unable to locate 'p18cxxx.h'
C:\Pedro\Microchip Solutions v2011-07-14\Microchip\Include\Compiler.h:116:Error [1027] unable to locate 'stdio.h'
C:\Pedro\Microchip Solutions v2011-07-14\Microchip\Include\Compiler.h:117:Error [1027] unable to locate 'stdlib.h'
C:\Pedro\Microchip Solutions v2011-07-14\Microchip\Include\Compiler.h:118:Error [1027] unable to locate 'string.h'
C:\Pedro\Microchip Solutions v2011-07-14\Microchip\Include\USB\usb_common.h:86:Error [1027] unable to locate 'limits.h'
Halting build on first failure as requested.
----------------------------------------------------------------------
Debug build of project `C:\Pedro\WFF_Generic_HID_Demo_3_firmware\WFF Generic HID Demo 3\WFF_GenericHID_Demo_3.mcp' failed.
Language tool versions: MPASMWIN.exe v5.45, mplink.exe v4.43, mplib.exe v4.43
Preprocessor symbol `__DEBUG' is defined.
Wed May 16 10:38:14 2012
----------------------------------------------------------------------
BUILD FAILED

I think i do all ok....

regards
joshuac


Top 
 Profile  
 
 Post subject: Re: understanding the PIC18F USB project code
 Post Posted: Wed May 16, 2012 12:26 pm 
Offline

Joined: Tue May 15, 2012 2:50 pm
Posts: 6
Hello Again :D

After search's and tests i think i found the solution :P

----------------------------------------------------------------------
Debug build of project `C:\Pedro\WFF Generic HID Demo 3\WFF_GenericHID_Demo_3.mcp' started.
Language tool versions: MPASMWIN.exe v5.45, mplink.exe v4.43, mplib.exe v4.43
Preprocessor symbol `__DEBUG' is defined.
Wed May 16 12:25:21 2012
----------------------------------------------------------------------
Make: The target "C:\Pedro\WFF Generic HID Demo 3\main.o" is out of date.
Executing: "C:\Program Files (x86)\MCC18\bin\mcc18.exe" -p=18F4550 /i"C:\Program Files (x86)\MCC18\h" -I"..\Microchip Solutions v2011-07-14\Microchip\Include" "main.c" -fo="main.o" -D__DEBUG -mL -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
Make: The target "C:\Pedro\WFF Generic HID Demo 3\usb_descriptors.o" is out of date.
Executing: "C:\Program Files (x86)\MCC18\bin\mcc18.exe" -p=18F4550 /i"C:\Program Files (x86)\MCC18\h" -I"..\Microchip Solutions v2011-07-14\Microchip\Include" "usb_descriptors.c" -fo="usb_descriptors.o" -D__DEBUG -mL -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
Make: The target "C:\Pedro\WFF Generic HID Demo 3\usb_device.o" is out of date.
Executing: "C:\Program Files (x86)\MCC18\bin\mcc18.exe" -p=18F4550 /i"C:\Program Files (x86)\MCC18\h" -I"..\Microchip Solutions v2011-07-14\Microchip\Include" "..\Microchip Solutions v2011-07-14\Microchip\USB\usb_device.c" -fo="usb_device.o" -D__DEBUG -mL -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
Make: The target "C:\Pedro\WFF Generic HID Demo 3\debug.o" is out of date.
Executing: "C:\Program Files (x86)\MCC18\bin\mcc18.exe" -p=18F4550 /i"C:\Program Files (x86)\MCC18\h" -I"..\Microchip Solutions v2011-07-14\Microchip\Include" "debug.c" -fo="debug.o" -D__DEBUG -mL -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
Make: The target "C:\Pedro\WFF Generic HID Demo 3\usb_function_hid.o" is out of date.
Executing: "C:\Program Files (x86)\MCC18\bin\mcc18.exe" -p=18F4550 /i"C:\Program Files (x86)\MCC18\h" -I"..\Microchip Solutions v2011-07-14\Microchip\Include" "..\Microchip Solutions v2011-07-14\Microchip\USB\HID Device Driver\usb_function_hid.c" -fo="usb_function_hid.o" -D__DEBUG -mL -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
Make: The target "C:\Pedro\WFF Generic HID Demo 3\WFF_GenericHID_Demo_3.cof" is out of date.
Executing: "C:\Program Files (x86)\Microchip\MPASM Suite\mplink.exe" /p18F4550 /l"C:\Program Files (x86)\MCC18\lib" "rm18f4550 - HID Bootload.lkr" "main.o" "usb_descriptors.o" "usb_device.o" "debug.o" "usb_function_hid.o" /u_CRUNTIME /u_DEBUG /z__MPLAB_BUILD=1 /z__MPLAB_DEBUG=1 /o"WFF_GenericHID_Demo_3.cof" /M"WFF_GenericHID_Demo_3.map" /W
MPLINK 4.43, Linker
Device Database Version 1.8
Copyright (c) 1998-2011 Microchip Technology Inc.
Errors : 0

MP2HEX 4.43, COFF to HEX File Converter
Copyright (c) 1998-2011 Microchip Technology Inc.
Errors : 0

Loaded C:\Pedro\WFF Generic HID Demo 3\WFF_GenericHID_Demo_3.cof.
----------------------------------------------------------------------
Debug build of project `C:\Pedro\WFF Generic HID Demo 3\WFF_GenericHID_Demo_3.mcp' succeeded.
Language tool versions: MPASMWIN.exe v5.45, mplink.exe v4.43, mplib.exe v4.43
Preprocessor symbol `__DEBUG' is defined.
Wed May 16 12:25:25 2012
----------------------------------------------------------------------
BUILD SUCCEEDED

It's ok???

regards
joshuac


Top 
 Profile  
 
 Post subject: Re: understanding the PIC18F USB project code
 Post Posted: Wed May 16, 2012 3:00 pm 
Offline

Joined: Thu Apr 01, 2010 6:23 am
Posts: 885
Looks like a successful build :)

Program a PIC from it; you should at least get a working USB enumeration even if your test board has no other peripherals. You certainly can't do any damage by trying ;)


Top 
 Profile  
 
 Post subject: Re: understanding the PIC18F USB project code
 Post Posted: Fri May 18, 2012 8:32 am 
Offline

Joined: Tue May 15, 2012 2:50 pm
Posts: 6
Hello Simon

The pic works good with my io board, and i test your Demo Software and everything ok i can do Led On and Led Off.

Now i go to next step... i try to do other thing..... i try explain....

I like to use a analog sensor to read the distance between the sensor and one part (see attach demonstration).

I think my problem is the software.... but first i read some documents and do some tests. If someone have tips i listen :D

regards
joshuac


Attachments:
example.jpg
example.jpg [ 25.79 KiB | Viewed 1247 times ]
Top 
 Profile  
 
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next

Board index » Electronics Projects » PIC18F USB development


Who is online

Users browsing this forum: Google [Bot] and 0 guests

 
 

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Translated by Maël Soucaze © 2009 phpBB.fr