USBDemo, something to learn USB a little bit


Closed Thread
Results 1 to 40 of 279

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    The IN/OUT "Report" length is usually set in one of the easyHID dialogs.
    Or it can be changed manually in the Descriptor file.

    If you re-run easyHID for the same project, it will wipe out any changes you've made. So create a new project, set everything the way you want it in easyHID, then just copy the descriptor file to your existing project.

    hth,
    DT

  2. #2
    Join Date
    Jan 2007
    Location
    Brazil
    Posts
    108


    Did you find this post helpful? Yes | No

    Default

    Done! Perfect Darrel!

    Thanks a lot!
    Sylvio,

  3. #3
    Join Date
    Aug 2008
    Location
    Tucson AZ
    Posts
    3


    Did you find this post helpful? Yes | No

    Default

    Hello,

    First, Mister e This is an outstanding demo. Was able to get running right out of the box on a PIC18f4550.

    I've been trying to add an additonal 8 LEDs to the demo but keep getting overrun errors. Which I'm sure it's caused on the VB side. I'm almost sure the PIC side is ok as i can turn on the original 8 LED or the ones added to PORTD. Can even turn on 4 on PORTB and 4 on PORTD. I'm just unable to get all 16 working at the same time.

    I think my problem is in this part of the VB side code. I was hoping someone could point me back in the proper direction
    Code:
    Private Sub Check1_Click(index As Integer)
        '
        '   Convert PORTB check box to decimal value before sending it
        '   to USB bus.  Result is store in BufferOut(1)
        '
        Dim LoopCheck, PORTB As Byte
        PORTB = 0
        For LoopCheck = 0 to 15                                               ' 0 To 7
            PORTB = PORTB + (Check1(LoopCheck).Value * (2 ^ LoopCheck))
            Next
        BufferOut(1) = PORTB
        WriteSomeData
    End Sub
    Any assistance would be greatly appricated
    Last edited by Philtkp; - 8th August 2008 at 17:59. Reason: Formatting

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Philtkp View Post
    Private Sub Check1_Click(index As Integer)
    '
    ' Convert PORTB check box to decimal value before sending it
    ' to USB bus. Result is store in BufferOut(1)
    '
    Dim LoopCheck, PORTB As Byte
    PORTB = 0
    For LoopCheck = 0 to 15 ' 0 To 7
    PORTB = PORTB + (Check1(LoopCheck).Value * (2 ^ LoopCheck))
    Next
    BufferOut(1) = PORTB
    WriteSomeData
    End Sub
    PortB is a byte value. A byte runs 0-255...
    2 ^ 15 = 32,768 which is greater than 255!

  5. #5
    Join Date
    Aug 2008
    Location
    Tucson AZ
    Posts
    3


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    PortB is a byte value. A byte runs 0-255...
    2 ^ 15 = 32,768 which is greater than 255!
    I tried changing the variable, PortB to an Integer and Long with no positive results

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Philtkp View Post
    I tried changing the variable, PortB to an Integer and Long with no positive results
    Well of course it won't work.
    PortB is a Visual Basic Byte variable (or whatever you want) which gets stored in a Byte Array and sent over the USB to the PIC as a Byte variable stored in a Byte array, which is then stored in the PIC as a Byte variable.
    Code:
    Private Sub Check1_Click(index As Integer)
    '
    ' Convert PORTB check box to decimal value before sending it
    ' to USB bus. Result is store in BufferOut(1)
    '
    Dim LoopCheck, PORTB As Byte
    PORTB = 0
    For LoopCheck = 0 to 15 ' 0 To 7
    PORTB = PORTB + (Check1(LoopCheck).Value * (2 ^ LoopCheck))
    Next
    BufferOut(1) = PORTB
    WriteSomeData
    End Sub

  7. #7
    Join Date
    Aug 2008
    Location
    Tucson AZ
    Posts
    3


    Did you find this post helpful? Yes | No

    Default

    Can this be done using an array of bytes?

Similar Threads

  1. Bits, Bytes Words and Arrays
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 24
    Last Post: - 14th June 2016, 07:55
  2. How to receive stream of bytes using PIC USART
    By unifoxz in forum mel PIC BASIC Pro
    Replies: 34
    Last Post: - 20th June 2009, 10:38
  3. Replies: 9
    Last Post: - 31st July 2008, 08:56
  4. PICBasic newbie problem
    By ELCouz in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 12th February 2008, 00:55
  5. USART interrupt not interrupting right
    By Morpheus in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 6th March 2005, 01:07

Members who have read this thread : 1

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

Tags for this Thread

Posting Permissions

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