output's on as power is supplied


Closed Thread
Results 1 to 13 of 13

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default using the branch

    I read in the PicBasicPro manual about using the branch as you suggested,
    branch b3, [outr1,outr2,outr3,outr4,outr5,outr6,outr7,outr8,ou tr9,outr10,outr11,outr12]
    I just compiled and tried the circuit seems to work fine. I am curious about why using many "If, Then" statements is not a good way of doing things.

    Thanks again, as you may have guess I new into this and still learning .

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by tazntex View Post
    I just compiled and tried the circuit seems to work fine. I am curious about why using many "If, Then" statements is not a good way of doing things.
    A lot of If/Then statements, all back-to-back, just kinda looks ugly, and makes it a bit harder to read. You have to scroll up, scroll down, move all around. With the BRANCH, it's all on one line. It doesn't neccessarily save memory, code, or whatever, it just looks better.

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


    Did you find this post helpful? Yes | No

    Default

    Never trust a PIC at boot, it's output level is hard to predict. you should set it yourself at the top of your code and add a little delay
    Code:
        PORTA = 0
        PORTB = 0    
        trisa = %00010000
        trisb = %00000000
        PAUSE 50 ' settle time 
    
    loop:
    It's not a bad idea to enable the Power Up timer in your Configuration fuses as well.
    Code:
    @       __CONFIG _XT_OSC & _PWRTE_ON & _WDT_OFF & _CP_OFF
    http://www.picbasic.co.uk/forum/showthread.php?t=543
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    It's not a bad idea to enable the Power Up timer in your Configuration fuses as well.
    Code:
    @       __CONFIG _XT_OSC & _PWRTE_ON & _WDT_OFF & _CP_OFF
    I've never really had problems with outputs coming on at power-up. They always seem to be in INPUT mode.

    But assuming you did need to set them manually, wouldn't the Power-ON timer just make it that much longer till they actually got set to output.

    Just a thought.
    <br>
    DT

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


    Did you find this post helpful? Yes | No

    Default

    If the hardware don't care about the 'Tri-State' or 'High impedance' level, yes...about 72mSec longer.

    Unfortunately there's no Brown-Out detect on this one, we have no schematic and we can't measure the PSU behaviours and rise time from where we are.. hard to have the ultimate solution.

    Maybe i misunderstood the original problem...
    Quote Originally Posted by tazntex
    I now have everything working momentary now but at times when I apply power some if not all relays activate.
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    If the hardware don't care about the 'Tri-State' or 'High impedance' level ....
    Right, and that could be a problem.

    Here's an idea for Taz.
    Try running this program ...
    Code:
    STOP
    Yes, that's the whole program.

    It'll leave the pins in Hi-Z mode.

    Then see if any relays come on?
    <br>
    DT

Similar Threads

  1. Battery powered applications
    By NavMicroSystems in forum Off Topic
    Replies: 7
    Last Post: - 22nd June 2009, 07:12
  2. Pic getting part power from Analog Port
    By ShaneMichael in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 22nd April 2009, 10:34
  3. Outputs high to power
    By volcane in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 2nd February 2008, 18:29
  4. 12 Servo's together does not seem to work, Power problem
    By macx75 in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 13th December 2006, 19:30
  5. Power up problem
    By Ken McDonald in forum General
    Replies: 1
    Last Post: - 28th December 2004, 17:06

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