help with PIC16F628 conditional program


Results 1 to 13 of 13

Threaded View

  1. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by joseph View Post
    i'm having problem working with a conditional program,

    ------ 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


    TIA.
    Hi, joseph

    @ first ...

    your motor must be powered only if ( FWD ^ REVS = 1 ) AND ( NEUT = 0 ) ... ELSE outputs OFF

    after that

    forward = FWD and reverse = NOT forward ...

    what gives us ...

    Code:
     
    IF ( FWD ^ REVS ) AND NOT NEUT THEN
      forward = FWD : reverse = NOT forward
    ELSE
      forward = 0 : reverse = 0
    ENDIF
    Instead of writing :

    Code:
    TRISA = 95
    Write
    Code:
    TRISA = %  01011111 ' 95 in binary
    And you see instantly ... you've set Porta.7 as an output ...


    Alain
    Last edited by Acetronics2; - 4th July 2010 at 16:49.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

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