Multiplexer address control..


Closed Thread
Results 1 to 18 of 18

Hybrid View

  1. #1
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Multiplexer address control..

    If you are using PIC 18F, then use simplest solution is
    LATB.4=Control.0
    LATB.5=Control.1
    LATB.6=Control.2
    LATB.7=Control.3

    EDIT:
    For PIC16

    PortBCopy var byte

    PortBCopy = PORTB
    PortBCopy .4=Control.0
    PortBCopy .5=Control.1
    PortBCopy .6=Control.2
    PortBCopy .7=Control.3
    PORTB=PortBCopy

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: Multiplexer address control..

    Yes thanks, but how to step through the options in the most efficient way without disturbing ports B0-3

  3. #3
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Multiplexer address control..

    for control = 0 to 15
    LATB.4=Control.0
    LATB.5=Control.1
    LATB.6=Control.2
    LATB.7=Control.3
    next control

  4. #4
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default Re: Multiplexer address control..

    It would be quicker if you used the port bits 0-3 instead, so you could just increment the port b value.
    The quickest way also depends where the enable bit is connected.

  5. #5
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: Multiplexer address control..

    Pedja089, In your suggested code you are treating "Control" as an array. If it is not then you are just resetting the LATx bits 16 times.
    Dave Purola,
    N8NTA
    EN82fn

  6. #6
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Multiplexer address control..

    I'm using as single bit, not array. And changing only upper 4 bit.
    For this PBP will generate 4 asm instruction per PBP line, and execute 2 or 3 of them.
    In worst case scenario 12 asm instruction are executed.
    Compared to any PBP math function size, and speed are better in this case.
    Maybe using logic you can get same result. You can try it if you want.
    Let me explain little more...
    Control=2
    LATB.4=Control.0
    LATB.5=Control.1
    LATB.6=Control.2
    LATB.7=Control.3
    Bit 4 of LAT register is set to 0, bit 5 of LAT register is set to 1, bits 6,7 of LAT register is set to 0.
    Bits 0,1,2,3, are unaffected.


    PS
    Array would be Control[i]...

  7. #7
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: Multiplexer address control..

    Pedja089, Why not just say:

    for control = 0 to 15
    LATB = LATB & $0F 'strip upper 4 bits
    LATB = LATB | Control << 4 'add new control bits
    next control
    Dave Purola,
    N8NTA
    EN82fn

Similar Threads

  1. Replies: 5
    Last Post: - 21st January 2014, 16:10
  2. How do I give a radio control car autonomous control
    By Kenjones1935 in forum General
    Replies: 190
    Last Post: - 17th January 2010, 15:40
  3. Multiplexer channel selection
    By Castor in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 19th May 2008, 10:51
  4. Using a MAX7219 (LED digit multiplexer) with a 16F88
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 11th March 2007, 21:11

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