Need Help with USB using PIC18F2455


Closed Thread
Results 1 to 18 of 18

Hybrid View

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

    Default

    this section will cause you a problem
    Code:
    gosub DoUSBIn
    toggle led
    pause 100
    gosub DoUSBOut
    toggle led
    pause 100
    goto ProgramStart
    Why? because of this section
    Code:
    ' ************************************************** **********
    ' * main program loop - remember, you must keep the USB *
    ' * connection alive with a call to USBService every couple *
    ' * of milliseconds or so... *
    ' ************************************************** **********
    The easy way will be to use Darrel's instant interrupts. Here's the famous POST 148
    http://www.picbasic.co.uk/forum/show...&postcount=148
    Last edited by mister_e; - 14th April 2008 at 22:14.
    Steve

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

  2. #2

    Default

    Iam from begining not include delay of 100ms but I added them to give indication for led about where the code stuck and find that It's stuck in DousbIn subroutine. now I'm removed the delay time and the same problem , I don't know where is the problem ????????????

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

    Default

    Code:
    DoUSBIn:
            USBBufferCount = USBBufferSizeRX ' RX buffer size
            USBService ' keep connection alive
            USBIn 1, USBBuffer, USBBufferCount, TimeOut ' No data?, Getout of here
    TimeOut:
    return
    Do you still have the USB connection error?

    Maybe better to begin with USBDemo and work around with? There's a load of information in that thread (ok ~180 post to read but)
    Last edited by mister_e; - 14th April 2008 at 22:38.
    Steve

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

  4. #4

    Default

    I have the same problem I can't use your USBDEMO since I don't have pic18f4450 but I have pic18LF445, so in microcode when I switch to this model I have compile 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.

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

    Default

    You must mean 18F4455, so just use the files in attachment. Tested and work as expected here. i just forgot to change the device name in the top comments...

    @Darrel... link to this one too
    Attached Files Attached Files
    Last edited by mister_e; - 14th April 2008 at 23:39.
    Steve

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

  6. #6

    Default

    There is an error:
    ERROR Line 78: Syntax error. (USBDemo_4455.pbp)

    this line : UCFG = %00010100 ' enable internal USB pull-up, Full speed USB


    but when I comment it , it's compiled without any errors

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

    Default

    HA! so that mean you may use V2.47 of the compiler right?

    I thought i would remove the
    Code:
    UCFG    var byte EXT
    line because some had 'Redefinition of VAR' problem with V2.50.. anyways, it should work, unless you know what else to add

    I'm a bit mixed-up... your thread name is Need Help with USB using PIC18F2455
    Last edited by mister_e; - 14th April 2008 at 23:53.
    Steve

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

Similar Threads

  1. USB CDC Communications for Dummies!
    By Squibcakes in forum USB
    Replies: 104
    Last Post: - 15th January 2014, 14:43
  2. USB Bootloader.
    By HenrikOlsson in forum USB
    Replies: 22
    Last Post: - 2nd May 2013, 03:46
  3. Simple USB Comms Problem
    By awmt102 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 6th January 2010, 21:17
  4. One USB keyboard to Two USB Ports
    By picnaut in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 11th June 2009, 01:04
  5. USB PIC without USB Connection
    By Tissy in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 26th December 2005, 18:39

Members who have read this thread : 0

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