1. 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.
    Dismiss Notice

USB Basic & PC USBTerminal Demo

Discussion in 'Oshonsoft' started by ericgibbs, May 22, 2011.

  1. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,189
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    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.
     

    Attached Files:

  2. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,170
    Likes:
    910
    Location:
    Rochdale UK
    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
     
  3. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,189
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    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
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,170
    Likes:
    910
    Location:
    Rochdale UK

    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
     
  6. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,189
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    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.
     
  7. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,189
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    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: May 24, 2011
  8. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,170
    Likes:
    910
    Location:
    Rochdale UK
    Thanks Eric!! I might try and work in microchips MSD with SD there are pretty good examples that come with the libraries...

    Ian
     
  9. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,189
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    hi,
    This is the HID USB def doc.
     

    Attached Files:

Share This Page