Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics 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.

How to disable a port one enabled in microcontroller?

Status
Not open for further replies.

jayeshparmar

Newbie level 3
Joined
Apr 13, 2016
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
42
Hi, I'm using MP430 series microcontroller. The functionality of the code is to do a specific task and then don't do anything (sense the tilt and glow an LED in a fixed amount of time). But due to some bug in the code, I'm noticing that a port pin gets '1' after some time.
So now I want to disable all the ports once the task is completed. How can I disable these ports which initially I defined as Input and Output ports.

And my 2nd question is: if I'm disabling these ports then are there any chances that the output port (now disabled) will stay floating and generate some noise or something and trigger my output LED? This question is for all the microcontrollers (MSP430, PIC, AVR, etc.)
 

PORT is just a register in a common memory space. But, for example, on STM32 there are posibility to protect it from being changed unexpectly. It is done by set security bit in another register. To unblock it you have to cleare that bit first. But it is not your case! You trying to emplemen workaround of your code instability. It is a dirty way. If you will begin from this, you will never become good programmer.
 

Hi, I'm using MP430 series microcontroller. The functionality of the code is to do a specific task and then don't do anything (sense the tilt and glow an LED in a fixed amount of time). But due to some bug in the code, I'm noticing that a port pin gets '1' after some time.
So now I want to disable all the ports once the task is completed. How can I disable these ports which initially I defined as Input and Output ports.

As you mentioned your code is carrying out the operation for some time and changing its status after that. I'm understanding it is performing correctly as per your statement.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top