Sunteți pe pagina 1din 11

INTRODUCTION

AES51 development board allows the user to enter the programs in two ways. It allows the
user to insert the intel HEX file for the relevant program via the serial interface using the Terminal
Emulator (TE.EXE) program or the user can directly enter the opcodes in the intel HEX file to the
AES1's code memory using the given hex-keypad.

Before entering a program through the hex-keypad following steps must be followed.

Those steps are,

1. Press the 2nd (PROG) key to enter the monitor mode

2. Wait for the monitor ready display.

3. Press PROG key .

4. If the displayed address is not 7000 press GOTO.

5. Enter 7000 and press ENTER.

6. Press PROG key to enter data

From here each code can be entered and ENTER key is used to go to the next address. In this way
a program can be loaded to ASM51's code memory. Once loaded it can be executed by pressing
the PROG key once and the pressing the RUN key. For the FROM address 7000 must be given and
for the TO address the last address of the program is given. Any program can be loaded to the
AES51's code memory only using the hex file and the keypad.
Other way of loading the program is to use the serial interface and the Terminal Emulator
(TE.EXE). When using the emulator first it must be configured according to the given settings and
then it can be used to send the Intel HEX file to the board. This allows to load the program quickly
and this also minimizes the errors that can happen during entering the program.

During the lab session mainly 8 programs were developed and tested. During the creation
and testing of these programs our knowledge on AES51 board and 8051 microcontroller was
tested. Programs can be described briefly as follows.

PROGRAM 1:

As the first task the hex code given in the course material for the LED flash program was entered
manually ant tested.

PROGRAM 2:

Created a program to light up the LED according to our requirement and it was also loaded to the
board manually and tested.

PROGRAM 3:

Created a program to light up the LEDs when an input is given and to turn off the LEDs when a
different input is given.
PROGRAM 4:

Created program to display a single character on the LCD display of the AES51 board and loaded it
to the board manually and tested.

PROGRAM 5, PROGRAM 6:

Created a simple program using MCU 8051 IDE and examined the code memory and Stack using
the Virtual MCU devices provided in the IDE. Observed how stack is used during CALL instructions
and how relative addressing is used in jump instructions.

PROGRAM 7:

Created a program to display a number between 0 and 255 in the LCD display in 3 digits. To load
the program to the board serial interface was used.

PROGRAM 8:

Modified the previous program to display the result from the A/D conversion of the AES51 board.
Loaded the program using serial interface. Program was further modified to observe the A/D input
pin continuously and set the display to the last read digital value from the A/D converter.
LIST FILES

PROGRAM 2:
PROG1
PAGE 1

0090 1 P1 DATA 90H ;Declare port1 as P1

4 ;-----------Main Programme-------------------------

7000 6 ORG 7000H ;Start program at address


7000H

7000 75907F 7 BEGIN: MOV P1, #01111111B ;Turn on one LED

7003 12701A 8 CALL DELAY ;Keep the bulb turned on for


some time.

7006 7590BF 9 MOV P1, #10111111B ;Turn on next LED, Turn off
previous

7009 12701A 10 CALL DELAY ;Keep the bulb turned on

700C 7590DF 11 MOV P1,#11011111B ;Next LED

700F 12701A 12 CALL DELAY ;Keep LED turned on

7012 7590EF 13 MOV P1, #11101111B ;Next LED

7015 12701A 14 CALL DELAY ;Keep LED turned on

7018 80E6 15 JMP BEGIN ;Goto begining

16

17 ;------------Delay routine------------------------------

18

701A 78FA 19 DELAY: MOV R0, #250D ;Set R1 value to 250

701C 79FA 20 LOOP1: MOV R1, #250D ;Set R2 value to 250

701E 7A04 21 LOOP2: MOV R2, #4D

7020 DAFE 22 LOOP3: DJNZ R2, LOOP3

7022 D9FA 23 DJNZ R1, LOOP2

7024 D8F6 24 DJNZ R0, LOOP1

7026 22 25 RET ;Return to the next instruction after the

26 ;delay call

27

28 END ;End programme


PROGRAM 3:
PROG2
PAGE 1

00B3 1 I1 BIT 0B3H ;Declare bit 3 of port 3 as I1

00B5 2 I2 BIT 0B5H ;Declare bit 5 of port 3 as I1

0090 3 P1 DATA 90H ;Declare port1 as P1

6 ;-----------Main Programme------------------------------

7000 8 ORG 7000H ;Start program at address 7000H

7000 7590FF 9 BEGIN: MOV P1,#11111111B ;Turn off all LEDs

7003 20B3FD 10 OFF: JB I1, OFF ;Wait until input to turn on LEDs

7006 75900F 11 MOV P1, #00001111B ;Turn on one LEDs

7009 D2B3 12 SETB I1 ;Reset I1

700B 20B5FD 13 ON: JB I2, ON ;Wait for input to turn off LEDs

700E 80F0 14 JMP BEGIN ;Goto begining

15

16 END ;End program

17

VERSION 1.2h ASSEMBLY COMPLETE, 0 ERRORS FOUND


PROGRAM 4:
PROG3
PAGE 1

0090 1 CD BIT 90H ;Declare Command/Data mode select bit 90H as CD

0091 2 ENB BIT 91H ;Declare strobe enable/disable bit 91H as ENB

7000 4 ORG 7000H ;Start program at address


7000H

6 ;----------Main Program---------------------------------

7000 124100 8 CALL 4100H ;Clear LCD

7003 7441 9 MOV A, #65 ;Set accumulator to the ASCII code of the

10 ;character to display (A = 65)

7005 C290 11 CLR CD ;Set data mode

7007 90FFF3 12 MOV DPTR, #0FFF3H ;Point DPTR to LCD address

700A F0 13 MOVX @DPTR, A ;Send data to the LCD

700B 127014 14 CALL DELAY ;Delay for LCD to read data

700E C291 15 CLR ENB ;Enable strobe by sending LOW

7010 D291 16 SETB ENB ;to HIGH pulse to bit 91H

7012 80FE 17 JMP $;Loop infinietly to keep the LCD from resetting

18

19 ;----------Delay Routine--------------------------------

20

7014 7800 21 DELAY: MOV R0, #0H

7016 D8FE 22 DJNZ R0, $ ;Loop same instruction until R0 = 0

7018 D8FE 23 DJNZ R0, $ ;Delay > 1ms

701A 22 24 RET ;Return to the next intruction after the call

25

26 END ;End program

27

VERSION 1.2h ASSEMBLY COMPLETE, 0 ERRORS FOUND


PROGRAM 5:
PROG4
PAGE 1

1 ORG 0000H ;Start at 0000H

0000 C280 2 MAIN: CLR P0.0 ;set bit 0 of port o low(turn on LED)

0002 12000E 3 CALL DELAY ;wait

0005 D280 4 SETB P0.0 ;set bit P0.0 high (turn off LED)

0007 D805 5 DJNZ R0, DELAY ;jump to delay

0009 12000E 6 CALL DELAY ;call delay

000C 80F2 7 JMP MAIN ;jump back to begining

000E 7864 10 DELAY: MOV R0, #100 ;set delay time

0010 D8FE 11 L1: DJNZ R0, $ ;loop at the same instruction

12 ;DJNZ R0, MAIN

0012 22 13 RET ; return to the next instruction

14

15 END

ASSEMBLY COMPLETE, NO ERRORS FOUND, NO WARNINGS

PROGRAM 6:
PROG5
PAGE 1

1 ORG 0000H ;Start at 0000H

0000 308108 2 MAIN: JNB P0.1,NEXT

0003 780C 3 MOV R0, #12

0005 790C 4 MOV R1, #12

0007 7A0C 5 MOV R2, #12

0009 7B0C 6 MOV R3, #12

000B 3082F2 7 NEXT: JNB P0.2, MAIN

000E 780A 8 DELAY: MOV R0, #10

0010 D8FE 9 DJNZ R0, $

10 END

ASSEMBLY COMPLETE, NO ERRORS FOUND, NO WARNINGS


PROGRAM 7 ,PROGRAM 8:
PROG9
PAGE 1

0090 1 CD BIT 90H ;Declare Command/Data mode select bit 90H as CD

0091 2 ENB BIT 91H ;Declare strobe enable/disable bit 91H as ENB

00F0 3 B DATA 0F0H ;Declare register 0F0H as B

0093 4 AD_CNTRL BIT 93H ;Declare port 1 bit 3(93H) as AD_CNTRL

00B3 5 I1 BIT 0B3H ;Declare bit 3 of port 3 as I1

7000 7 ORG 7000H ;Start program at address


7000H

9 ;-------Main Program-------------------------------

10

7000 124100 11 MAIN: CALL 4100H ;Clear LCD

7003 C290 12 CLR CD ;Set LCD data mode

13

14 ;-------A/D Conversion----------------------------------

15

7005 D293 16 ADC: SETB AD_CNTRL

7007 90FFF7 17 MOV DPTR, #0FFF7H

700A F0 18 MOVX @DPTR, A

700B 2093FD 19 JB AD_CNTRL, $

700E E0 20 MOVX A, @DPTR

21

22 ;-------Display Conversion in LCD--------------------------

23

700F 90FFF3 24 MOV DPTR, #0FFF3H ;Point DPTR to LCD address

7012 75F064 25 MOV B, #100 ;Set B register to value 100

7015 84 26 DIV AB ;Divide A by B and set A:quotient,B:remainder

7016 12702C 27 CALL DISP ;Display A

7019 E5F0 28 MOV A, B ;Set A to the value in B

701B 75F00A 29 MOV B, #10 ;Set B register to value 10

701E 84 30 DIV AB ;Divide A by B and set A:quotient,B:remainder

701F 12702C 31 CALL DISP ;Display A

7022 E5F0 32 MOV A, B ;Set A to the value in B

7024 12702C 33 CALL DISP

7027 12703A 34 CALL DELAY

702A 80D4 35 JMP MAIN


36

37 ;-------Set Display-----------------------------------------

38

702C 2430 39 DISP: ADD A, #48 ;Set ASCII value of the relevant number
(ASCII 0 =48)

702E F0 40 MOVX @DPTR, A ;Send data to the LCD

702F 7800 41 MOV R0, #0H

7031 D8FE 42 DJNZ R0, $ ;Loop same instruction until R0 = 0

7033 D8FE 43 DJNZ R0, $ ;Delay > 1ms

7035 C291 44 CLR ENB ;Enable strobe by sending LOW

7037 D291 45 SETB ENB ;to HIGH pulse to bit 91H

7039 22 46 RET

47

48 ;------------Delay routine------------------------------

49

703A 79FA 50 DELAY: MOV R1, #250D ;Set R1 value to 250

703C 7AFA 51 LOOP1: MOV R2, #250D ;Set R2 value to 250

703E 7B04 52 LOOP2: MOV R3, #4D

7040 DBFE 53 LOOP3: DJNZ R3, LOOP3

7042 DAFA 54 DJNZ R2, LOOP2

7044 D9F6 55 DJNZ R1, LOOP1

7046 22 56 RET ;Return to the next instruction after the

57 ;delay call

58

PROG9
PAGE 2

59 END ;End program

VERSION 1.2h ASSEMBLY COMPLETE, 0 ERRORS FOUND


OBSERVATIONS AND RESULTS

Vin (Measured) (V) Dout (Observed) Vin (Calculated) (V) Error (Vin(calc) – Vin Error %
(Measure))

0.000 000 0.000 0.000 -


0.306 015 0.293 -0.013 -4.44
0.693 036 0.703 0.010 1.42
0.872 045 0.879 0.007 0.8
1.051 054 1.055 0.004 0.38
1.262 065 1.270 0.008 0.63
1.425 074 1.445 0.020 1.38
1.613 084 1.641 0.028 1.71
1.805 094 1.836 0.031 1.69
2.068 108 2.109 0.041 1.94
2.200 115 2.246 0.046 2.05
2.364 124 2.422 0.058 2.39
2.490 130 2.539 0.049 1.93
2.634 138 2.695 0.061 2.26
2.713 141 2.754 0.041 1.49

Vin (Calculated) = Dout x StepSize

= Dout x Vref/256

= Dout x (5/256)

Calculation for Dout = 015

Vin = 15 x (5/256) = 0.293 V


DISCUSSION

1. Critical Self Analysis

1. This session was attended with the knowledge about AES51 board and 8051
microcontroller from previous lab sessions.

2. But referring the lab sheet and the course material was required as there was no previous
experience regarding entering the code with the keypad.

3. Initial understandings of CALL and JMP functions were incorrect. So had to ask for the help
of the instructor to describe them.

4. Variable resistor given in the last experiment had 3 pins. As there was no pin diagrams or
previous knowledge on how it’s pins are configured used the multimeter to find out the
required pins.

2. Challenges

1. Having to work alone. Although it was a challenge it provided more space to learn.

2. Inbuilt hex-keypad of AES51 board was not working properly. Key’s had to be pressed
gently or otherwise it tends to give wrong outputs.

3. USB to Serial converter used to connect the board to the computer was malfunctioning.
Had to swap several connectors to get it working.

4. Variable resistor used for the last experiment was broken. Had to replace it with a new one.

3. Success and Failures

1. All the experiments had ups and downs but altogether all were completed successfully.

2. 1st and 2nd programs were completed successfully without any problems.

3. 3rd program was also completed successfully but had to go through the course material to
find out the correct port address.

4. First few attempts to do the 4th program failed. LCD screen gave the “MONITOR READY”
screen every time the code was executed. Finally it was successfully completed by
including an infinite loop at the end of the program.

5. Next failure was observed when the program to display a character on LCD was executed.
Initially it didn’t displayed the character correctly. Increasing the delay fixed the problem.

6. The program to display a 3 digit number was also failed initially as it printed an extra ‘e’
character at the end. Problem was due to an extra call for the display subroutine.
Removing it fixed the problem and it was also completed successfully.

7. A/D conversion program was completed successfully.

8. So it can be said that all programs were completed successfully although several programs
were corrected few times.
4. Impacts

1. One of the main impacts this lab had was using a variable resistor instead of LVDT. This was
done because LVDT is a high cost equipment. Use of variable resistor instead of it simply
compensate the need of receiving varying analog signals to the ADC. And variable resistor
was used instead of LVDT as both of them has linear characteristics.

2. This lab also had several impacts on students learning experience and knowledge on
microcontroller programming. Impact this session had on students can be summarized into
few lines as follows.

a. Learned how to refer instructions correctly and grab the key idea in it.

b. Developed patience to work situations where bugs in code can be a real hard to
find.

c. Improved the ability to communicate with the instructors to learn new things and
to clear my doubts.

d. Improved knowledge on microcontroller programming and how instructions are


executed and stored in 8051 microcontroller.

5. Future Improvements

1. Using at least one experimental setup using an actual LVDT for students to experience it
and to check their programs with it.

2. Using more accurate variable resistors or potentiometers.

3. More sophisticated displacement sensors with new technologies like laser beam reflections
can be used in real world applications instead of LVDT.

4. Using sensors that are calibrated correctly and comes with a inbuilt ADC to minimize the
errors.

5. Instead of 8051 microcontroller newer microcontroller boards like “Arduino” can be used
as they provide easy interfacing and controlling techniques.

S-ar putea să vă placă și