help with PIC16F628 conditional program


Results 1 to 13 of 13

Threaded View

  1. #1
    Join Date
    Apr 2009
    Posts
    24

    Question help with PIC16F628 conditional program

    i'm having problem working with a conditional program,

    Code:
    @ DEVICE PIC16F628A, INTRC_OSC_NOCLKOUT, WDT_OFF, PWRT_OFF, MCLR_OFF,PROTECT_ON,CPD_ON, BOD_OFF, LVP_OFF
    
    DEFINE OSC 4
    
    CMCON = 7
    VRCON = 0
    
    
    TRISA = 95
    TRISB = 0
    PORTB = 0
    
    GS1  var PORTA.0
    GS2  var PORTA.1
    TEMP var PORTA.2
    FWD  VAR PORTA.3
    REvs VAR PORTA.4
    Neut var PORTA.7
    
    forward  var PORTB.0
    revers   var PORTB.1
    one      var PORTB.2
    two      var PORTB.3
    three    var PORTB.4
    starterd var PORTB.5
    
    
    start: IF Neut = 1 then
            low forward
            low revers
           else
            if (FWD = 1) and (REvs = 0) then
            low revers
            high forward
           else
            low revers
            low forward
            if (FWD = 0) AND (REvs = 1) then
            low forward
            high revers
            endif
            endif
    endif
    goto start 
    end
    i need to monitor all the possible conditions in my input then ouput the right combination following this table.

    ------ INPUTS-------|-----OUTPUTS-----
    FWD---Neut--REvs-|---forward---revers
    --0-------0------1---|------0-----------1
    --1-------0------0---|------1-----------0
    --0-------1------0---|------0-----------0
    --0-------1------1---|------0-----------0
    --1-------1------0---|------0-----------0

    also i have problem on making PORTA.7 work as an input

    i plan to add more functions when this part worked

    TIA.
    Last edited by joseph; - 4th July 2010 at 15:26.

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