There has to be an easier way!


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    Another Option - although more lines of code, this compiles to less code space -

    temp var byte
    C1 var byte

    C1=0 ; set C1 to 0
    temp=PORTA ; in case PORTA changes while “processing”
    C1.0=temp.5
    C1.1=temp.2
    C1.2=temp.1
    C1.3=temp.0

    Paul Borgmeier
    Salt Lake City, Utah
    USA

  2. #2
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    or this

    temp var byte
    C1 var byte

    C1=0 ; set C1 to 0
    temp=PORTA ; in case PORTA changes while “processing”
    if temp.5=1 then C1.0=1
    if temp.2=1 then C1.1=1
    if temp.1=1 then C1.2=1
    if temp.0=1 then C1.3=1

    Paul

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