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.

strncmp Issue in c18 compiler for My UART code ?

Status
Not open for further replies.

nick703

Advanced Member level 1
Advanced Member level 1
Joined
Oct 17, 2011
Messages
422
Helped
21
Reputation
44
Reaction score
22
Trophy points
1,298
Location
surat
Visit site
Activity points
3,987
hello friends i have a configure UART on pic18f4431 using c18 compiler in MPlab ide.
and below is the my code
Code:
void main()
{	
	initial_all();
	initial_intrrupt();
	initial_start();
	initial_variables();

	/********************************************************************************************/	

		UART2_txArray(PowerOn,strlen(PowerOn));
	/*******************************************************************************************/
	
	while(1)
	{  	
		if (!strncmp(C,"{3QFG}",6))
		{
			PORTAbits.RA1 = 1;
			UART2_txArray(ComOn,strlen(ComOn));
			bPassword = TRUE;
		}
	}
}

now when i run this program using mplab simulator that time i am directly enter in this line if (!strncmp(C,"{3QFG}",6)) and every time i receive [3COM] . i am not sending any{3QFG} COMMAND.

and same code used in pic32 device using c32 compiler this function completely work. i don't know this type of behaviour of Strncmp function.

below is my full project file.
 

Attachments

  • TestUart.rar
    22.9 KB · Views: 41

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top