+ Post New Thread
Results 1 to 6 of 6
  1. #1
    Newbie level 1
    Points: 15, Level: 1

    Join Date
    Mar 2020
    Posts
    1
    Helped
    0 / 0
    Points
    15
    Level
    1

    interfacing 74HC4051 with pic18f4550

    Click image for larger version. 

Name:	Capture.jpg 
Views:	15 
Size:	75.6 KB 
ID:	158394

    here is my simulation, i add those declaration on first and in my main.txt function but it aint work any one can help please, it s to mux the uart

    Click image for larger version. 

Name:	1.jpg 
Views:	6 
Size:	2.4 KB 
ID:	158395

    Click image for larger version. 

Name:	2.jpg 
Views:	5 
Size:	7.1 KB 
ID:	158396

    •   AltAdvertisement

        
       

  2. #2
    Super Moderator
    Points: 81,979, Level: 69
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    16,637
    Helped
    3771 / 3771
    Points
    81,979
    Level
    69

    Re: interfacing 74HC4051 with pic18f4550

    Hi,

    general rule:
    Donīt leave any input floating!.

    Klaus
    Please donīt contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



    •   AltAdvertisement

        
       

  3. #3
    Advanced Member level 4
    Points: 8,093, Level: 21
    Achievements:
    7 years registered

    Join Date
    Jan 2015
    Posts
    1,136
    Helped
    351 / 351
    Points
    8,093
    Level
    21

    Re: interfacing 74HC4051 with pic18f4550

    You are asking for "RMW" troubles with code like sequential writes to a PORTx register.
    That MCU has LAT registers so you should always obey the golden rule: "Read form the PORT, write to the LAT".
    Also NEVER play wth the GIE bit in an ISR. Read the last few paragraphs of Section 9.0 of the data sheet to understand why your code is ineffective (or at least the tiny snippet that you have shown).
    Why are you defining TRISA to be 0 - that makes no sense at all. Also unless you set the REAL TRISA bits for output, they will default to input.
    The PIC18F4550 does not have any ADSELx registers. I have no idea how the compiler managed to not throw all sorts of errors (unless you have more statements like the TRISA define that defines a variable called ANSELA).
    What are you trying to do with the assignments to PORTAbits.AN0! I would doubt if there is a bit defined with that name (but I could be wrong there) as the data sheet shows that the *function* AN0 is an analog input using that pin. Therefore there is no point in assigning a value to it.
    Can I suggest that you start with a 'flash a LED' style program so that you understand the basics. Also read the data sheet and don't copy code that you don't understand. That is not the way to learn.
    Susan



    •   AltAdvertisement

        
       

  4. #4
    Advanced Member level 4
    Points: 8,093, Level: 21
    Achievements:
    7 years registered

    Join Date
    Jan 2015
    Posts
    1,136
    Helped
    351 / 351
    Points
    8,093
    Level
    21

    Re: interfacing 74HC4051 with pic18f4550

    There is a parallel discussion at https://www.microchip.com/forums/m1133159.aspx
    Susan



  5. #5
    Junior Member level 3
    Points: 630, Level: 5

    Join Date
    Jun 2017
    Posts
    28
    Helped
    0 / 0
    Points
    630
    Level
    5

    Re: interfacing 74HC4051 with pic18f4550

    Quote Originally Posted by KlausST View Post
    Hi,

    general rule:
    Donīt leave any input floating!.

    Klaus
    hi klaus

    what is the best solution for the free inputs in any design?

    best regards
    Johnny



    •   AltAdvertisement

        
       

  6. #6
    Super Moderator
    Points: 81,979, Level: 69
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    16,637
    Helped
    3771 / 3771
    Points
    81,979
    Level
    69

    Re: interfacing 74HC4051 with pic18f4550

    Hi,

    what is the best solution for the free inputs in any design?
    There is no best solution.

    * no free pins at all
    * internal pullup / pulldiwn
    * programmable pullup / pulldown
    * keeper
    * external pullup / pulldown
    * external hard wiring
    *....
    Each has it's benefit and drawback. That's why they exist...

    Asking for the best rarely gives a single good answer.

    Klaus
    Please donīt contact me via PM, because there is no time to respond to them. No friend requests. Thank you.


    1 members found this post helpful.

--[[ ]]--