+ Post New Thread
Results 1 to 4 of 4
  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:	11 
Size:	75.6 KB 
ID:	158394

    here is my simulation, i add those declaration on first and in my main 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:	2 
Size:	2.4 KB 
ID:	158395

    Click image for larger version. 

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

    •   AltAdvertisement

        
       

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

    Join Date
    Apr 2014
    Posts
    16,613
    Helped
    3761 / 3761
    Points
    81,845
    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



--[[ ]]--