Corrected RB port Sequencer


Closed Thread
Results 1 to 1 of 1
  1. #1
    freelancebee's Avatar
    freelancebee Guest

    Lightbulb Corrected RB port Sequencer

    Hi All:
    Here is corrected RB Port Sequencer.
    I appereciate if you let me know how it
    works in your compiler.
    You can use this program for your tasks
    only by changing values.
    Regards,
    Leonid




    'PIC16F84A
    Symbol PORTA = $05
    Symbol TRISA = $85
    Symbol PORTB = $06
    Symbol TRISB = $86
    'Symbol Period=10000
    'Set Ports
    poke TRISA, 255 '31
    poke TRISB, 0
    'Set constant

    b1 = %01100100
    b2 = %01101101
    b3 = %01001001
    b4 = %01011011
    b5 = %01010010
    b6 = %01110110
    b7 = %01110110
    b8 = %01010010
    b9 = %01011011
    b10 = %01001001
    b11 = %01101101
    b12 = %01100100
    w7 = $2710
    'Start analizing input

    check:
    peek PORTA, b0
    'Bit0=0 Minus one step from W7
    'Bit1=0 Plus one step to W7
    'Bit2=1 Rotation Right
    'Bit2=0 Rotation Left
    'Bit3=0 Go
    'Bit3=1 Stop
    'Bit4
    If bit3 = 0 Then task
    Goto check

    task:
    peek PORTA, b0
    If bit3 = 1 Then check
    If bit2 = 0 Then rlft
    If bit2 = 1 Then rrht
    Goto task

    rlft:

    poke PORTB, b7
    pulsout 7, w7
    poke PORTB, b8
    pulsout 7, w7
    poke PORTB, b9
    pulsout 7, w7
    poke PORTB, b10
    pulsout 7, w7
    poke PORTB, b11
    pulsout 7, w7
    poke PORTB, b12
    pulsout 7, w7
    peek PORTA, b0

    call minus
    Goto task


    rrht:

    poke PORTB, b1
    pulsout 7, w7
    poke PORTB, b2
    pulsout 7, w7
    poke PORTB, b3
    pulsout 7, w7
    poke PORTB, b4
    pulsout 7, w7
    poke PORTB, b5
    pulsout 7, w7
    poke PORTB, b6
    pulsout 7, w7
    peek PORTA, b0

    call minus
    Goto task

    minus:
    If bit0 = 1 Then plus
    w7 = w7 - 1
    If w7 < $100 Then limm
    Goto task

    plus:
    If bit1 = 1 Then task
    w7 = w7 + 1
    If w7 > $5000 Then limp
    w7 = $5000
    Goto task

    limm:
    w7 = $100
    Goto task

    limp:
    w7 = $5000
    Goto task

    End
    Last edited by freelancebee; - 19th August 2005 at 20:16.

Similar Threads

  1. Change On Interrupt, PIC16F884
    By elec_mech in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 14th November 2008, 17:25
  2. port config.
    By tamertokgoz in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 25th July 2008, 12:25
  3. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  4. RB port sequencer
    By freelancebee in forum mel PIC BASIC
    Replies: 0
    Last Post: - 17th August 2005, 19:58
  5. STATUS re-curtain W
    By zugvogel1 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 13th February 2005, 15:21

Members who have read this thread : 1

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