Ports don't stay on when sequencing them.


Results 1 to 6 of 6

Threaded View

  1. #1
    Join Date
    Feb 2011
    Location
    GA, U.S.A.
    Posts
    5

    Default Ports don't stay on when sequencing them.

    Below is the simple program I am working with and it should work. However, the outputs on port B will not stay on. Portb.0 will come on then go off after the 2 second pause, them portb.1 will come on for 2 seconds and go off then portb.2 comes on and stays on. I am using a PIC16F882, simply because I have several laying around.

    It has been several years since I worked with PICs and with PBP so I am certain there is something stupidly simple to fix this.

    Thank you to anyone who will assist me on this,

    Here is the code:

    adcon1 = 111
    define osc = 8
    porta = %00000000
    portb = %00000000
    portc = %00000000
    trisa = %11111111
    trisb = %00000000
    trisc = %00001111

    'Alias define
    power1 var portb.0
    power2 var portb.1
    power3 var portb.2

    main:
    if portc.0 = 1 then
    gosub Startup
    endif

    if portc.1 = 1 then
    gosub shutdown
    endif

    goto main

    startup:
    pause 500
    high power1
    pause 2000
    high power2
    pause 2000
    high power3
    'pause 2000
    'portb.3 = 1
    'pause 2000
    'portb.4 = 1
    'pause 2000
    'portb.5 = 1
    'pause 500
    return

    shutdown:
    pause 500
    'portb.5 = 0
    'pause 2000
    'portb.4 = 0
    'pause 2000
    'portb.3 =0
    'pause 2000
    low power3
    pause 2000
    low power2
    pause 2000
    low power1
    pause 500
    return

    end
    Last edited by cnc002; - 28th July 2017 at 23:02.

Similar Threads

  1. Trying to stay on wifi network
    By Hylan in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 30th October 2015, 16:34
  2. Understanding 3 phase sequencing
    By ardhuru in forum General
    Replies: 3
    Last Post: - 22nd June 2008, 10:14
  3. output doesn't stay high
    By dfort in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 5th November 2007, 22:37
  4. Stay or Go deleted.
    By Darrel Taylor in forum Forum Requests
    Replies: 3
    Last Post: - 13th July 2007, 22:57
  5. 3 phase sequencing
    By ardhuru in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 26th May 2007, 07:35

Members who have read this thread : 2

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