Keil Tutorial v2
Keil Tutorial v2
1. 3FFFh
2. 0000h
3. 17, 16; 3; P3.6 and P3.7
4. 64
5. True
6. True
7. (c)
8. (a), (b), (d)
9. Port 0
10. Port 2
11. Port 0
12. ALE = 0 is for the address, while ALE = 1 is for the data.
13. 17, 6; PSEN is pin 29 and does not belong to any port.
14. (c)
15. 0000h, external ROM
16. The 8051 starts to access the on-chip ROM at address 0000 and goes on to the last
location of the on-chip ROM which is 3FFFh and then goes to the external ROM for
more code if it is not stopped.
17. True
18. PSEN is used for all external program fetches.
76
26. RAMDATA EQU 40h
ERAMDATA EQU 6000h
COUNT EQU 30
78
MOV A, 0C4h
SETB ACC.0
MOV 0C4h, A
MOV DPTR, #0000h
MOV R1, #RAMDATA
MOV R2, #COUNT
NEXT: MOV A, @R1
MOVX @DPTR, A
INC R1
INC DPTR
DJNZ R2, NEXT
RET
29.
MOV A, 0C4h
SETB ACC.0
MOV 0C4h, A
MOV DPTR, #0200h
MOV R1, #50
NEXT: MOV A,@DPTR
MOV P1, A
INC DPTR
ACALL DELAY
DJNZ R1, NEXT
SJMP $
DELAY:
...
void main(void)
{
unsigned char cnt;
unsigned char x;
unsigned char myarray[20];
for(cnt=0;cnt<20;cnt++)
{
x=XBYTE[0x2000+cnt];
myarray[cnt]=x;
}
}
void main(void)
{
unsigned char cnt;
unsigned char x;
unsigned char myarray[30]="012345678901234567890123456789";
for(cnt=0;cnt<30;cnt++)
{
x = myarray[cnt];
XBYTE[0x6000+cnt] = x;
}
}
void main(void)
{
unsigned char cnt;
unsigned char x;
for(cnt=0;cnt<50;cnt++)
{
x=XBYTE[0x3000+cnt];
XBYTE[0x8000+cnt]=x;
}
}
80
39. #include <reg51.h>
#include <absacc.h>
sfr PMRREG = 0xC4;
void main(void)
{
unsigned char cnt;
unsigned char x;
PMRREG = PMRREG | 0x01;
for(cnt=0;cnt<100;cnt++)
{
x=XBYTE[0x200+cnt];
P1=x;
MSDelay(1000);
}
}