PDA

View Full Version : Steve's USBDemo with PBP 2.60 and MPLAB 8.33



Wirecut
- 18th August 2009, 09:04
Hi,

I have preferred to open a new tread about the USBDemo of Mister_E in order to have a clear start condition using the last release of PBP and the MPLAB.

I have downloaded from

D:\PIC\MEL\18F4550\USBDemo\MisterE_forum\1 USBDemo, something to learn USB a little bit - MEL PICBASIC Forum.mht

the USBDemo.zip, followed all indication about PIC18Xxxxx.BAL file, read the entire tread, and after I'm a little confused.

I have installed a fresh update of the PBP 2.60 and the latest MPLAB 8.33 with the obiective to learn USB.

Thanks to the better works and explanation of Steve and Darrel I'm confident at the end, I will be able to manage correctly the USB on 18F4550, but now I'm locked on a "simple" compiler error.

In the attached screen shot are visible the compiling errors, and the involved directory.

My WIN XP SP3 path is:

PATH=C:\Programmi\PC Connectivity olution\;C:\WINDOWS\system32;C:\WINDOWS;C:\WIN
DOWS\System32\Wbem;C:\Programmi\QuickTime\QTSystem \;D:\Programmi\Intel\WiFi\bin\
;D:\Programmi\Microchip\MPLAB IDE\VDI;D:\Programmi\Microchip\MPASM Suite;c:\pbp;

There are someting that I have made wrong?

Leo

Archangel
- 18th August 2009, 12:11
Hi Leo,
I'm not familiar with that piece of Steve's work, so I do not have the code to look at, but I can say, include files must be in the same directory as your source code, also apparently you need to comment out the config in the .inc file for that chip.
EDIT: OK I Found it : http://www.picbasic.co.uk/forum/showthread.php?t=5418

Wirecut
- 18th August 2009, 12:58
Hi Joe,

the "D" is a partition of the main hard disk. No CD are used.

I have copied into the source directory the following file:

pbppic18.lib
18F4550.bal
PBPUSB18.LIB

but the compiling errors remain the same.

Leo

Darrel Taylor
- 20th August 2009, 00:27
The first error in the image is from the PBPUSB18.LIB file in your PBP folder, which is installed with this default path to the Library ...

include "\PBP\PBPPIC18.LIB"

But if you didn't install it in the default folder C:\PBP, you have to change it to point to the correct location.

If using PBPL then that line is in PBPUS18L.LIB

You should not need to copy those files to the project directory.<hr>
However, the way USB works with PBP 2.60 has been changed considerably.
I really like the new way. Smaller code, leaves more RAM available for the user, don't have to mess with all those .inc and .bas/.bal files. It's much simpler now.

But anything from EasyHID no longer compiles for me, which includes mister-e's USBDemo.
That's not to say it can't be done, meLabs kept all the old USB files in the installation so there must be some way. I just haven't figured it out.

And since the new way works so well I'll probably not even try.

Take a look at the USB.TXT file in the USB18 folder, which is in the PBP folder.

Wirecut
- 20th August 2009, 11:01
Hi Darrel

many thanks for your answer, but now I'm a little bit confused.

If I have correctly understand, USBdemo cannot be compiled vith PBP 2.60? :(

Also I do not know if I'm using the PBL or PBP. Which is the difference?

On my previous screenshot you have seen an improper location of files, because, reading on different posts, someone says to copy those files on the source directory.

I have received from Crownhill the update CD to PBP 2.60 and I suppose on that CD there are all the necessary to build a correctly working enviroment for PBP 2.60.

I have followed all default proposed by the installer on my new notebook with XP SP3.

Do you know if there is somewhere a complete working example in PBP 2.60 / VB6?

Ciao

Leo

Darrel Taylor
- 21st August 2009, 09:43
I got to thinking about it some more and realized it would be easier to make mister-e's USBDemo work with PBP 2.60 than it would be to make PBP 2.60 compile the old USBDemo program.

This should help you out Leo.

http://www.picbasic.co.uk/forum/showpost.php?p=77423&postcount=198

hth,

Wirecut
- 22nd August 2009, 14:13
Hi Darrel,

Many thanks for you help.

I have followed the indication of yor post at:

http://www.picbasic.co.uk/forum/show...&postcount=198

but when i compile, I see errors as for the attached screen shot.

Any idea about the cause of this errors?

Leo

HenrikOlsson
- 22nd August 2009, 16:02
Sounds like you haven't commented out the __Config statements in the include file for your PIC. See this post (http://www.picbasic.co.uk/forum/showthread.php?p=6775#post6775) for more details.

/Henrik.

Wirecut
- 23rd August 2009, 12:25
Hi Henrik,

your suggestion is illuminating.

I have commented the following statement into the c:\pbp\18F455.inc

; __CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
; __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
; __CONFIG _CONFIG2L, _PWRT_OFF_2L & _BOR_ON_2L & _BORV_3_2L & _VREGEN_ON_2L
; __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
; __CONFIG _CONFIG3H, _CCP2MX_ON_3H & _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _MCLRE_ON_3H
; __CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _ICPRT_OFF_4L & _XINST_OFF_4L

and now the compilation go on without errors.

GREATH!

Ciao

Leo

Pic2008
- 18th June 2010, 14:10
Just a question, how do I configure the USB demo to send 550 bytes of data instead of the default 8? I tried setting the PBP code to:

USBBufferSizeRX con 550 ' output

USBBufferIn var byte[550]


and VB code to:

Private Const BufferOutSize = 550

and then trx array[549] to PIC. PIC didn't seem to receive this byte.

Any idea?

Ioannis
- 18th June 2010, 14:48
Hmm, PBP cannot support that amount of data. The arrays areup to 256 bytes.

Ioannis

rsocor01
- 18th June 2010, 21:12
Just a question, how do I configure the USB demo to send 550 bytes of data instead of the default 8? I tried setting the PBP code to:

USBBufferSizeRX con 550 ' output

USBBufferIn var byte[550]


and VB code to:

Private Const BufferOutSize = 550

and then trx array[549] to PIC. PIC didn't seem to receive this byte.

Any idea?

The number of bytes to be sent are set in the HID descriptor file. For PBP 2.50 the allowed values are (if I remember correctly) 8, 16, 24, and 64. Just send 8 bytes at a time until you get the number of bytes that you need.

I am not familiar with the PBP version 2.60 yet. But, I would guess it is the same.

Robert

Pic2008
- 19th June 2010, 04:11
Oh, but sending in multiple packets might result in delay in time sensitive application. But looks like I have no other choice.

Thanks for the suggestion.

rsocor01
- 20th June 2010, 02:10
Oh, but sending in multiple packets might result in delay in time sensitive application. But looks like I have no other choice.

Thanks for the suggestion.

Use the USBCDC.BAS demo in the USB18 directory for a faster data transfer.

Robert

Demon
- 19th January 2012, 20:38
Thread moved from Code Examples

Robert