Thursday 31 January 2013

Kaprekar Number 6174 Theory


The number 6174 is the only unchanged mysterious number discovered by Kaprekar's operation. Discover the mystery behind the 6174 loop by using any four digit number.
Rules
   Step 1  
Select any four digit number, but do not select the ones in which all the four
  digits are the same like 1111, 2222, ...  
   Step 2  
Arrange the digits in decreasing order. 
   Step 3  
Arrange the digits in increasing order. 
   Step 4  
Subtract the smaller number from the larger number. 
   Step 5  
Repeat the steps 2, 3 and 4 until you get 6174 in repetition. 
Example
  Step : 1 ==> 4 digit number is 5620. 
  Step : 2 ==> Arrange decreasing order : 6520 
  Step : 3 ==> Arrange increasing order : 0256 
  Step : 4 ==> Subtract the smaller number from the larger number : 
       6520 - 0256 = 6264 
  Step : 5 ==> Take the final result and repeat the steps 2, 3, and 4 until
you get the repetition of 6174. 

  Like,
6264 = 6642 - 2466 = 4176 
  4176 = 7641 - 1467 = 6174 
6174 = 7641 - 1467 = 6174 
Have fun with this math trick and discover why all the 4 digit numbers on subtracting using the kaprekar operation reach to the mysterious number 6174.

Angel Number 421


Take any whole number and apply the rules and play.
Rules
   Step 1  
Select any whole number. 
   Step 2  
If it is an even number, divide by 2; if it is odd number multiply by 3 and add 1. 
   Step 3  
Repeat the process mentioned in step 2 until you get the loop value 4, 2, 1 in 
repetition. 
Example
  Whole number is 15. 
  15 is an odd no; so (15 × 3) + 1 = 46 
  46 is an even no; so 46 / 2 = 23 
  23 is an odd no; so (23 × 3) + 1 = 70 
  70 is an even no; so 70 / 2 = 35 
  35 is an odd no; so (35 × 3) + 1 = 106 
  106 is an even no; so 106 / 2 = 53 
  53 is an odd no; so (53 × 3) + 1 = 160 
  160 is an even no; so 160 / 2 = 80 
  80 is an even no; so 80 / 2 = 40 
  40 is an even no; so 40 / 2 = 20 
  20 is an even no; so 20 / 2 = 10 
  10 is an even no; so 10 / 2 = 5 
  5 is an odd no; so (5 × 3) + 1 = 16 
  16 is an even no; so 16 / 2 = 8 
  8 is an even no; so 8 / 2 = 4 
  4 is an even no; so 4 / 2 = 2 
  2 is an even no; so 2 / 2 = 1 
  1 is an odd no; so (1 × 3) + 1 = 4 
  4 is an even no; so 4 / 2 = 2 
  2 is an even no; so 2 / 2 = 1 

  So the loop 4..2..1 goes on and on.
Tip : The angel number 421 is the smallest prime formed by the two powers in logical order from right to left.

Multiplying Two-digit Numbers By 11


Multiplying Two-digit Numbers By 11 

This math multiplication trick helps you to multiply any two digit number by 11 easily and quickly.

Example 1:
Let us take the example of 12 * 11

Step 1:
In the first step, let us focus on 12.
Split the number 12 like this,1-------2

Step 2:
Now add the two digits of 12
That is1+2=3

Step 3:
Place 3 in the middle of the two digits of 12 and the result is 132
Now, we have arrived at the answer for 12*11=132.

Example 2:
Now let us take another example.65 * 11

Step 1:
As mentioned above in the first step, focus on 65.
Split the number 65 like this,6-------5

Step 2:
Now add the two digits of 65
That is6+5=11

Step 3:
However, we cannot place 11 in the middle of the two digits of 65.Write 1 in between 6 and 5. Carry over the remaining 1 to the previous number 6 as given below.
Add the 1 with 6 to get the digit in the hundredth place.
We have arrived at the answer for 65*11=715.

Math Addition Trick for Adding Two Digit Numbers


Math Addition Trick for Adding Two Digit Numbers

This math addition trick helps you in adding 2 two-digit numbers mentally without using paper and pen.
Let us begin with the basic method of adding two numbers
Take the example of 71 + 69
This is the usual method which we do with the help of pen and paper
Are you interested to do these calculations mentally?
If your answer is yes,then read below to learn the trick.

Trick:
In addition, adding 10 to a two digit number is easy as we just need to increase the digit in the tenth place by 1. 12 + 10 is 22,34 + 10 is 44 and so on.
We use the same rule while adding any two numbers.To be clear, see how 71 and 69 is added

Method 1:
Step 1:
71 + 69 can be written as 71 + 70 -1
In this step, 69 is split as 70 and 1

Step 2:
Addition of 71 + 70 is easy which gives 141 ie 71 + 70 = 141
Now subtract 1 from 141 ie 141 - 1 = 140.
This gives the answer i.e. 71 + 69 = 140

Method 2:
Alternatively, the below method can also be used.The choice of method depends on the numbers that are added

Step 1:
71 + 69 can be written as 71 + 60 + 9
In this step, 69 is split as 60 and 9

Step 2:
Addition of 71 + 60 is easy which gives 131 ie 71 + 60 = 131
Now add 9 to 131 ie 131 + 9 = 140.
This gives the answer i.e. 71 + 69 = 140
When you practice this, you can increase the speed and improve your addition skills.Try some practice questions

Practice Questions
1.19+26=?
2.31+39=?
3.14+45=?
4.11+79=?

Finger Multiplication of Ninth (9th) Time Table


Math Trick to easily multiply and learn the ninth (9th) time table. It is used to teach children to learn tricks about multiplication table.
Place your fingers as in the below image and number the fingers from 1 to 10. 
Example 
Consider the multiplication of 4 × 9. 

Step 1: 
Here 4 is to be multiplied by 9. 
So, fold the 4th finger and count the ones before the folded finger. 
Number of fingers before the folded finger = 3 fingers 
Multiply the number by 10, = 3 × 10 = 30 -----> (1) 
(as shown in the below figure)


Step 2: 
Count the fingers after the folded finger = 6 -----> (2) 
(as shown in the below figure)

Step 3: 
Add (1) and (2), 
= 30 + 6 = 36 
Therefore the solution to our problem 4 × 9 = 36 is easily found using the above trick. 

Note: 
If there is no finger below/above the considered (folded) finger, then consider the value as zero (0). 
Play the same for the below multiplications
1 × 9 = ?
2 × 9 = ?
3 × 9 = ?
4 × 9 = ?
5 × 9 = ?
6 × 9 = ?
7 × 9 = ?
8 × 9 = ?
9 × 9 = ?
10 × 9 = ?



Finger Multiplication of 6,7,8,9,10 Time Tables


Math Trick to easily multiply the numbers from 6 to 10. It is used to teach children to learn tricks about multiplication time tables.

Place your fingers as in the below image and consider the value of fingers in each hand to be 6, 7, 8, 9 and 10 - in the order from small finger to thumb. 

Example 
Consider the multiplication of 7 × 8. 
Make the finger numbered 7 in the left hand to touch the finger numbered 8 in the right hand. 

Step 1: 
Now in the left hand, count the finger which is touching (7) and the ones below that = 2 fingers 
Similarly in the right hand, count the finger which is touching (8) and the ones below that = 3 fingers 
Add the above counted fingers = 2 + 3 = 5 fingers 
Multiply the number by 10 = 5 × 10 = 50 -----> (1) 

Step 2: 
In the left hand, count the fingers above the touching finger = 3 fingers 
Similarly in the right hand, count the fingers above the touching finger = 2 fingers 
Multiply both = 3 × 2 = 6 -----> (2) 

Step 3: 
Add (1) and (2), 
= 50 + 6 = 56 
So, the answer for 7 × 8 = 56 which is easily found through the above trick. 

Note: 
If there is no finger above the considered (touched) finger, then consider the value as zero (0). 
Play the same for the below multiplications
6 × 6 = ? 6 × 7 = ? 6 × 8 = ? 6 × 9 = ? 6 × 10 = ?
7 × 6 = ? 7 × 7 = ? 7 × 8 = ? 7 × 9 = ? 7 × 10 = ?
8 × 6 = ? 8 × 7 = ? 8 × 8 = ? 8 × 9 = ? 8 × 10 = ?
9 × 6 = ? 9 × 7 = ? 9 × 8 = ? 9 × 9 = ? 9 × 10 = ?
10 × 6 = ? 10 × 7 = ? 10 × 8 = ? 10 × 9 = ? 10 × 10 = ?




Maths Tricks with Numbers

Maths Tricks with Numbers

Trick 1:Quick Square

  1. If you need to square a 2 digit number ending in 5, you can do so very easily with this trick. 
  2. Mulitply the first digit by itself + 1, and put 25 on the end. 
  3. That is all!
  4. Ex:25 ie(2*(2+1))&25
Answer:625

Trick 2: Multiply by 5

  1. Take any number, then divide it by 2
  2. If the result is whole, add a 0 at the end.
  3. If it is not, ignore the remainder and add a 5 at the end. 
  4. 2682 x 5 = (2682 / 2) & 5 or 0
  5. 2682 / 2 = 1341 (whole number so add 0)
  6. Ans:13410
  7. Let’s try another:5887 x 5,2943.5 (fractional numbers (ignore remainder, add 5)
Answer: 29435

Trick 3: Tough Multiplication

  1. If you have a large number to multiply and one of the numbers is even, you can easily subdivide to get to the answer
  2. Ex:32 x 125, is the same as: 16 x 250 is the same as: 8 x 500 is the same as: 4 x 1000 = 4,000

Trick 4: Subtracting from 1,000

  1. To subtract a large number from 1,000 you can use this basic rule: subtract all but the last number from 9, then subtract the last number from 10:
  2. Ex:1000-648
  3. subtract 6 from 9 = 3
  4. subtract 4 from 9 = 5
  5. subtract 8 from 10 = 2 
Answer: 352

Maths Magic - Consecutive Number Fun Tricks

Maths Magic - Consecutive Number Fun Tricks


Here comes fun math number tricks that you can do to friends and family.

Trick 1: 2's trick


  1. Think of a number .
  2. Multiply it by 3.
  3. Add 6 with the getting result.
  4. divide it by 3.
  5. Subtract it from the first number used.

Answer:2

Trick 2: Any Number


  1. Think of any number.
  2. Double the number.
  3. Add 9 with result.
  4. sub 3 with the result.
  5. Divide the result by 2.
  6. Subtract the number with the number with first number started with.

Answer: 3

Trick 3: Any three digit Number


  1. Add 7 to it.
  2. Multiply the number with 2.
  3. subtract 4 with the result.
  4. Divide the result by 2.
  5. Subtract it from the number started with.

Answer: 5

Math Magic Tricks - Birthday Date Calcualtion


Math Magic Tricks - Birthday Date Calcualtion

Here comes a math trick to play upon calcualting your birthday date. Suprise your friends and family with this magic calculation tricks and have fun.

  1. Add 18 to your birth month.
  2. Multiply by 25.
  3. Subtract 333.
  4. Multiply by 8.
  5. Subtract 554.
  6. Divide by 2.
  7. Add your birth date.
  8. Multiply by 5.
  9. Add 692.
  10. Multiply by 20.
  11. Add only the last two digits of your birth year.
  12. Subtract 32940 to get your birthday!.
Example: If the answer is 123199 means that you were born on December 31, 1999. If the answer is not right, you followed the directions incorrectly or lied about your birthday.

Math Magic / Phone Number / Missing Digit / Funny Tricks



Math Magic / Phone Number / Missing Digit / Funny Tricks

This ia a simple math magic. Here involved few maths tricks to play. You can play these number tricks as instructed, with your parents or friends and prove your talent to them. Have fun with maths.


Trick 1: Phone Number trick



  1. Grab a calculator (You wont be able to do this one in your head) .
  2. Key in the first three digits of your phone number (NOT the area code-if your number is 01-123-4567, the 1st 3 digits are 123).
  3. Multiply by 80.
  4. Add 1.
  5. Multiply by 250.
  6. Add the last 3 digits of your phone number with a 0 at the end as one number
  7. Repeat step 6
  8. Subtract 250
  9. Divide number by 20

Answer: The 3 digits of your phone number


Trick 2: Missing digit Trick



  1. Choose a large number of six or seven digits.
  2. Take the sum of digits.
  3. Subtract sum of digits from any number chosen.
  4. Mix up the digits of resulting number.
  5. Add 25 to it.
  6. Cross out any one digit except zero.
  7. Tell the sum of the digits. Subtract the sum of the digits from 25.

Answer: Inorder to find out the missing digit, subtract the sum of digits from 25. The difference is the missing digit.

Math Magic / Number fun / Maths Tricks

Math Magic / Number fun / Maths Tricks
This ia a simple math magic. Here involved few maths tricks to play. You can play these number tricks as instructed, with your parents or friends and prove your talent to them. Have fun with maths.


Trick 1: 2's trick


  1. Think of a number .
  2. Multiply it by 3.
  3. Add 6 with the getting result.
  4. divide it by 3.
  5. Subtract it from the first number used.

Answer:2

Trick 2: Any Number


  1. Think of any number.
  2. Double the number.
  3. Add 9 with result.
  4. sub 3 with the result.
  5. Divide the result by 2.
  6. Subtract the number with the number with first number started with.

Answer: 3

Trick 3: Any three digit Number


  1. Add 7 to it.
  2. Multiply the number with 2.
  3. subtract 4 with the result.
  4. Divide the result by 2.
  5. Subtract it from the number started with.

Answer: 5

Math Magic/Tricks

Here we have mentioned few math trick play. You can play these tricks as instructed, with your parents or friends and prove your talent to them.

Trick 1: Number below 10



  1. Think of a number below 10.
  2. Double the number you have thought.
  3. Add 6 with the getting result.
  4. Half the answer, that is divide it by 2.
  5. Take away the number you have thought from the answer, that is, subtract the answer from the number you have thought.

Answer: 3


Trick 2: Any Number


  1. Think of any number.
  2. Subtract the number you have thought with 1.
  3. Multiply the result with 3.
  4. Add 12 with the result.
  5. Divide the answer by 3.
  6. Add 5 with the answer.
  7. Take away the number you have thought from the answer, that is, subtract the answer from the number you have thought.
Answer: 8

Trick 3: Any Number

  1. Think of any number.
  2. Multiply the number you have thought with 3.
  3. Add 45 with the result.
  4. Double the result.
  5. Divide the answer by 6.
  6. Take away the number you have thought from the answer, that is, subtract the answer from the number you have thought.
Answer: 15

Trick 4: Same 3 Digit Number

  1. Think of any 3 digit number, but each of the digits must be the same as. Ex: 333, 666.
  2. Add up the digits.
  3. Divide the 3 digit number with the digits added up.
Answer: 37

Trick 5: 2 Single Digit Numbers

  1. Think of 2 single digit numbers.
  2. Take any one of the number among them and double it.
  3. Add 5 with the result.
  4. Multiply the result with 5.
  5. Add the second number to the answer.
  6. Subtract the answer with 4.
  7. Subtract the answer again with 21.
Answer: 2 Single Digit Numbers.

Trick 6: 1, 2, 4, 5, 7, 8

  1. Choose a number from 1 to 6.
  2. Multiply the number with 9.
  3. Multiply the result with 111.
  4. Multiply the result by 1001.
  5. Divide the answer by 7.
Answer: All the above numbers will be present.

Trick 7: 1089

  1. Think of a 3 digit number.
  2. Arrange the number in descending order.
  3. Reverse the number and subtract it with the result.
  4. Remember it and reverse the answer mentally.
  5. Add it with the result, you have got.
Answer: 1089

Trick 8: x7x11x13

  1. Think of a 3 digit number.
  2. Multiply it with x7x11x13.
Ex: Number: 456, Answer: 456456

Trick 9: x3x7x13x37

  1. Think of a 2 digit number.
  2. Multiply it with x3x7x13x37.
Ex: Number: 45, Answer: 454545

Trick 10: 9091

  1. Think of a 5 digit number.
  2. Multiply it with 11.
  3. Multiply it with 9091.
Ex: Number: 12345,Answer:1234512345


Names for Powers of 10


Values Zero's Names
100          0 One
101          1 Ten
102          2 Hundred
103          3 Thousand
104          4 Myriad
106          6 Million
109          9 Billion
1012 12 Trillion
1015 15 Quadrillion
1018 18 Quintillion
1021 21 Sextillion
1024 24 Septillion
1027 27 Octillion
1030 30 Nonillion
1033 33 Decillion
1036 36 Undecillion
1039 39 Duodecillion
1042 42 Tredecillion
1045 45 Quattuordecillion
1048 48 Quindecillion
1051 51 Sexdecillion
1054 54 Septdecillion / Septendecillion
1057 57 Octodecillion
1060 60 Nondecillion / Novemdecillion
1063 63 Vigintillion
1066 66 Unvigintillion
1069 69 Duovigintillion
1072 72 Trevigintillion
1075 75 Quattuorvigintillion
1078 78 Quinvigintillion
1081 81 Sexvigintillion
1084 84 Septenvigintillion
1087 87 Octovigintillion
1090 90 Novemvigintillionn
1093 93 Trigintillion
1096 96 Untrigintillion
1099 99 Duotrigintillion
10100 100 Googol
10102 102 Trestrigintillion
10120 120 Novemtrigintillion
10123 123 Quadragintillion
10138 138 Quinto-Quadragintillion
10153 153 Quinquagintillion
10180 180 Novemquinquagintillion
10183 183 Sexagintillion
10213 213 Septuagintillion
10240 240 Novemseptuagintillion
10243 243 Octogintillion
10261 261 Sexoctogintillion
10273 273 Nonagintillion
10300 300 Novemnonagintillion
10303 303 Centillion
10309 309 Duocentillion
10312 312 Trescentillion
10351 351 Centumsedecillion
10366 366 Primo-Vigesimo-Centillion
10402 402 Trestrigintacentillion
10603 603 Ducentillion
10624 624 Septenducentillion
10903 903 Trecentillion
102421 2421 Sexoctingentillion
103003 3003 Millillion
103000003 3000003 Milli-Millillion

Number 2519


Number 2519: 

It is an interesting number. Here are some funny math interesting facts about this number 2519. Enjoy the Facts.


2519 Mod n means the reminder of 2519/n, here / is the integer division.
2519 Mod n 
2519 Mod 2 = 1
2519 Mod 3 = 2
2519 Mod 4 = 3
2519 Mod 5 = 4
2519 Mod 6 = 5
2519 Mod 7 = 6
2519 Mod 8 = 7
2519 Mod 9 = 8
2519 Mod 10 = 9


Sequential Numbers with 2519
1259 x 2 + 1 = 2519
839 x 3 + 2 = 2519
629 x 4 + 3 = 2519
503 x 5 + 4 = 2519
419 x 6 + 5 = 2519
359 x 7 + 6 = 2519
314 x 8 + 7 = 2519
279 x 9 + 8 = 2519
251 x 10 + 9 = 2519

Amazing Prime Numbers

Amazing Prime Numbers: 

    There are few amazing prime numbers, which are unbelievable. Here are some funny math interesting facts of prime numbers. Enjoy the Facts.


Here are few amazing prime numbers, these prime numbers were proved by the XVIIIth century.

31
331
3331
33331
333331
3333331
33333331

The next number 333333331 is not a prime number. Whereas it is multiplied by 17 x 19607843 = 333333331.

Beauty of Mathematics


Beauty of Mathematics: 

    Here are some funny math interesting facts. All the below tricks are based around the sequential manipulation of the numbers being used for input and output.


Sequential Inputs of numbers with 8

1 x 8 + 1 = 9
12 x 8 + 2 = 98
123 x 8 + 3 = 987
1234 x 8 + 4 = 9876
12345 x 8 + 5 = 98765
123456 x 8 + 6 = 987654
1234567 x 8 + 7 = 9876543
12345678 x 8 + 8 = 98765432
123456789 x 8 + 9 = 987654321


Sequential 1's with 9

1 x 9 + 2 = 11
12 x 9 + 3 = 111
123 x 9 + 4 = 1111
1234 x 9 + 5 = 11111
12345 x 9 + 6 = 111111
123456 x 9 + 7 = 1111111
1234567 x 9 + 8 = 11111111
12345678 x 9 + 9 = 111111111
123456789 x 9 + 10 = 1111111111


Sequential 8's with 9

9 x 9 + 7 = 88
98 x 9 + 6 = 888
987 x 9 + 5 = 8888
9876 x 9 + 4 = 88888
98765 x 9 + 3 = 888888
987654 x 9 + 2 = 8888888
9876543 x 9 + 1 = 88888888
98765432 x 9 + 0 = 888888888


Numeric Palindrome with 1's

1 x 1 = 1
11 x 11 = 121
111 x 111 = 12321
1111 x 1111 = 1234321
11111 x 11111 = 123454321
111111 x 111111 = 12345654321
1111111 x 1111111 = 1234567654321
11111111 x 11111111 = 123456787654321
111111111 x 111111111 = 12345678987654321


Without 8

12345679 x 9 = 111111111
12345679 x 18 = 222222222
12345679 x 27 = 333333333
12345679 x 36 = 444444444
12345679 x 45 = 555555555
12345679 x 54 = 666666666
12345679 x 63 = 777777777
12345679 x 72 = 888888888
12345679 x 81 = 999999999


Sequential Inputs of 9

9 x 9 = 81
99 x 99 = 9801
999 x 999 = 998001
9999 x 9999 = 99980001
99999 x 99999 = 9999800001
999999 x 999999 = 999998000001
9999999 x 9999999 = 99999980000001
99999999 x 99999999 = 9999999800000001
999999999 x 999999999 = 999999998000000001
......................................


Sequential Inputs of 6

6 x 7 = 42
66 x 67 = 4422
666 x 667 = 444222
6666 x 6667 = 44442222
66666 x 66667 = 4444422222
666666 x 666667 = 444444222222
6666666 x 6666667 = 44444442222222
66666666 x 66666667 = 4444444422222222
666666666 x 666666667 = 444444444222222222
......................................

Age Calculation

Age Calculation
Here you can find the age using some tricks. You can play these trick as instructed, with your parents or friends and prove your talent to them.


Age Calculation Tricks:


  1. Multiply the first number of the age by 5. (If <10, ex 5, consider it as 05. If it is >100, ex: 102, then take 10 as the first digit, 2 as the second one.)
  2. Add 3 to the result.
  3. Double the answer.
  4. Add the second digit of the number with the result.
  5. Subtract 6 from it.


Day of the Date

Here are some shortcuts/tips to find out the day of the week from the given date. You can play these trick as instructed, with your parents or friends and prove your talent to them.


Day of the Week:

January has 31 days. It means that every date in February will be 3 days later than the same date in January(28 is 4 weeks exactly). The below table is calculated in such a way. Remember this table which will help you to calculate.
January         0
February         3
March         3
April                 6
May                 1
June                 4
July                 6
August         2
September 5
October         0
November 3
December  5

Follow the following steps:

  1. Ask for the Date. Ex: 23rd June 1986
  2. Number of the month on the list, June is 4.
  3. Take the date of the month, that is 23
  4. Take the last 2 digits of the year, that is 86.
  5. Find out the number of leap years. Divide the last 2 digits of the year by 4, 86 divide by 4 is 21.
  6. Now add all the 4 numbers: 4 + 23 + 86 + 21 = 134.
  7. Divide 134 by 7 = 19 remainder 1.

The reminder tells you the day.
Sunday         0
Monday         1
Tuesday         2
Wednesday 3
Thursday         4
Friday         5
Saturday         6

Answer: Monday

Sunday 27 January 2013

SERIAL COMMUNICATION

SERIAL COMMUNICATION

BASICS OF SERIAL COMMUNICATION:

Computers transfer data in two ways:
  • Parallel
    • Often 8 or more lines (wire conductors) are used to transfer data to a device that is only a few feet away
  • Serial
    • To transfer to a device located many meters away, the serial method is used
    • The data is sent one bit at a time
  • At the transmitting end, the byte of data must be converted to serial bits using parallel-in-serial-out shift register
  • At the receiving end, there is a serialin- parallel-out shift register to receive the serial data and pack them into byte
  • When the distance is short, the digital signal can be transferred as it is on a simple wire and requires no modulation
  • If data is to be transferred on the telephone line, it must be converted from 0s and 1s to audio tones
    • This conversion is performed by a device called a modem, “Modulator/demodulator”


Methods of Serial Communication:

Serial data communication uses two methods
  • Synchronous method transfers a block of data at a time
  • Asynchronous method transfers a single byte at a time

Half- and Full- Duplex Transmission

If data can be transmitted and received, it is a duplex transmission
  • If data transmitted one way a time, it is referred to as half duplex
  • If data can go both ways at a time, it is full duplex
  • This is contrast to simplex transmission

Data Transfer Rate

  • The rate of data transfer in serial data communication is stated in bps (bits per second)
    • Another widely used terminology for bps is baud rate
    • It is modem terminology and is defined as the number of signal changes per second
    • In modems, there are occasions when a single change of signal transfers several bits of data
Example:
With XTAL = 11.0592 MHz, find the TH1 value needed to have the following baud rates. (a) 9600 (b) 2400 (c) 1200
Solution:
The machine cycle frequency of 8051 = 11.0592 / 12 = 921.6 kHz, and 921.6 kHz / 32 = 28,800 Hz is frequency by UART to timer 1 to set baud rate.
  1. 28,800 / 3 = 9600 where -3 = FD (hex) is loaded into TH1
  2. 28,800 / 12 = 2400 where -12 = F4 (hex) is loaded into TH1
  3. 28,800 / 24 = 1200 where -24 = E8 (hex) is loaded into TH1
Notice that dividing 1/12 of the crystal frequency by 32 is the default value upon activation of the 8051 RESET pin.

SBUF Register

  • SBUF is an 8-bit register used solely for serial communication
    • For a byte data to be transferred via the TxD line, it must be placed in the SBUF register
      • The moment a byte is written into SBUF, it is framed with the start and stop bits and transferred serially via the TxD line
  • SBUF holds the byte of data when it is received by 8051 RxD line
    • When the bits are received serially via RxD, the 8051 deframes it by eliminating the stop and start bits, making a byte out of the data received, and then placing it in SBUF
Example:
MOV SBUF,#’D’         ;load SBUF=44h, ASCII for ‘D’
MOV SBUF,A              ;copy accumulator into SBUF
MOV A,SBUF              ;copy SBUF into accumulator

SCON Register

SCON is an 8-bit register used to program the start bit, stop bit, and data bits of data framing, among other things
SM0
SCON.7
Serial port mode specifier
SM1
SCON.6
Serial port mode specifier
SM2
SCON.5
Used for multiprocessor communication
REN
SCON.4
Set/cleared by software to enable/disable reception
TB8
SCON.3
Not widely used
RB8
SCON.2
Not widely used
TI
SCON.1
Transmit interrupt flag. Set by HW at the begin of the stop bit mode 1. And cleared by SW
RI
SCON.0
Receive interrupt flag. Set by HW at the begin of the stop bit mode 1. And cleared by SW
Note:    Make SM2, TB8, and RB8 =0

SM0, SM1
  • They determine the framing of data by specifying the number of bits per character, and the start and stop bits
  • Only MODE1 is of our interest. 
SM0
SM1

0
0
Serial Mode 0
0
1
Serial Mode 1, 8-bit data,
1 stop bit, 1 start bit
1
0
Serial Mode 2
1
1
Serial Mode 3

SM2
  • This enables the multiprocessing capability of the 8051
REN (receive enable)
  • It is a bit-adressable register
    • When it is high, it allows 8051 to receive data on RxD pin
    • If low, the receiver is disable
TI (transmit interrupt)
  • When 8051 finishes the transfer of 8-bit character
    • It raises TI flag to indicate that it is ready to transfer another byte
    • TI bit is raised at the beginning of the stop bit
RI (receive interrupt)
  • When 8051 receives data serially via RxD, it gets rid of the start and stop bits and places the byte in SBUF register
    • It raises the RI flag bit to indicate that a byte has been received and should be picked up before it is lost
    • RI is raised halfway through the stop bit

Programming Serial Data Transmitting

In programming the 8051 to transfer character bytes serially
  1. TMOD register is loaded with the value 20H, indicating the use of timer 1 in mode 2 (8-bit auto-reload) to set baud rate
  2. The TH1 is loaded with one of the values to set baud rate for serial data transfer
  3. The SCON register is loaded with the value 50H, indicating serial mode 1, where an 8- bit data is framed with start and stop bits
  4. TR1 is set to 1 to start timer 1
  5. TI is cleared by CLR TI instruction
  6. The character byte to be transferred serially is written into SBUF register
  7. The TI flag bit is monitored with the use of instruction JNB TI,xx to see if the character has been transferred completely
  8. To transfer the next byte, go to step 5
Example:
Write a program for the 8051 to transfer letter “A” serially at 4800 baud, continuously.
Solution:
MOV TMOD,#20H            ;timer 1,mode 2(auto reload)
MOV TH1,#-6                    ;4800 baud rate
MOV SCON,#50H             ;8-bit, 1 stop, REN enabled
SETB TR1                           ;start timer 1
AGAIN:
MOV SBUF,#”A”               ;letter “A” to transfer
HERE:
JNB TI,HERE                      ;wait for the last bit
CLR TI                                ;clear TI for next char
SJMP AGAIN                     ;keep sending A

Example:
Write a program for the 8051 to transfer “YES” serially at 9600 baud, 8-bit data, 1 stop bit, do this continuously
Solution:
MOV TMOD,#20H            ;timer 1,mode 2(auto reload)
MOV TH1,#-3                     ;9600 baud rate
MOV SCON,#50H             ;8-bit, 1 stop, REN enabled
SETB TR1                            ;start timer 1
AGAIN:
MOV A,#”Y”                       ;transfer “Y”
ACALL TRANS
MOV A,#”E”                       ;transfer “E”
ACALL TRANS
MOV A,#”S”                       ;transfer “S”
ACALL TRANS
SJMP AGAIN                      ;keep doing it
         ;serial data transfer subroutine
TRANS:
MOV SBUF,A                     ;load SBUF
HERE:
JNB TI,HERE                       ;wait for the last bit
CLR TI                                  ;get ready for next byte
RET 

Importance of TI Flag


The steps that 8051 goes through in transmitting a character via TxD
  • The byte character to be transmitted is written into the SBUF register
  • The start bit is transferred
  • The 8-bit character is transferred on bit at a time
  • The stop bit is transferred
    • It is during the transfer of the stop bit that 8051 raises the TI flag, indicating that the last character was transmitted
  • By monitoring the TI flag, we make sure that we are not overloading the SBUF
    • If we write another byte into the SBUF before TI is raised, the untransmitted portion of the previous byte will be lost
  • After SBUF is loaded with a new byte, the TI flag bit must be forced to 0 by CLR TI in order for this new byte to be transferred
By checking the TI flag bit, we know whether or not the 8051 is ready to transfer another byte
  • It must be noted that TI flag bit is raised by 8051 itself when it finishes data transfer
  • It must be cleared by the programmer with instruction CLR TI
  • If we write a byte into SBUF before the TI flag bit is raised, we risk the loss of a portion of the byte being transferred
The TI bit can be checked by
  • The instruction JNB TI,xx
  • Using an interrupt

Programming Serial Data Receiving

In programming the 8051 to receive character bytes serially
  1. TMOD register is loaded with the value 20H, indicating the use of timer 1 in mode
  2. (8-bit auto-reload) to set baud rate
  3. TH1 is loaded to set baud rate
  4. The SCON register is loaded with the value 50H, indicating serial mode 1, where an 8- bit data is framed with start and stop bits
  5. TR1 is set to 1 to start timer 1
  6. RI is cleared by CLR RI instruction
  7. The RI flag bit is monitored with the use of instruction JNB RI,xx to see if an entire character has been received yet
  8. When RI is raised, SBUF has the byte, its contents are moved into a safe place
  9. To receive the next character, go to step 5
Example:
Write a program for the 8051 to receive bytes of data serially, and put them in P1, set the baud rate at 4800, 8-bit data, and 1 stop bit

Solution:
MOV TMOD,#20H            ;timer 1,mode 2(auto reload)
MOV TH1,#-6                    ;4800 baud rate
MOV SCON,#50H             ;8-bit, 1 stop, REN enabled
SETB TR1                           ;start timer 1
HERE:
JNB RI,HERE                      ;wait for char to come in
MOV A,SBUF                     ;saving incoming byte in A
MOV P1,A                           ;send to port 1
CLR RI                                 ;get ready to receive next byte
SJMP HERE                         ;keep getting data

Example:
Assume that the 8051 serial port is connected to the COM port of IBM PC, and on the PC, we are using the terminal.exe program to send and receive data serially. P1 and P2 of the 8051 are connected to LEDs and switches, respectively. Write an 8051 program to (a) send to PC the message “We Are Ready”, (b) receive any data send by PC and put it on LEDs connected to P1, and (c) get data on switches connected to P2 and send it to PC serially. The program should perform part (a) once, but parts (b) and (c) continuously, use 4800 baud rate.



ORG 0
MOV P2,#0FFH                 ;make P2 an input port
MOV TMOD,#20H            ;timer 1, mode 2
MOV TH1,#0FAH              ;4800 baud rate
MOV SCON,#50H             ;8-bit, 1 stop, REN enabled
SETB TR1                              ;start timer 1
MOV DPTR,#MYDATA    ;load pointer for message
H_1:
CLR A
MOV A,@A+DPTR           ;get the character
JZ B_1                                ;if last character get out
ACALL SEND                    ;otherwise call transfer
INC DPTR                          ;next one
SJMP H_1                          ;stay in loop
B_1:
MOV a,P2                          ;read data on P2
ACALL SEND                   ;transfer it serially
ACALL RECV                   ;get the serial data
MOV P1,A                         ;display it on LEDs
SJMP B_1                          ;stay in loop indefinitely
;----serial data transfer. ACC has the data------
SEND:
MOV SBUF,A                   ;load the data
H_2:
JNB TI,H_2                       ;stay here until last bit gone
CLR TI                              ;get ready for next char
RET ;return to caller
;----Receive data serially in ACC----------------
RECV:
JNB RI,RECV                   ;wait here for char
MOV A,SBUF                  ;save it in ACC
CLR RI                             ;get ready for next char
RET                                  ;return to caller
;-----The message---------------
MYDATA: DB “We Are Ready”,0
END

Importance of RI Flag

In receiving bit via its RxD pin, 8051 goes through the following steps
  • It receives the start bit
    • Indicating that the next bit is the first bit of the character byte it is about to receive
  • The 8-bit character is received one bit at time
  • The stop bit is received
    • When receiving the stop bit 8051 makes RI = 1, indicating that an entire character byte has been received and must be picked up before it gets overwritten by an incoming character
  • By checking the RI flag bit when it is raised, we know that a character has been received and is sitting in the SBUF register
    • We copy the SBUF contents to a safe place in some other register or memory before it is lost
  • After the SBUF contents are copied into a safe place, the RI flag bit must be forced to 0 by CLR RI in order to allow the next received character byte to be placed in SBUF
    • Failure to do this causes loss of the received character
By checking the RI flag bit, we know whether or not the 8051 received a character byte
  • If we failed to copy SBUF into a safe place, we risk the loss of the received byte
  • It must be noted that RI flag bit is raised by 8051 when it finish receive data
  • It must be cleared by the programmer with instruction CLR RI
  • If we copy SBUF into a safe place before the RI flag bit is raised, we risk copying garbage
  • The RI bit can be checked by
    • The instruction JNB RI,xx
    • Using an interrupt

Doubling Baud Rate

There are two ways to increase the baud rate of data transfer
  • To use a higher frequency crystal (The System Crystel is Fix)
  • To change a bit in the PCON register
PCON register is an 8-bit register
  • When 8051 is powered up, SMOD is zero
  • We can set it to high by software and thereby double the baud rate
MOV A,PCON         ;place a copy of PCON in ACC
SETB ACC.7            ;make D7=1
MOV PCON,A         ;changing any other bits

Example:
Assume that XTAL = 11.0592 MHz for the following program, state (a) what this program does, (b) compute the frequency used by timer 1 to set the baud rate, and (c) find the baud rate of the data transfer.
MOV A,PCON              ;A=PCON
MOV ACC.7                 ;make D7=1
MOV PCON,A              ;SMOD=1, double baud rate
   ;with same XTAL freq.
MOV TMOD,#20H       ;timer 1, mode 2
MOV TH1,-3                  ;19200 (57600/3 =19200)
MOV SCON,#50H         ;8-bit data, 1 stop bit, RI enabled
SETB TR1                      ;start timer 1
MOV A,#”B”                  ;transfer letter B
A_1:
CLR TI                            ;make sure TI=0
MOV SBUF,A                ;transfer it
H_1:
JNB TI,H_1                    ;stay here until the last bit is gone
SJMP A_1                      ;keep sending “B” again
Solution:
(a) This program transfers ASCII letter B (01000010 binary) continuously
(b) With XTAL = 11.0592 MHz and SMOD = 1 in the above program, we have: 
11.0592 / 12 = 921.6 kHz machine cycle frequency. 921.6 / 16 = 57,600 Hz frequency used by timer 1 to set the baud rate. 57600 / 3 = 19,200, the baud rate.