This was our second day in a lab. We had one day theory in
microprocessor and toady we tried at applying what we have learned in writing
programs. As the previous day we were grouped into 4 and each group had two
members. We were to do two programs. The questions chosen by my group is given
below.
1. Develop a program to convert decimal number to hexadecimal.
2. Find the square root of a number using successive
approximation.
We were able to execute the
programs successfully.
ALGORITHM TO FIND SQUARE ROOT (SUCCESSIVE APPROXIMATION)
1. Set C as 01
2. Set E as 01
3. Set A as 09
4. Subtract A and C
5. Go to step 10 if A=0
6. Increment C by1
7. Increment C by 1
8. Increment E by 1
9. Repeat step 4-8
10. Copy the contents of E to A
11. Store the value of A to a memory location
12. Stop
ALGORITHM TO CONVERT DECIMAL TO HEXADECIMAL (eg: 255)
1. Set A as 0
2. Set B as 02
3. Set C as 05
4. Set D as 05
5. Set E as 64
6. Go to 10 step if B=A
7. Sum contents of A and E
8. Decrement B by 1
9. Repeat steps 7-8 until B not equal to 0
10. Set the value of E as 0A
11. Go to step 15 if C=A
12. Sum the contents of E and A
13. Decrement C by 1
14. Repeat steps 12-13 until C not equal to 0
15. Sum the contents of D and A
16. Store the contents of A in a memory location
17. Stop
No comments:
Post a Comment