[SOLVED] How disable or enable MCLR pin inside a function ?

Status
Not open for further replies.

Raady Here

Full Member level 5
Joined
Jun 8, 2013
Messages
242
Helped
26
Reputation
52
Reaction score
26
Trophy points
28
Location
India
Visit site
Activity points
1,571
MPLAB8.8V/PIC30F5011

Hi,

Normally MCLR pin enable/ disable is done when it is programmed, but I have a requirement to enable/disable at certain points of code execution.

What is the way to do it ?



Code:
void Switch_ON_Motor(void)
{

       _FBORPOR(MCLR_DIS);                  // Disable reset pin

	Latch_1 	= 	Enable;				// Enable Latch
	Relay_1		=	High;                         // R Phase
	Relay_2		=	High;                         // Y Phase
	Relay_3		=	High;                         // B Phase
	TimerDelay_10ms(1);
	Latch_1 	= 	Disable;				// Disable Latch
//	printf("\n\rSwitch ON Motor");	
}
My Error Log :
Code:
main.c: In function 'Switch_OFF_Motor':
main.c:298: error: section attribute cannot be specified for local variables
main.c:298: warning: ignoring space attribute applied to automatic _FBORPOR
main.c:298: warning: unused variable '_FBORPOR'
main.c: In function 'Switch_ON_Motor':
main.c:610: error: section attribute cannot be specified for local variables
main.c:610: warning: ignoring space attribute applied to automatic _FBORPOR
main.c:610: warning: unused variable '_FBORPOR'

Regards,
Raady.
 

You didn't understand the meaning of attributes like _FBORPOR(). They translate to hardware fuses that are set during device programming.
 

Ok, I get it FVM,

Then is it there any other possible way so that no one can disturb my running motor by reset as it get disabled ?
 

Quite simple, if you don't want MCLR function temporarily, you must disable it permanently.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…