pause puts me in sleep mode


Closed Thread
Results 1 to 21 of 21

Hybrid View

  1. #1
    EDWARD's Avatar
    EDWARD Guest

    Default pause puts me in sleep mode

    Its Edward again, with yet another problem.

    i have a solenoid being driven by a NPN transistor. the base of the NPN is conneted to portc.2 if i make portc.2 output high it will turn on the solenoid as expected. i also have a push button connected to portb.0.
    the goal is to turn on the solenoid for a short deley then turn off.

    now comes the problem

    when i use the PAUSE command it puts my pic 16f73 into low power mode or something, cause i only read ~3.5 volts on the vdd.

    below are the two codes.
    both codes work when led+resistor unit replace solenoid (no solenoid)
    one works the other does not when solenoid is connected (solenoid)

    'works


    TRISC=235 'set PORTC as output on needed pins
    TRISB=251 'PORT B INPUT EXCEPT on uneeded
    '------------------------------------
    MAIN:

    PORTC=%00010000 'PWR LOCK-ON & solenoid data low

    IF PORTB.0=1 THEN 'BUTTON 2 IS PRESSED ACTIVATE SOLENOID
    GOTO SHOOT
    ENDIF

    IF PORTB.4 = 1 THEN 'BUTTON 1 IS PRESSED THEN EXIT
    GOTO EXIT
    ENDIF

    GOTO MAIN
    '---------------------------------------------------
    EXIT:
    PORTC = %00000000 'LOW PORTC all PWR OFF
    END
    '---------------------------------------------------

    SHOOT:
    PORTC.2 = 1 'SOLENOID ACTIVE
    GOTO MAIN
    '-------------------------------------------------








    'doesnt work below

    TRISC=235 'set PORTC as output on needed pins
    TRISB=251 'PORT B INPUT EXCEPT on uneeded
    '------------------------------------
    PORTC=%00010000 'PWR LOCK-ON

    MAIN:
    IF PORTB.0=1 THEN 'BUTTON 2 IS PRESSED ACTIVATE SOLENOID
    GOTO SHOOT
    ENDIF

    IF PORTB.4 = 1 THEN 'BUTTON 1 IS PRESSED THEN EXIT
    GOTO EXIT
    ENDIF

    GOTO MAIN
    '---------------------------------------------------
    EXIT:
    PORTC = %00000000 'LOW PORTC all PWR OFF
    END
    '---------------------------------------------------

    SHOOT:
    PORTC.2 = 1 'SOLENOID ACTIVE for 1/5 seconds
    PAUSE 200 '<- RIGHT HERE RIGHT HERE RIGHT HERE IS PROBLEM!
    PORTC.2 = 0
    GOTO MAIN
    '-------------------------------------------------


    lastly when i disonnect the solenoid everything works fine again without a need to reset the pic. so the working model only alows the solenoid active AS LONG AS IM HOLDING BUTTON 2 DOWN. not a desired function i want the solen active for x number of seconds then off.

    2 things come to mind.

    1. if it was a hardware problem, why would it work just fine without the pause command.

    2. when i tell portc.2 = 0 could that effect anyother pin on the portc?

    u should also know that i have a "power on" command. becaue my boards power button is momentary button, the board was desgned that as long as portc.4 is high the vdd will be 5+. the board basically works like this.

    1 press and hold pwr momentary button.
    2 that sends 5+ to the pic and it starts the program
    3 in the program I put portc.4 = 1 so that the vdd Locks-On
    4 to power off pic just portc.4 = 0 or all of portC=0
    5 that makes a transistor somewhere "off"

    sory if i made this one too long.
    Last edited by EDWARD; - 5th May 2005 at 07:57.

  2. #2
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    EDWARD,

    I guess the problem is hardware related.
    We would need to have a look at the schematic to further analysis.

    Questions:

    1. Where does the Solenoid get it's power from?
    2. Do you have a Resistor between PortC.2 and the Base of the NPN?
    3. Do xou have a reverse Diode across the Solenoid?
    4. As your Buttons read "1" when pressed, do yo have PullDown Resistors on the corresponding PIC Pins?

    Is this the same strange Board you had the LCD questions on?
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



  3. #3
    EDWARD's Avatar
    EDWARD Guest


    Did you find this post helpful? Yes | No

    Default pause problem on 16f73

    yes it is the same board witht the lcd. i dont have the schematics for the board. the board has al surface mount components and i am trouble telling what ALL the parts are. i have figured alot out but not everything. i know the hardware will work because these boards have porgrams on them right now and work fine with the old code. i have erased one of them to use as my "test board" and have made no hardware changes.

    the designer of the board, as it seems, did many things wrong. the designer

    1:did not use a resistor on the soleniads npn base.

    2:doesnt have any resistors to the inputs on portB, which cantains most
    input buttons.

    3: i think that there is a diode across the solenoid though.

    4:solenoid is a 5vdc. it is driven by sinking. i got 9 volt going to a Vreg 5+, an that 5+ going to the red wire of the solenoid. the black wire goes to the collector of the npn.

    ( i am going to make a picture/table. im also going to try and create a schemati for you.)
    Last edited by EDWARD; - 5th May 2005 at 21:45.

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


    Did you find this post helpful? Yes | No

    Default

    probably the transistor in use is a digital type with internal resistor or logic mosfet. that's why you don't have any external resisotr.

    no resistor on PORTB... probably the internal pull-ups where in use. I bet the pushbutton are between PIC and gnd!

    The major cause, as i suspect, might be the current provided by the power supply, must be unsufficient to make the 5 volt line goes to 3.5 volt. Use another power supply.
    Steve

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

  5. #5
    EDWARD's Avatar
    EDWARD Guest


    Did you find this post helpful? Yes | No

    Default pause problem on 16f73

    thanks for your response mister_e. i know that the hardware is sufficient for my purposes, but oddly enough the buttons are actually between 5+ and pic,weird.

    also, i bought bunch of 9 volts, and still same problem. this only happens when i use the pause command. if the solenoid is programmed to ONLY BE ON WHEN THE BUTTON(on a different port) IS HELD TRUE, it works fine. but if i tell the solenoid to stay high for 1 seconds (PAUSE 1000) the vdd drops to 3.5. dang!

    is it possible that some of the power to "help" drive the solenoid and/or PIC, comes from a data port? conversly, will defining (TRISX) to many pins as outputs (not necessarily HIGH), will draw excesive current?

  6. #6
    EDWARD's Avatar
    EDWARD Guest


    Did you find this post helpful? Yes | No

    Default PAUSE problem discovery!

    ok guys i made a breakthrough of "KFC snacker size" proportions.

    OK so im hungry and not funny. but i am gaining on my pause problem.
    today i found out that if i short out portc.2 it will "turn off" my solenoid "driver" the only way for the driver to turn fully off is to short it. portc.2 =0 doesnt go low enough.

    secondly, i found out how the driver works. my solenoid red wire is connected to a 5+, and the black wire of the solenoid is connected to 2 transitors in parallel. one of the transiters set the sink bias to make the solenoid "driver" at a 4.4 volts on the ground side, even when portc.2 is low. and when portc.2 goes high, it sinks the solenoid over 5+. thereby fireing the solenoid.

    This has led me to beliver that when i ground out the portc.2 pin, which in turn turns off the driving transistor, which turns off the solenoid.

    that can only mean that when i put portc.2 = 0 it is not going low enough. how do i make portc.2 less than 0 it really wierd cause as soon as i short portc.2 with my vdd goes back up to 5+.

    ive tried swapping solenoids and batteries.
    Last edited by EDWARD; - 6th May 2005 at 08:19.

Similar Threads

  1. Old and beyond help ?
    By DavidFMarks in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 11th December 2008, 15:23
  2. Replies: 11
    Last Post: - 12th July 2008, 02:36
  3. Pic to LanC
    By grounded in forum Off Topic
    Replies: 9
    Last Post: - 24th June 2008, 00:12
  4. Fade out LEDs question
    By Sam in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 22nd June 2008, 10:50
  5. Help Quick Need to make code smaller
    By Programmednew in forum mel PIC BASIC Pro
    Replies: 41
    Last Post: - 25th January 2005, 03:46

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