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.

usart communication with pic16f877a

Status
Not open for further replies.

jerkymotion

Member level 4
Joined
Oct 12, 2010
Messages
73
Helped
28
Reputation
56
Reaction score
28
Trophy points
1,298
Location
NEPAL
Activity points
1,824
hi every body
I am using mplab...I am not expert in microcontroller programming ...
I have made GUI to send data to my serial port ...
now I want to write a program in PIC that executes accordingly the serially sent data to my serial port and send data back to the serial port as well....
I am beginner to this so please help to begin with serial port communication..
 

Some compilers have examples very easy and 'ready-to-use'.
Are you performing that on C or ASM language ?

+++
 
i am using c language
compiler-hitech compiler
 
  • Like
Reactions: ssingh

    ssingh

    Points: 2
    Helpful Answer Positive Rating
Receive a string from the HyperTerminal
Code:
char *Receive_MSG(char *String, unsigned short int MSG_Length)
{						
	unsigned short int Index = 0;	// Message Index
	
	while(Index < MSG_Length)
	{	
		String[Index] = Receive_Byte();
		if(String[Index] != 13 && String[Index] != 10)
		{
			String[Index + 1] = '\0';		// Set the next character to NULL
			Index++;
		}
		else
		{
			String[Index + 1] = '\0';		// Set the next character to NULL
			break;
		}
	}
	return String;
}

Send a string to the HyperTerminal
Code:
void Send_MSG(char *Message)
{
	unsigned short int Index = 0;
	while(Message[Index] != '\0')
	{
		Send_Byte(Message[Index]);
		Index++;
	}
	Send_Byte(13);	// Send CR
	Send_Byte(10);	// Send LF
}
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top