Instant Interrupts - Revisited


Closed Thread
Results 1 to 40 of 773

Hybrid View

  1. #1
    Join Date
    Jul 2005
    Posts
    93


    Did you find this post helpful? Yes | No

    Smile

    Hi,

    I have some mostly working code now using your interrupts thanks to your "hint" about the endpoints earlier...

    I was reading another thread that was about "If plugged" - The solution works great monitoring SOFIF and IDLEIF registers - the main loop now does run when the cable is unplugged.

    The only case that is still at issue for me is that the device doesnt go passed the "DoUSBinit" subroutine if it's powered on while not connected - which for me is a big deal because the device i'm building is going to be powered up at times with just the LCD i have connected. This LCD is managed by a 16F767 in another device which has some fans too and a light. it's all connected via cat5e cable for one way serial transmission from the 18F4550 via serout2 commands, and i give it 12v and GND each via 3 wires respectively which feed a 7805 and a couple transistors for pulsing the fan speed and light intensity, that all appears to work nicely)

    So I guess the last thing to do before I glue everything together (lol) is to get the device to go to the main loop if usb cable is not plugged at initialization time (and have the usb still work after if its eventually plugged in while the device is running).

    Anyone else have this "self-powered device" / usbinit kind of issues?

  2. #2
    Join Date
    Jul 2005
    Posts
    93


    Did you find this post helpful? Yes | No

    Default

    Darrel the "extra" data is for parsing strings that come in after my oncomm event in visual basic. I get the stuff in between the letters - I haven't successfully used "binarymode" in vb .. always stuck with text mode.

    I use whats come in between "A" and "B" to fork the other data over to certain variables... there's probobly a much better way to do it... I've already seen instances where manipulating the strings in higher speed timers cause lockups and weird things happening.

    But that's not really the right forum for that.. but i'm interested to resolve the issue with the "cable not in during usbinit on device initialization" issue.
    Last edited by RYTECH; - 25th November 2008 at 08:46.

  3. #3
    Join Date
    Jul 2005
    Posts
    93


    Did you find this post helpful? Yes | No

    Default

    Should i wire up an input to the USB V+ and monitor that in addition to the IDLEIF SOFIF registers? USB ---4.7k ----pic input --100k---GND?

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


    Did you find this post helpful? Yes | No

    Default

    The only case that is still at issue for me is that the device doesnt go passed the "DoUSBinit" subroutine if it's powered on while not connected
    Yeah, when it's not connected, it'll never make it to the CONFIGURED_STATE.

    Change the Init routine to this.
    Code:
    DoUSBinit:
        pause 500
        usbinit                  ; initialise USB...
        USBSERVICE               ; service it once
        UIE = $7F                ; enable USB interrupts
        UEIE = $9F               ; enable USB Error interrupts
        @ INT_ENABLE USB_INT
    return
    DT

  5. #5
    Join Date
    Jul 2005
    Posts
    93


    Did you find this post helpful? Yes | No

    Default

    Thanks Darrel that did it for me!

  6. #6
    Join Date
    Jul 2005
    Posts
    93


    Did you find this post helpful? Yes | No

    Default

    Does the USB operation of the 18F4550 have a direct effect on the A/D channels..? Let me explain why i ask....

    Case a) when i power up my circuit the A/D values float - not 200 or 300 millivolts - which for my inexperience, hackjob craftsmanship, and source voltage reference would be acceptable, but sometimes, usually when i power up without the usb cable connected, the values float sometimes as much as 800 millivolts on my 12v line, i've metered the several points, there's no floating, so it's something to do with the IC's operation. I can usually correct the issue by plugging in the device and unplugging it. I'm stumped as to what exactly is going on... i'm wondering if this 800 millivolt swing has something to do with the pic enabling or disabling its internal pullups on the usb data lines. it seems to revolve around the state of the usb connectivity... when the problem is not present my readings are mostly acceptable, the caps and aquisition times seem to work ok.

    wonder whats going on... i think i chose the wrong IC for my solar powered charge controller... I really like the usb connectivity, but the IC with only 1 power led and 1 led that flashes every so often (about 1/16 cycles through main) the circuit draws about 120 mA... is that around normal for not having any sleep cycle in main? I tried to activate the WDT to implement a sleep but it seems the USB bootloader (or something) doesnt like it, cause when i reset the chip after the WDT enable change the USB reports the device is not recognized....

  7. #7
    Join Date
    Jul 2005
    Posts
    93


    Did you find this post helpful? Yes | No

    Default

    so i guess i actually have 2 issues still, i cant sleep (neither can my device) and the A/D sometimes acts "wonky" depending on the state of the usb pluggedness.

Similar Threads

  1. Clock using Instant Interrupts
    By PICpocket in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th February 2009, 21:43
  2. DT instant interrupts with mister_e keypad
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 26th November 2008, 20:02
  3. DT's Instant Interrupts trouble
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 24th November 2008, 20:48
  4. Keypad and DT's Instant Interrupts
    By Homerclese in forum General
    Replies: 11
    Last Post: - 27th April 2007, 06:32
  5. Replies: 1
    Last Post: - 1st November 2006, 03:11

Members who have read this thread : 6

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