How to calculate the MODE number for SERIN2/SEROUT2.

This information is in the manual and appendix "A" in the manual has many of the MODE numbers listed, but sometimes a different explanation is helpful.

First, the MODE number is a 16 bit binary number represented in decimal form. Inside this number is all of the information needed to set the baud rate, none or even parity, inverted or true, and open or driven.

The first 12 bits set the baud rate. This is found by the equation:

(1,000,000 / baud) - 20

Example to find the MODE number for 4,800 baud, 8 data bits, No parity, and 1 stop bit. (8N1)

(1,000,000 / 4800) - 20 = 188

Convert 188 to binary for the first 12 bits

_ _ _ _ _ _ _ _ 1 0 1 1 1 1 0 0

Bit 13 will be 0 for No parity.

_ _ 0 _ _ _ _ _ 1 0 1 1 1 1 0 0

Bit 14 will be set to 1 so we can connect directly to a PC with out an inverter circuit of inverter chip.

_ 1 0 _ _ _ _ _ 1 0 1 1 1 1 0 0

Bit 15 is set to 0 for Driven.

0 1 0 _ _ _ _ _ 1 0 1 1 1 1 0 0

Fill in the blanks.

0100000010111100 and convert to decimal

and we have the MODE number of 16572.

To have 4,800 baud inverted and change the parity to Even giving 7E1 simply change bit 13 from 0 to 1.

0 1 1 _ _ _ _ _ 1 0 1 1 1 1 0 0

0110000010111100 and convert to decimal

and we have the MODE number of 24764.

For information about converting from one number system to another you can go here.

http://melabs.com/resources/articles/index.htm
## Re: Dual instance with MPLAB 8 ?

Thank you Tumbleweed.

MikeBZH Today, 10:24Simple but very interesting solutions.

In France we have a cartoon called "the Shadoks". They always say : "Why to do you want to make it simple when you can make it...