int e l RESET OPTIONS (VERSION 1.1 ONLY) After the above are initialized by the user supplied RESET routine, the user may enter MCS BASIC- 52's command mode by executing the following: CLR A LJMP 30H Now, it is important to remember that the previous description applies only to a "warm" RESET with power remaining to the MCS BASIC-52 system. This means that the user must also provide some way of detecting the difference between a warm RESET and a power-on RESET. This usually involves some type of flip-flop getting set with a power-on-clear signal from the users power supply.
The details of implementing this RESET detection mechanism will not be discussed here as the possible hardware options vary depending upon the design. The user may also implement a "cold start" reset option with the previously described reset mode. The following code details what is necessary to implement a cold start option. EXAMPLE: ORG 2001H ; DB 0AAH ; TELL BASIC THAT RESET IS EXTERNAL ; ORG 2090H ; LOCATION BASIC WILL CALL FOR RESET ; ; AT THIS POINT BASIC HAS PLACED A 5AH IN ; SCON, A 10H IN TMOD, A 54H IN TCON AND ; A 34H IN T2CON ; ; FIRST CLEAR THE INTERNAL MEMORY MOV R0,#0FFH ; LOAD R0 WITH THE TOP OF INTERNAL MEMORY CLR A ; SET ACCUMULATOR = 0 RESET1:
MOV @R0.A ; LOOP UNTIL ALL THE INTERNAL RAM IS CLEARED DJNZ R0.RESET1 ; ; NOW SET UP THE STACK POINTER AND THE STACK ; POINTER HOLDING REGISTER MOV SP,#4DH ; 4DH IS THE INITIALIZED VALUE OF THE STACK MOV 3EH,#4DH ; THIS IS THE SP HOLDING REGISTER ; NOW CLEAR THE EXTERNAL RAM, IN THIS ; EXAMPLE ASSUME THAT 1FFFH BYTES OF RAM ; ARE AVAILABLE ; THE USER MUST CLEAR AT LEAST THE FIRST 512 ; BYTES OF RAM FOR A COLD START RESET ; MOV R3,#HIGH 1FFFH MOV R1,#LOW 1FFFH MOV DPTR,#0FFFFH ; - 148 -