Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

USB Basic & PC USBTerminal Demo

Status
Not open for further replies.

ericgibbs

Well-Known Member
Most Helpful Member
A Basic program and PC exe program, that demonstrates the HID USB feature of Oshonsoft with the 18F2550 PIC.

Requires a 2 or 4 line LCD and adc input potentiometer.

Unzip the USB_Term2.zip
Files: USB_Demo3.bas,, USB_Term2.exe,,,USBTERM2.gif

NOTE: The Oshonsoft USB option must be installed in your PC.

If required, a Velleman K8055 USB PCB conversion to18F2550 diagram and Demo.bas is available.
 

Attachments

  • USB_Term2.zip
    47.9 KB · Views: 380
  • USBTerm2.gif
    USBTerm2.gif
    17.5 KB · Views: 434
Eric... I know you don't help via PM's but... Have you any idea how fast Vladimir's USB is running? I have a small datalogger that stores data on a 1mbit eeprom then uploads to a PC via Vladimir's ocx, But it appears slower than RS232 running @ 57600bps... The USB peripheral can run at 96mhz but from his examples a 20mhz xtal is used... according to the data sheet a 4mhz xtal + pll will give you 96mhz on the USB ad 48mhz on the PIC side... There isn't a 96mhz available when using 20mhz..

My question is.. Have you attempted a faster connection? If so what config settings did you use..

Ian
 
hi Ian,
The Oshonsoft USB is HID speed, using 8 bytes each for Reports and Features.
If you check the HID data transfer rates its pretty slow , just better than 9600 baud.!

I will dig out some info and post it later.

Eric
 
Thanks for that! I thought it was my software configuration.... It does explain why, if I set the clock speed to 96mhz... it just doesn't work.

Thanks again.

Ian

hi Ian,
I use a 20MHz xtal and the internal PLL of the 18F2550 to drive the USB
There has been a query raised on the Yahoo PIC user group about the 'actual' frequency that the OSH uses for the USB.

I try to do as much maths and processing of the data in the 18F2550 and then use the PC to read the processed data Reports/Features.
Basically I fill all 16 bytes before reading.

extract from data source.
PLLDIV=5 ' This sets the PLL Postscaler to divide the primary osc input by 5
providing 4MHz to the 96MHz PLL. The 96MHz PLL input must always be 4MHz
as shown in the data sheet.

CPUDIV=OSC1_PLL2 ' This sets the PLL Postscaler to divide the 96MHz PLL
output by 2 providing a 48MHz clock to the CPU.

USBDIV=2 ' This divides the 96MHz PLL output by 2 providing 48MHz to the
USB core.

FOSC=HSPLL_HS ' This enables HSPLL for high-speed crystal/resonator.
 
hi Ian.
Some quick testing of the OSH HID USB.
Using a 18f2550 with 20MHz xtal and 4*PLL [ 96MHz] connected to a PC Win XP 3.06GHz.

The PIC is a simple increment counter for 2 Words, on each increment the USBSERVICE is called.

Reading from the PIC using a PC based VB5 program, reading the REPORT 8 bytes from the PIC, no displayed or recording, just incrementing a receive counter.

The best I can get is 250 Reports/sec so thats 2000bytes/sec [ 4m/sec per Report]

The PIC internal incrementing counter increases by ~300 for every Report reading.
 
Last edited:
Thanks Eric!! I might try and work in microchips MSD with SD there are pretty good examples that come with the libraries...

Ian

hi,
This is the HID USB def doc.
 

Attachments

  • HID1_11.pdf
    659.9 KB · Views: 563
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top