.: EMICROS :.  Embedded Micro Software
Home CAN232 CANUSB I2C232 I2CUSB CanWiser Learn C
Add your text here
Contact

Email : info@emicros.com

Ordering Information

.: Ordering using our PayPal powered shopping cart (PayPal account not required).

CAN232 : $79
CANUSB : $89
I2C232 : $79

I2CUSB : $89

Click here to View Cart and check out.

 

 

 

 

Add the SetupCommPort() function to the serial.c file and make sure to add the prototype to the serial.h file.

The baud rate values are set according to the following formula;

SPBRG = (Fosc / (64 * BaudRate))-1

Fosc for the PicWiser is the value of the crystal which is 14,745,600. The calculated values for SPBRG are shown in the second column for the 4 baud rate shown in the first column.

Fosc

14745600

Desired Baud Rate

SPBRG

Actual Baud Rate

9600

23

9600

19200

11

19200

57600

3

57600

115200

1

115200

The last column shows the actual baud rate based on the SPBRG values and as you can see the error between the actual and desired is 0. That is why the 14.7456 Mhz crystal is used.

Note that if we used the highest oscillator value of 20 Mhz supported by the PIC16F876 the higher baud rate would not be available.

Fosc

20000000

Desired Baud Rate

SPBRG

int(SPBRG)

Actual Baud Rate

Error

9600

31.5520833

31

9765.625

1.73%

19200

15.2760417

15

19531.25

1.73%

57600

4.42534722

4

62500

8.51%

115200

1.71267361

1

156250

35.63%

 
 
Copyright 2010 Embedded Micro Software. All rights reserved