Multiplexer channel selection


Closed Thread
Results 1 to 18 of 18

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Guess what? Free help! Deal with it.

    Code:
    'dcd channel selection
    low g_dcd
    
    for i=0 to 15
    	portb = (portb & %00011111 ) | ( ( i rev  3 ) << 5 )
    	portc = (portc & %10111111 ) | ( i << 3 )
    next i
    OR don't ADD
    to get rid of the i lower bits for portC ...

    i would have used

    Code:
    portc = (portc & %10111111 ) | ( i.3 << 6 )
    but, it's me ...

    Alain
    ************************************************** ***********************
    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 " !!!
    *****************************************

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    portc = (portc & %10111111 ) | ( i.3 << 6 )[/code]
    I've tried to do something like that before. If I remember right, the fact that i.3 is a bit didn't work well with the << 6. It ended up shifting itself out into nowhere and always ended up being a '0'.
    Maybe that was back in the day, in an older version of PBP or something. It just seems to me like that didn't work very well.

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


    Did you find this post helpful? Yes | No

    Wink

    Hi,

    I did at test on the breadboard this morning ...

    Everything fine ...

    Alain
    ************************************************** ***********************
    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 " !!!
    *****************************************

  4. #4
    Join Date
    Apr 2008
    Location
    Berlin, Germany
    Posts
    14


    Did you find this post helpful? Yes | No

    Default

    This is the winner:
    Code:
    portb = (portb & %00011111 ) | ( ( i rev  3 ) << 5 )
    	portc = (portc & %10111111 ) | ( i.3 << 6 )
    I've tried both in MPLAB SIM but
    Code:
    	portc = (portc & %10111111 ) | ( i << 3 )
    doesn't mask the port right.

    THANK YOU. Problem solved

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


    Did you find this post helpful? Yes | No

    Wink

    Good news !

    Just for the fun ...

    How many boards saved ???

    Alain
    ************************************************** ***********************
    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 " !!!
    *****************************************

  6. #6
    Join Date
    Apr 2008
    Location
    Berlin, Germany
    Posts
    14


    Did you find this post helpful? Yes | No

    Default

    uhm .. one

    I'll post the code in the apropriate section when it's done. It's for a Li-Ion Battery Management System (BMS)/Balancer
    Last edited by Castor; - 16th May 2008 at 11:59.

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


    Did you find this post helpful? Yes | No

    Wink

    Hi, Castor

    What is your device for ??? Modelling purposes ?

    By the way, I realized a voltage warning device for transmitters ( for a Nicad to LiPo conversion ), some times ago, and, by the way noticed there's a not negligible tempco with those batts ...

    doesn't simplify the measurements !!!

    Regards from ... an ex Tegel " blue uniform " temporary citizen.

    Alain
    ************************************************** ***********************
    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 " !!!
    *****************************************

  8. #8
    Join Date
    Apr 2008
    Location
    Berlin, Germany
    Posts
    14


    Did you find this post helpful? Yes | No

    Default

    it's for an electric golf cart I'm building

Similar Threads

  1. Best way to shut down HPWM channel?
    By LetTheSmokeOut in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 26th January 2010, 22:01
  2. Timer + rc5
    By naga in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 19th November 2009, 07:56
  3. Hserin
    By [email protected] in forum Serial
    Replies: 11
    Last Post: - 16th December 2008, 18:49
  4. 18F1320 ADC multiple channel select
    By jmgelba in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 28th November 2005, 21:40
  5. 16F819 ADCIN Channel Select?
    By modifyit in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 27th April 2005, 18:31

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