Pic 18f Usb


Closed Thread
Results 1 to 40 of 135

Thread: Pic 18f Usb

Hybrid View

  1. #1
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762

    Default Pic 18f Usb

    Has anybody worked with these PICs:

    18F2455, 18F4455, 18F2550, 18F4550

    and EaysHID yet?

    Do you have any experience (or code) to share?

    I have received my ICD2 today and started playing with a 18F4550.
    (PICSTART+ doesn't suport the 18F4550!)
    Last edited by NavMicroSystems; - 29th June 2005 at 16:18.
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    I've used it, and if you're looking to get started with USB, then Dave's new
    EasyHID & the PIC18F4550 are definitely the way to go.

    Download & install EasyHID.
    http://www.mecanique.co.uk/products/usb/easyhid.html

    I have several projects for USB coming shortly, but in the mean time, I've
    loaded the files for a complete USB project on our website.

    The zip file contains PBP source code for a PIC18F4550, and VB source for a
    USB analog data-logger. Should be fun for anyone interested in tinkering with
    EasyHID and the new full-speed 18F USB parts.

    Here are the files: http://www.rentron.com/mcstudio/EasyHIDPrj.zip

    You'll need VB6 & SoftWire. You can download SoftWire from here. It's free.
    http://www.softwire.com/swdownload/softwiredownload.htm

    I used the activx controls in SoftWire for the analog meter interface. Really
    nice stuff.

    You'll also need PBP version 2.46 since this is the version offering support for
    the newer 18F USB parts.

    If anyone's looking for an excellent book on USB, then grab a copy of Jan
    Axelson's new 3rd edition of USB Complete. We just got them in. I spent the
    last few days reading mine, and it's awesome.

    Jan has done an outstanding job on her 3rd edition of this book. Even "I" can
    understand it now...;o]
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  3. #3
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

    Default

    I'm also in the middle of trying to use EasyHID. I'm just not sure where the USB18.ASM file fits in the grand scheme of things.

    I used the PIC18F4550, PBP and VB. The file is in the project PBP folder.

    I also got USB Complete as well as USB Design By Example. It's too bad they chose to use EZ-USB chips from Cypress or else I could have used their examples directly. Unfortunately I don't know enough about MPASM Assembler, let alone Cypress' version to convert things around.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  4. #4
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

    Default

    Is it complicated to get the generated code to be compatible with the slower USB speed? I'd like to be able to connect to PCs that do not yet have USB 2.0.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  5. #5
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

    Default

    Bruce,

    I get a LOT more files generated on the PIC side?

    It's that large Assembler file with all the VERY important USB routines that I don't know where that fits in. It doesn't seem to be linked with the PBP base program at all, or I missed something?

    Robert
    ?
    Attached Images Attached Images  
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  6. #6
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

    Default

    Bruce,

    Don't forget to add a README that mentions mcHID.dll and where the user can get it. Your PC-side code won't work without it.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  7. #7
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Hi Robert,

    You should have 8 (PBP) files total generated by EasyHID. All this stuff is required, and included when you compile for the 18F USB part.

    Look in your PBP\USB18 directory for USB.TXT. This explains what most of
    the files are.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  8. #8
    aman_b's Avatar
    aman_b Guest


    Did you find this post helpful? Yes | No

    Default links missing

    Hi
    I tried to access the link for zip file and the easy hid, but seems like they dont exist anymore. could you please attach them in the forum. That would very helpful
    Aman



    Quote Originally Posted by Bruce View Post
    I've used it, and if you're looking to get started with USB, then Dave's new
    EasyHID & the PIC18F4550 are definitely the way to go.

    Download & install EasyHID.
    http://www.mecanique.co.uk/products/usb/easyhid.html

    I have several projects for USB coming shortly, but in the mean time, I've
    loaded the files for a complete USB project on our website.

    The zip file contains PBP source code for a PIC18F4550, and VB source for a
    USB analog data-logger. Should be fun for anyone interested in tinkering with
    EasyHID and the new full-speed 18F USB parts.

    Here are the files: http://www.rentron.com/mcstudio/EasyHIDPrj.zip

    You'll need VB6 & SoftWire. You can download SoftWire from here. It's free.
    http://www.softwire.com/swdownload/softwiredownload.htm

    I used the activx controls in SoftWire for the analog meter interface. Really
    nice stuff.

    You'll also need PBP version 2.46 since this is the version offering support for
    the newer 18F USB parts.

    If anyone's looking for an excellent book on USB, then grab a copy of Jan
    Axelson's new 3rd edition of USB Complete. We just got them in. I spent the
    last few days reading mine, and it's awesome.

    Jan has done an outstanding job on her 3rd edition of this book. Even "I" can
    understand it now...;o]

  9. #9
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Sorry. These files are no longer available since the support applications you would need to install to use them have been discontinued.

    Mecanique dropped the free version of EasyHID, and the VB6 version of Softwire is no longer available. Without these two applications, the .zip file would be useless.

    See Mr E's USB example here: http://www.picbasic.co.uk/forum/showthread.php?t=5418
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  10. #10
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    problem now will be the .dll. Not sure if we are allowed to distribute it
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  11. #11
    Join Date
    Jul 2005
    Posts
    93


    Did you find this post helpful? Yes | No

    Default

    So basically now it's part of microcode studio right?

    This confused me too for a bit till i saw it in Microcode studio's "view" menu.

  12. #12
    wjfong's Avatar
    wjfong Guest


    Did you find this post helpful? Yes | No

    Default Re: Pic 18f Usb

    Quote Originally Posted by Bruce View Post
    I've used it, and if you're looking to get started with USB, then Dave's new
    EasyHID & the PIC18F4550 are definitely the way to go.

    Download & install EasyHID.
    http://www.mecanique.co.uk/products/usb/easyhid.html

    I have several projects for USB coming shortly, but in the mean time, I've
    loaded the files for a complete USB project on our website.

    The zip file contains PBP source code for a PIC18F4550, and VB source for a
    USB analog data-logger. Should be fun for anyone interested in tinkering with
    EasyHID and the new full-speed 18F USB parts.

    Here are the files: http://www.rentron.com/mcstudio/EasyHIDPrj.zip

    You'll need VB6 & SoftWire. You can download SoftWire from here. It's free.
    http://www.softwire.com/swdownload/softwiredownload.htm

    I used the activx controls in SoftWire for the analog meter interface. Really
    nice stuff.

    You'll also need PBP version 2.46 since this is the version offering support for
    the newer 18F USB parts.

    If anyone's looking for an excellent book on USB, then grab a copy of Jan
    Axelson's new 3rd edition of USB Complete. We just got them in. I spent the
    last few days reading mine, and it's awesome.

    Jan has done an outstanding job on her 3rd edition of this book. Even "I" can
    understand it now...;o]

    good day, just tried out the easyhid & got some problems here, haha... i got the error msg: unable to locate device item.

    can anybody tell me how can i rectify this problem??

    thanks alot

  13. #13


    Did you find this post helpful? Yes | No

    Question

    I've just started on this, having been encouraged by EasyHID.

    I noticed that the interrupt check box is disabled if PBP is the device code genrator selected. Does this mean that PBP programs have to jump to service the USB every 10ms? That's surely not very practical.

    Do ME Labs have a fix in the pipeline for this or do I feel an upgrade to my neglected Proton+ coming on?

    I can't see me investing the time in making USB work with PBP if the USB connection cannot be maintained in the background.

    Any advice greatly welcomed.


    Brian Walsh
    Glasgow
    Scotland

  14. #14
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

    Default

    I haven't started on the USB aspect yet, but offhand I would say that's the function of the "USBservice" command.

    An easy way to manage this? I have absolutely no idea yet.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  15. #15
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Please somebody shoot me if i'm wrong, didn't find time to play enough with USB, BUT none of both compiler will do the refresh for you.. sorry. Timer interrupt one of the way to go or keep track of your code and sprinkle few USBSERVICE. No big deal
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  16. #16
    paramotor's Avatar
    paramotor Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by NavMicroSystems
    Has anybody worked with these PICs:

    18F2455, 18F4455, 18F2550, 18F4550

    and EaysHID yet?

    Do you have any experience (or code) to share?

    I have received my ICD2 today and started playing with a 18F4550.
    (PICSTART+ doesn't suport the 18F4550!)

    You have try this circuit from this project
    http://www.sixca.com/eng/articles/usbdaq.php

  17. #17
    Join Date
    Feb 2005
    Location
    Essex, UK
    Posts
    154


    Did you find this post helpful? Yes | No

    Default Device Not Recognised

    Hi,

    I've built the simple piece of hardware using the 18F2550, it has been programmed as per the files generated by the EasyHID application.

    Having plugged the hardware into the USB port, it states the device is not recognised. I was expecting it to come up with the device name as i stated in the EasyHID compilation.

    I was expecting a .ini file or similar to be generated for the installation of the device.

    Can anyone help why this might be.

    Many thanks.

  18. #18
    Join Date
    Feb 2005
    Location
    Essex, UK
    Posts
    154


    Did you find this post helpful? Yes | No

    Default

    OK, seem to have that issue sorted now, it actually was something to do with the programming fuses.

    Although it now connects OK, when i look at the device manager, it only shows up as a 'USB Human Interface Device' and HID-Compliant Device' and not as i set in the EasyHID maker.

    Also, can anyone help with what is required at the VB and PIC end to light a simple LED. ie when i click a 'button' in the VB code, it turns an LED on one of the ports, ie PORTB.1.

    Many thanks,

    Steve

  19. #19
    Join Date
    Feb 2005
    Location
    Essex, UK
    Posts
    154


    Did you find this post helpful? Yes | No

    Default

    Can anybody help with the above request or point me in a direction of who / where might?

    Many thanks,

    Steve

  20. #20
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Hi Steve,

    If you have the PIC being recognized as an HID device, try this. It's real simple, but will allow you to control an LED from VB6 (should also work with VB5) but I don't have that to test it with.

    Create your VB code with EasyHID. Open the project, and drop two command buttons on your form. Add this code for your buttons --

    Private Sub Command1_Click()
    BufferOut(8) = 0 ' LED on
    hidWriteEx VendorID, ProductID, BufferOut(0)
    End Sub

    Private Sub Command2_Click()
    BufferOut(8) = 1 ' LED off
    hidWriteEx VendorID, ProductID, BufferOut(0)
    End Sub

    Modify the PBP code created by EasyHID something like this --

    PORTB = 0
    TRISB = 0

    usbinit ' initialise USB...
    ProgramStart:
    gosub DoUSBIn
    PORTB = USBBuffer[7]
    goto ProgramStart

    Note this doesn't send data, it's just a sit & spin simple app reading USB input, and placing the value received in USBBuffer(7) on RB.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  21. #21
    Join Date
    Jul 2008
    Location
    Now, I live in Tokyo, Japan
    Posts
    6


    Did you find this post helpful? Yes | No

    Question Full speed USBOUT

    Hi everybody,

    I am new in this forum. I use PBP compiler and VB6 for my application.

    The problem are:
    . When I used USBOUT to send the data via EndPoint #1 from PIC to PC, I can send only
    the spead upto 64kbit/s (I use oscilloscope to measure the time of sending
    one packet from PIC to PC, an the time is about 8ms for 64 Bytes).

    . If I use EndPoint #3 (virtual COM port), I can send data upto 115200 bit/s but it still
    so slow for my application because I need to send data about 10 Byte at 100 ksample/s

    My question is:
    How can I used PBP to send the data in hight speed mode or full speed
    mode? Normally, I used EasyHID from MicrocodeStudio to generate the
    template for PBP and VB.

    Hope to hear from you all soon.
    Last edited by lengcallrobot; - 14th July 2008 at 21:12.

  22. #22
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lengcallrobot View Post
    My question is:
    How can I used PBP to send the data in hight speed mode or full speed mode?
    PIC18xxxx USB capable PICs are not capable of the high speed (480mpbs) mode.

  23. #23
    Join Date
    Jul 2008
    Location
    Now, I live in Tokyo, Japan
    Posts
    6


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    PIC18xxxx USB capable PICs are not capable of the high speed (480mpbs) mode.
    So, how about full speed mode? What to do?

  24. #24
    Join Date
    Feb 2005
    Location
    Essex, UK
    Posts
    94


    Did you find this post helpful? Yes | No

    Default

    Hi Lengcallrobot and welcome to the forums!

    This is taken from the EasyHID help file contained in the EasyHID folder:

    "What is a HID Device?

    ...... One of the major advantages of HID is that you do not need to supply a custom driver, as one is already supplied with the operating system. A limitation of HID is that its data transfer rate is limited to a maximum of 64KB per second. However, this is still significantly faster than RS-232 (115200 baud is approximately 12KB per second)......"

    You should be able to send 64kBytes/sec in Full-speed mode as shown above.

    It looks to me as though you are sending data in Low-speed mode 64kbits/sec (or 8kBytes/sec) from what you have shown.

    Are you using a 48MHz clock source for the USB and have you set bit 2 of the UCFG register to enable Full-speed?

    I could be leading you up the garden path about the speeds but this is my understanding

    Hope this helps

    Rob
    Last edited by Rob; - 15th July 2008 at 09:09. Reason: Really should proof read before posting!

  25. #25
    Join Date
    Jul 2008
    Location
    Now, I live in Tokyo, Japan
    Posts
    6


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Rob View Post
    Are you using a 48MHz clock source for the USB and have you set bit 2 of the UCFG register to enable Full-speed?
    Thank Rob, however, I cannot set UCFG.2=1 or FSEN=1 in my program. When I do this, I get error message . the below is my source code in pbp

    ================================================== =================
    DEFINE OSC 48
    DEFINE LOADER_USED 1

    USBBufferSizeMax con 64 ' maximum buffer size
    USBBufferSizeTX con 64
    USBBufferSizeRX con 64

    ' the USB buffer...
    USBBuffer Var Byte[USBBufferSizeMax]
    USBBufferCount Var Byte

    'Variables -----------------
    I var byte
    Ana var word

    ' Define ports
    SP1 VAR PORTC.0

    ' ************************************************** **********
    ' * main program loop - remember, you must keep the USB *
    ' * connection alive with a call to USBService every couple *
    ' * of milliseconds or so... *
    ' ************************************************** **********

    TRISD = %11110000 'Set PORTD 0-3 to output, 4-7 to input
    'UCFG.2 = 1

    usbinit ' initialise USB...

    ProgramStart: 'Just want to test the USB speed

    high sp1
    gosub DoUSBIn
    low sp1
    gosub DoUSBOut

    goto ProgramStart

    ' ************************************************** **********
    ' * receive data from the USB bus *
    ' ************************************************** **********
    DoUSBIn:
    USBBufferCount = USBBufferSizeRX ' RX buffer size
    USBService ' keep connection alive (executed at least every 10ms)
    USBIn 1, USBBuffer, USBBufferCount, DoNext ' read data, if available
    PORTD = usbbuffer[2]
    Ana = (usbbuffer[0] << 7) | usbbuffer[1]
    freqout sp1,500,ana
    DoNext:
    return

    ' ************************************************** **********
    ' * wait for USB interface to attach *
    ' ************************************************** **********
    DoUSBOut:
    USBBufferCount = USBBufferSizeTX ' TX buffer size
    USBService ' keep connection alive (executed at least every 10ms)
    USBOut 1, USBBuffer, USBBufferCount, DoUSBOut ' if bus available, transmit data
    return
    ================================================== =================

    Do you know other way to get Full-Speed mode with pbp ?
    Thank you in advance.

  26. #26
    Join Date
    Dec 2008
    Posts
    48


    Did you find this post helpful? Yes | No

    Default

    I want to use EasyHID, so purchased Microcode Studio about one week ago. Since then, Mecanique has not responded to two emails, I cannot find where to download EasyHID, and am at a loss. Have since sent a complaint to WorldPay and have requested a refund... just in case.

    Where can one get hold of a copy of EasyHID? Or, are there other solutions out there, so I don't have to beg for the software from some vendor?

    Is Mecanique going out of business? Why doesn't anybody respond?

  27. #27
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by kirtcathey View Post


    Is Mecanique going out of business? Why doesn't anybody respond?
    Holiday season many businesses are closed. Try again Monday.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  28. #28
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    EASY ....

    Down boy, down ... That's better.

    David is a busy man.
    With MicroCode Studio, the PROTON IDE, Swordfish Basic, and others, the poor guys got his hands full.
    Please don't report him to Internet squeelers.

    Be nice, ask real questions ... he'll get back to you.
    <br>
    DT

  29. #29
    Join Date
    Dec 2008
    Posts
    48


    Did you find this post helpful? Yes | No

    Default

    Thanks again Darrel. Okay, I can understand that situation very well, since I tend to be a one-man band. However, it seems like with that much going on, he'd hire a spare geek or two to handle the front end.
    Getting back to the subject....

    I am building a proof-of-concept prototype (aren't we all!!) that will sit between the keyboard and host. When the end-user types in a certain character string or key combination, the microcontroller will send a control signal to another receiving device to start and stop a motor. Should I make this a keyboard HID, a generic device HID, or none at all and somehow pull information off the wire?

    Regards,
    Kirt

  30. #30
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by kirtcathey View Post
    ....

    I am building a proof-of-concept prototype (aren't we all!!) that will sit between the keyboard and host. When the end-user types in a certain character string or key combination, the microcontroller will send a control signal to another receiving device to start and stop a motor.

    ...

    What micro-controller will you use? Last I heard (maybe over a year ago), the PIC could not act as host to a USB device. Has a new model been released?

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  31. #31
    Join Date
    Dec 2008
    Posts
    48


    Did you find this post helpful? Yes | No

    Default

    Robert,

    Thank you.

    I'm using an 18F2550, since it's only 28 pins. Yes, I understand that it cannot be a USB host, which is why I am at a loss. What I am doing right now with somewhat positive results is programming for a keyboard device, then plugging the straight-wiring the keyboard to the host, then pulling power and data taps to the PIC. All is recognizing fine, except am working on finding the right host driver for this funky keyboard.

    Going to catch a train to Akihabara in a few minutes to pickup a generic USB keyboard and some other stuff.

  32. #32
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    I should mention that EasyHID comes with MicroCode Studio.

    It's located in the "C:\Program Files\Mecanique\MCSP\EasyHID" folder. (assuming default installation).

    In that folder, there is a file EasyHID.chm.
    Should answer most of your questions.
    DT

  33. #33
    Join Date
    Dec 2008
    Posts
    48


    Did you find this post helpful? Yes | No

    Default

    Right. And after reading a bunch of posts on these forums (many by you) about it... I want it even more! Or, do I? I am thinking that things may work out with just a generic keyboard HID for the time being, but not sure.

Similar Threads

  1. USB CDC Communications for Dummies!
    By Squibcakes in forum USB
    Replies: 104
    Last Post: - 15th January 2014, 13:43
  2. Reading a slave USB with a pic
    By pcaccia in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 25th October 2008, 12:00
  3. Replies: 15
    Last Post: - 30th October 2007, 19:25
  4. USB communication with pic
    By Shamir in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 14th August 2006, 23:43
  5. USB PIC without USB Connection
    By Tissy in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 26th December 2005, 17:39

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts