disconnect USB - is it possible?


Closed Thread
Results 1 to 9 of 9

Hybrid View

  1. #1

    Default

    Quote Originally Posted by Rob View Post
    Hi,
    this can vary. I will reply tomorrow with a good example of how to do this unless somebody else replies first but for now look up posts from Darrell Taylor regarding the USB stuff as a hint.

    Try:

    Code:
        UCON.3 = 0                  ' UCON register bit 3 (USBEN) enables/disables
                                    ' the USB - see page 164 18F4550 datasheeet
    Thank you Rob !!!

    UCON.3 ' USB Control Register, USB Module Enable Bit,0=Detached, datasheet 17.2.1
    That did do the trick, nice and smooth, without any problems, without any other lines of code... very nice indeed

    Quote Originally Posted by mister_e
    Totally untested thought...
    what happen if you stop calling USBSERVICE?
    Nothing, no dong-ding, nothing you could measure. Or maybe you can, bat because I did not hear the dong-ding I skipped rest of the "testing"...

    Quote Originally Posted by mister_e
    thereafter, what may happen if you use the method shown in the famous known "POST 148"
    I will take a closer look at it in the future. At the moment I'm quite happy with that one line solution...

    Thank you again Rob and Mister_e thank you indeed

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

    Default

    Hey Keymuu,

    glad that worked for you. The stuff to read that I was going to point you to today is the post that Steve is referring to above - this will help you achieve USB enumeration correctly.

    Good luck

    Rob

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

    Default

    Yup, all good stuff to know. One day i may need to do it as well.
    Steve

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

  4. #4
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    257

    Default

    Quote Originally Posted by keymuu View Post
    Thank you Rob !!!

    UCON.3 ' USB Control Register, USB Module Enable Bit,0=Detached, datasheet 17.2.1
    That did do the trick, nice and smooth, without any problems, without any other lines of code... very nice indeed


    Nothing, no dong-ding, nothing you could measure. Or maybe you can, bat because I did not hear the dong-ding I skipped rest of the "testing"...


    I will take a closer look at it in the future. At the moment I'm quite happy with that one line solution...

    Thank you again Rob and Mister_e thank you indeed
    Guys,

    Having trouble compiling UCON.3= 0

    Getting a syntax error with PB2.47. Anyone else?

    Squib

  5. #5
    Join Date
    Jun 2005
    Location
    Surrey, England
    Posts
    35

    Default

    Quote Originally Posted by Squibcakes View Post
    Guys,

    Having trouble compiling UCON.3= 0

    Getting a syntax error with PB2.47. Anyone else?

    Squib
    I had the same problem - have now bought PBP2.6 upgrade but have not tested yet but I got around this in assembler where UCON is recognised:
    Code:
                T0CON.7 = 0     ' Disable USBservice interrupts
    '           UCON.1 = 1      ' UCON not defined in PBP 2.46
    @	        clrf	UCON	; Disable USB & detach from bus
    @	        clrf	UIE  	; Mask all USB interrupts
    Peter

    PS I have Timer0 running on 1 mSec interrupts - the Interrrupt handler simply doing an USBservice and returning - turned this off here also
    Last edited by FinchPJ; - 24th August 2010 at 10:02. Reason: Postscript

  6. #6
    Join Date
    Jun 2005
    Location
    Surrey, England
    Posts
    35

    Default

    I have just had a chance to check this out and it works fine - add:
    Code:
    UCON    var byte EXT
    to your PBP 2.46 program and it should solve the problem! You can now refer to for example:
    Code:
           UCON.3 = 0
    Peter

Similar Threads

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