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.

serial communication with pic 16f877

Status
Not open for further replies.

waqassalam

Junior Member level 3
Joined
Mar 7, 2012
Messages
31
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,507
i just need to use pic microcontroller for serial commnunication because of some limitation in project .
i have the smart knowledge about 8051 but there is some difficulty with pic so any one can help me to make a simple program using pic to send a byte continously on hyper terminal..
plz any one can write program with detail comments so that i can understand the program as well..
thanksss
 

any one can help me to make a simple program using pic to send a byte continously on hyper terminal..
plz any one can write program with detail comments so that i can understand the program as well..

Assembly or C language? If C language, what compiler are you currently using?

The following tutorial covers the UART and serial communications using the PIC16F887 and MikroC, so you should be able to adapt the routines to the PIC16F877 without too much difficulty.

PIC Serial Communication Tutorial (UART)

Assembly Language Version:

PIC Tutorial Seven - RS232

Also have you downloaded the PIC16F877 datasheet and the Midrange PIC family reference guide? Both have detailed sections on the PIC16 UART.

BigDog
 
  • Like
Reactions: sha111

    sha111

    Points: 2
    Helpful Answer Positive Rating
i am using mikroc for c language....thanks for a good response

- - - Updated - - -

i am using mikroc for c language....thanks for a good response
 

There is extensive help and examples available with mikroC Pro for PIC.

Make sure you have updated to the latest mikroC Pro.

Here is a simple bit of code based on the mikro example:

Code:
char uart_rd;

void main() {
    ANSEL  = 0;                     // Configure AN pins as digital
    ANSELH = 0;

    UART1_Init(9600);               // Initialize UART module at 9600 bps
    Delay_ms(100);                  // Wait for UART module to stabilize


    while (1) {                     // Endless loop
        UART1_Write('U');           // send data via UART
        Delay_ms(100);              // delay to send characters slowly, one at a time
    }
}
Make sure the oscillator frequency you set in "project settings" matches your crystal value
 

can u tell me the that how much baud rate more than 115200 can i achieve by using pic 16f877 and whats the way to selest it.
 

I think getting more than BAUD rate more than 115200 is is not possible....

Code:
/* relates crystal freq to baud rate - see above and PIC16F87x data sheet under 'USART async. modes'

	BRGH=1, Fosc=3.6864MHz		BRGH=1, Fosc=4MHz      BRGH=1, Fosc=8MHz    BRGH=1, Fosc=16MHz
	----------------------	  -----------------      -----------------    ------------------
	Baud		SPBRG             Baud		SPBRG          Baud		SPBRG         Baud		SPBRG
	1200		191               1200		207.3          1200		415.7         9600    103
	2400		95                2400		103.2          2400		207.3         19200		51
	4800		47                4800		51.1           4800		103.2         38400   25
	9600		23                9600		25.0           9600		51.1          57600   16
	19200		11                19200		12.0           19200	25.0          115200  8
	38400		5                 38400		5.5            38400	12.0
	57600		3                 57600		3.3            57600	7.7
	115200	1                 115200	1.2            115200	3.3

	*/

with regards
 

My reading of the datasheet is this:

Maximum baud rate possible is with 20MHz crystal, BRGH=1 and SPBRG=0. This gives 1250000 baud.

Trouble is that this a a non-standard rate and speeds as high as this can be unreliable unless special consideration is given to transmission circuitry and baud-rate accuracy.

I agree with milind.a.kulkarmi that 115200 might be the highest practical baud rate for general purpose use.
 

i think it is possible to generate 115200bps in 8051/52?
is it true or not ..
if it is true plz tell me the way to produce it..
thanks
 

Depends on your system crystal. For instance, an 8052 with a crystal value of 22.1184Mhz can achieve a baud rate of 115.2k baud...
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top