There has to be an easier way!


Results 1 to 12 of 12

Threaded View

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


    Did you find this post helpful? Yes | No

    Wink Think simple ...

    Quote Originally Posted by Christopher4187


    if PORTA.5=0 THEN
    B1=0
    ELSE
    B1=1
    ENDIF
    if PORTA.2=0 THEN
    B2=0
    ELSE
    B2=1
    ENDIF
    if PORTA.1=0 THEN
    B3=0
    ELSE
    B3=1
    ENDIF
    if PORTA.0=0 THEN
    B4=0
    ELSE
    B4=1
    ENDIF
    C1=(B1*1)+(B2*2)+(B3*4)+(B4*8)

    Chris
    > Hi, Christopher

    > Let's do :

    > C1 = PORTA & % 00100111
    > C1.3 = C1.5 : C1.5 = 0
    > C1 = C1 REV 4

    That's all !!!

    See manual $ 4.10 and 4.17.11 ...

    Alain
    Last edited by Acetronics2; - 27th May 2006 at 12:40.
    ************************************************** ***********************
    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 " !!!
    *****************************************

Similar Threads

  1. PIC16F690 ADC question
    By matador29b in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 23rd October 2009, 23:03
  2. Motor Control PLC with a PIC
    By sougata in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 2nd November 2006, 07:59
  3. Serial Communication again but easier i think ;)
    By Armando Herjim in forum Serial
    Replies: 0
    Last Post: - 21st June 2006, 02:50
  4. Clock connection to DS1802 from 16F877A
    By coyotegd in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 3rd January 2006, 18:52
  5. More IF_THEN dumb questions.
    By ronjodu in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 22nd February 2005, 19:33

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