EasyHID and USB for Newbies??


Closed Thread
Results 1 to 40 of 69

Hybrid View

  1. #1
    Join Date
    Apr 2008
    Posts
    3

    Unhappy

    Like a lot of you I’m just starting to migrate some of my applications to USB. I’ve tried to us EasyHID to help me get started. I’ve read threw this post and it makes sense what I’m reading. My problem is that when I try to compile the PBP file it creates I get the compilation error

    ERROR: Macro USBINIT? not found in macro file.
    ERROR: Macro USBSERVICE? not found in macro file.
    ERROR: Macro USBIN?CBBL not found in macro file.
    ERROR: Macro USBOUT?CBBL not found in macro file.

    I’ve seen several posts’ that ask this question and I haven’t seen a good answer to what is causing it and how to fix it. I suspect it has to do with directory structure.

    I’m using MCSP 3.0.0.5 and PBP 2.47.
    PIC18F4550

    Please help,

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

    Default

    Hi mjwaldner,

    Using Microcode Studio, make sure you have the correct chip selected, 18F4550. The editor sometimes defaults to a different IC when you open it - this has caught me out a couple of times!

    Make sure that all the files that were generated by EasyHID are in the same folder as the file you are trying to compile - see attached image

    Let us know how you get on

    Cheers

    Rob
    Attached Images Attached Images  

  3. #3
    Join Date
    Apr 2008
    Posts
    3

    Red face

    Thanks Rob,
    I started over form scratch and it worked this time. I must have moved something to the wrong directory.
    My next question is. Should the computer recognize the USB device and try to install it automatically? I understand that I will need to work on the PC software to make it work but when I plug the USB cable into the PC nothing happens. It doesn’t try to install. I haven’t modified the software the Easy HID created. I just programmed it to the PIC 18F4550. Is there more code needed to initialize it.
    I’m just taking baby steps threw this. Any information is helpful.
    Thanks
    Matt

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

    Default

    In case it have already worked and if you haven't change the PID, VID and all other settings, if you plug the device you're not going to have any bubbles on the task bar.

    If you want some, you'll need to uninstall the device. That's pretty easy to do with USBDeview
    http://www.nirsoft.net/utils/usb_devices_view.html
    Steve

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

  5. #5
    Join Date
    Apr 2008
    Posts
    3

    Default

    I found out what was going wrong. It was a hardware problem. I did not turn on the USB Voltage Regulator in the melabs programmer. So now my PC is recognizing the USB HID.
    The problem I’m having now is that I can’t seem to get any data from the PIC to the VB.Net application. My VB application is recognizing that the device is plugged in or unplugged but nothing else. The application never seems to jump into the OnRead event.
    I must be missing something. What tells the VB aplication to jump to the OnRead event?

    Any suggestions.
    Thanks,
    Matthew

    This is what I have.
    Code:
     
    VB.Net----------------------------------------------------------------
        '*****************************************************************
        ' on read event...
        '*****************************************************************
        Public Sub OnRead(ByVal pHandle As Integer)
    
            ' read the data (don't forget, pass the whole array)...
            If hidRead(pHandle, BufferIn(0)) Then
                ' ** YOUR CODE HERE **
                ' first byte is the report ID, e.g. BufferIn(0)
                ' the other bytes are the data from the microcontrolller...
                TextBox1.Text = Chr(Val(BufferIn(1)))
            End If
        End Sub
    
    PICB----------------------------------------------------------------------
    
    ' ************************************************************
    ' * main program loop - remember, you must keep the USB      *
    ' * connection alive with a call to USBService every couple  *
    ' * of milliseconds or so...                                 *
    ' ************************************************************
    usbinit ' initialise USB...
    ProgramStart: 
       gosub DoUSBIn
    USBBuffer(0)=32
    USBBuffer(1)=16
       gosub DoUSBOut
       goto ProgramStart

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

    Default

    Comment out the GOSUB DoUSBIn and see if works better.

    I suggest you to have a look on USBDemo.
    http://www.picbasic.co.uk/forum/showthread.php?t=5418

    Maybe this one too
    http://www.picbasic.co.uk/forum/showthread.php?t=6463&
    Steve

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

Similar Threads

  1. Simple USB Comms Problem
    By awmt102 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 6th January 2010, 20:17
  2. EasyHID max usb buffer size
    By jizyjuice in forum USB
    Replies: 4
    Last Post: - 29th November 2007, 05:12
  3. Speed of USB EasyHID and Time problem
    By sjohansson in forum USB
    Replies: 10
    Last Post: - 18th January 2007, 22:21
  4. USB and EasyHID Problems
    By Rob in forum USB
    Replies: 8
    Last Post: - 6th January 2007, 18:19
  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