Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

[PIC] interfacing 74HC4051 with pic18f4550

othmanetal

Newbie level 1
Joined
Mar 25, 2020
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
11
Capture.jpg

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

1.jpg

2.jpg
 

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
17,267
Helped
3,910
Reputation
7,818
Reaction score
3,777
Trophy points
113
Activity points
114,637
Hi,

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

Klaus
 

Aussie Susan

Advanced Member level 4
Joined
Jan 5, 2015
Messages
1,149
Helped
359
Reputation
718
Reaction score
355
Trophy points
83
Activity points
12,491
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
 

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
17,267
Helped
3,910
Reputation
7,818
Reaction score
3,777
Trophy points
113
Activity points
114,637
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
 
Toggle Sidebar

Part and Inventory Search


Welcome to EDABoard.com

Sponsor

Sponsor

Design Fast


×
Top