Disable USB please help...


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Nov 2008
    Posts
    6

    Default Disable USB please help...

    Hi all,
    I have a problem with 18f4550. I use pic basic pro and when I send information from pc, I want to show this info on 16-segments. But, in my experiences, if usb module is active, I can't use 16-segments ( I use 8 of 16-segment) In short, I have to save this incoming info at EEPROM, but again, if USB Module is active, it don't save on EEPROM :s ( I use "write")

    My question is, how can I disable USB (to make save) or how can I make save when USB is active

    please help me, this is my school project and I have to do this. I can transfer data by Visual basic and use it on 8 of leds, but I have to do it with 16-segment display.

    Thanks

    NOTE: I'm using Proteus 7.4 simulation, I don't know if a real 18f4550 can save while USB active.

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


    Did you find this post helpful? Yes | No

    Default

    Seeing your code would help...
    Steve

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

  3. #3
    Join Date
    Nov 2008
    Posts
    6


    Did you find this post helpful? Yes | No

    Default

    I've just used the usb wizard ( this is'nt whole code, it's on my desktop, but this code don't work ( )

    TRISB =%00000000

    DEFINE OSC 48
    DEFINE LOADER_USED 1

    'PORTB = 0

    USBBufferSizeMax con 8 ' maximum buffer size
    USBBufferSizeTX con 8 ' input
    USBBufferSizeRX con 8 ' output

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


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

    ProgramStart:

    usbinit
    gosub DoUSBIn
    gosub DoUSBOut

    write 0,USBbuffer[1] ' ******* or asd=usbbuffer[1] write 0,asd
    '**don't save, why ?


    Goto ProgramStart:

    ' ************************************************** **********
    ' * receive data from the USB bus *
    ' ************************************************** **********
    DoUSBIn:
    USBBufferCount = USBBufferSizeRX ' RX buffer size
    USBService ' keep connection alive
    USBIn 1, USBBuffer, USBBufferCount, DoUSBIn ' read data, if available
    return

    ' ************************************************** **********
    ' * wait for USB interface to attach *
    ' ************************************************** **********
    DoUSBOut:
    USBBufferCount = USBBufferSizeTX ' TX buffer size
    USBService ' keep connection alive
    USBOut 1, USBBuffer, USBBufferCount, DoUSBOut ' if bus available, transmit data
    return


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


    Did you find this post helpful? Yes | No

    Default

    Do a little test...
    Code:
    HIGH LED
    write 0,USBbuffer[1]
    LOW LED
    Use a scope to see if there's some activity on LED pin. If not, you may want to comment of of these to see where your program stuck
    Code:
    usbinit
    gosub DoUSBIn
    gosub DoUSBOut
    I can't tell for Proteus, but I'm always impressed to see how rich students are
    Last edited by mister_e; - 26th February 2009 at 13:57.
    Steve

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

  5. #5
    Join Date
    Nov 2008
    Posts
    6


    Did you find this post helpful? Yes | No

    Default

    welll I confess, I'm using school computers, for Proteus ( I'm not rich )

    I'll try it by real 4550 but, a little question, when I tried your USBDemo (mister_e), I realized that after resetting the pic, still the same leds are high ( some kind of save I think) but in your codes, there is no "write" command and I tried it with usb wizard just like my example, it works fine but when I reset the pic all leds are off. why yours are still on ?

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


    Did you find this post helpful? Yes | No

    Default

    are you using my schematic?
    Steve

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

  7. #7
    Join Date
    Nov 2008
    Posts
    6


    Did you find this post helpful? Yes | No

    Default

    I don't know your sch. but, I've used a standart sch. I guess it was in micro code studio. easy hid wizard help. but I tried your USB Demo

Similar Threads

  1. USB CDC Communications for Dummies!
    By Squibcakes in forum USB
    Replies: 104
    Last Post: - 15th January 2014, 13:43
  2. USB Bootloader.
    By HenrikOlsson in forum USB
    Replies: 22
    Last Post: - 2nd May 2013, 02:46
  3. Simple USB Comms Problem
    By awmt102 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 6th January 2010, 20:17
  4. One USB keyboard to Two USB Ports
    By picnaut in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 11th June 2009, 00:04
  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