Home

MVS-31 System Monitor User`s Manual

image

Contents

1. nennen nennen renes 5 MI Modify Internal data memory essere 6 MX Modify eXternal data 2 enne 6 ST Set Time and dates resres bee pet tie ei recte 6 space Single stepz eee eodeni enun e ene 6 N Next in line instruction single stepping 7 G Go from tenete k 7 J Jump to user program nee eee t eei eH e egens 7 E Ent t breakpoint 7 C Clear breakpoint uote a ae UI iet diee ene ite 7 W enter Watehpoint aa n a aS n enne nennen trennen rene enne 8 K Kill ete eden i eoe is 8 V View watchpoint data 8 SO Load a Motorola 519 format 8 S1 Load a Motorola 519 format 6 8 an Intel HEX format file ee eee een 9 Register Modify commands 9 User Accessible Input Output Functions 10 Input Output Functions and Interrupts
2. nn 10 Summary of Input Output Functions sees enne 10 Monitor Functions Description enne nennen n susan 11 What happens petto Ue eot RU S e PRESA 14 Downloading and Running programs 14 Breakpoints Things you should know 15 Breakpoints Single Stepping and Interrupts 16 Appendix A Downloadable File Formats 18 Appendix B Error 65528 5 19 Appendix C Input Output Functions Software Listings eese 20 Micro Valley Systems MVS 31 User s Manual Introduction The MVS 31 system monitor is intended for use with the DIY Electronics Southern Cross II an 8031 based single board computer This board may be used as a software development and debugging tool connected to a host computer 8051 assembly language programs would be edited and assembled on the host system and then transferred to the SBC 31 board for execution and debugging MVS 31 Monitor Debugger Features Display of internal and external data memory in hex
3. Press lt ESC gt to exit When downloading files the monitor calculates a running checksum as each record is received This checksum is compared to the checksum received at the end of the record If they are not the same this error message is printed Abort the file transmission before pressing the lt ESC gt key Check that the file is not corrupted and download again if all OK Error Breakpoint table full The maximum number of breakpoints have already been entered Delete one or more breakpoints so that new breakpoints can be entered Error Breakpoint already exists A breakpoint has already been set at that address Error Overlapping breakpoint The user attempted to enter a breakpoint within two address locations of an existing breakpoint Error No breakpoint there The user tried to clear delete a breakpoint that does not exist Error Watchpoint table full The maximum number of watchpoints have already been entered Delete one or more watchpoints so that new watchpoints can be entered Error Watchpoint already exists A watchpoint has already been set at that address Error No watchpoint there The user tried to clear delete a watchpoint that does not exist 19 Micro Valley Systems MVS 31 User s Manual Appendix C Input Output Functions Software Listings SPI EQU F000 SERIAL PERIPHERAL INTERFACE SCC2691 kok ok ok ok CR CO CR CR CR CO COE SPI SCC2691 REGISTER EQUATES MRI EQU SP
4. Pressing the RESET button bypasses steps 4 and 5 above This allows users to regain control by pressing RESET without losing any breakpoint information or changing any interrupt vectors already set by the user program Downloading and Running programs Programs must first be assembled and then downloaded to the SBC 31 computer The host port is used for downloading programs The monitor will accept files in Motorola 519 or Intel HEX format A description of these formats appears in Appendix A The SBC 31 has 16K of user program RAM starting at address 4000 User programs should be ORG d to start at this address including the interrupt vectors Except for reset and timer 2 all the interrupt vectors have been mapped into this area as follows Source Vectors Vectors External Interrupt 1 0013 4013 Timer 1 Interrupt 001B 401B Serial port interrupts 0023 4023 User Interrupt Vectors The monitor contains an LJMP instruction at the 8031 interrupt vector address that transfers control to the user s interrupt vector Therefore user interrupt routines are delayed two instruction cycles by the LJMP instruction At power up the user s interrupt vectors are initialized to jump to interrupt trap routines in the monitor The trap routine prints a message identifying the interrupt source and the monitor then waits for a command User program RAM is mapped in both code and data space Any instruction that accesses external data m
5. The contents of external data memory at address xxxx are displayed in hex and new hex data may be entered Refer to MI command for further details ST Set Time and date Syntax ST Set the time and date on the clock calendar chip MVS 31 prints the following prompt and positions the cursor under the first character to be entered MM DD YY DOW HH MM SS eg 08 28 95 1 15 17 00 This sets the clock to Mon August 8 1995 3 17pm The characters and are automatically printed by the monitor and NOT entered by the user The clock runs in 24 hour mode Therefore 1pm is entered as 13 No check is made for invalid values eg Month MM 17 Unpredictable results may occur if invalid values are entered Note Day of Week DOW Sun 0 Mon 1 Tue 2 Wed Z3 Thu 4 Fri 5 Sat 6 space Single step Syntax space Execute the next instruction stop and display registers and any watchpoint data Control is transferred to the monitor The program counter value shown is the address ot the NEXT instruction to be executed The opcode and mnemonic shown is that of the NEXT instruction to be executed Note Calls by the user s program to the monitor s I O routines are treated as a single instruction Micro Valley Systems MVS 31 User s Manual N Next in line instruction single stepping Syntax N Operation of this command is similar to space type single stepping with the exception that LCALL and
6. instructions cause the subroutine to be treated as a single instruction ie executed without single stepping Program execution stops at the next in line instruction following the subroutine call G Go from breakpoint Syntax G Commence executing code from the current program counter address Used mainly to continue program execution after a breakpoint The code runs in real time until another breakpoint is encountered J Jump to user program Syntax J xxxx Jump to address xxxx and begin executing A breakpoint at that address will cause the registers to be displayed and control returned to the monitor The code runs in real time until a breakpoint is encountered E Enter breakpoint Syntax E xxxx Enter a breakpoint at address xxxx A maximum of 8 breakpoints are allowed A number of checks are done when the breakpoint is first entered These are Have the maximum number of breakpoints already been set Does a breakpoint already exist at that address Does a breakpoint already exist within 2 addresses either side of that address The first two tests are self explanatory The third test is to prevent one breakpoint from overlapping another Refer to the section on Breakpoints Things you should know for further explanation C Clear breakpoint Syntax C xxxx Clear delete the breakpoint at address xxxx Entering X or x instead of an address deletes ALL breakpoints currently set
7. DPTR READ DATA BIT RRC A MOVE DATA BIT INTO CARRY POP RETRIEVE ACCUMULATOR RRC MOVE DATA BIT INTO IT DJNZ B RDCLOCK1 LOOP UNTIL ALL BITS READ POP B POP DPL POP DPH RET 28
8. PCRLF MOV A CR SEND CARRIAGE RETURN LCALL OUTCH MOV A LF FOLLOWED BY LINE FEED OUTPUT CHARACTER IN A TO HOST PORT NO REGISTERS AFFECTED OUTCH PUSH DPH SAVE DPTR PUSH DPL PUSH ACC SAVE CHARACTER MOV DPTR SR POINT TO UART STATUS REGISTER OUTCHI MOVX A DPTR GET UART STATUS JNB A 2 0UTCHI WAIT FOR TRANSMITTER READY MOV DPTR THR POINT TO TRANSMIT REGISTER POP ACC RETRIEVE CHARACTER MOVX DPTR A SSEND CHARACTER POP DPL RESTORE DPTR POP DPH RET OUTPUT 4 HEX DIGITS IN DPTR FOLLOWED BY A SPACE EXIT CONDITIONS AS OUT4H OUT4HS LCALL OUT4H OUTPUT THE 4 DIGITS SJMP OUTS OUTPUT 2 HEX DIGITS IN A FOLLOWED BY A SPACE EXIT CONDITIONS AS OUT2H OUT2HS LCALL OUT2H OUTPUT BYTE OUTPUT SPACE ON EXIT DESTROYED OUTS MOV A 20 SJMP OUTCH 21 Micro Valley Systems OUTPUT 4 HEX DIGITS IN DPTR ON EXIT A DESTROYED DPTR PRESERVED OUT4H MOV A DPH LCALL OUT2H MOV A DPL OUTPUT 2 HEX DIGITS IN A EXIT A DESTROYED OUT2H PUSH ACC SWAP A LCALL OUTHEX POP ACC OUTPUT RIGHT NIBBLE IN A ON EXIT A DESTROYED OUTHEX ANL 0 ADD A 30 CINE A 3A OUTHEX1 OUTHEXI JC OUTHEX2 ADD A 07 OUTHEX2 SJMP OUTCH K K K K KK K K K K K K K K K K K K K K K CHECK IF
9. accumulator to the terminal 11 Micro Valley Systems MVS 31 User s Manual OUTHEX OUT2H OUT2HS OUT4H OUT4HS OUTS PDATA PSTRNG PCRLF 1FF6 1FDE Output hex digit The digit is contained in the right nibble of the A accumulator The A accumulator is destroyed IFEI Output 2 hex digits Output the 2 hex digits byte in the A accumulator The A accumulator is destroyed 1FE4 Output 2 hex digits followed by space As per OUT2H but with a trailing space The A accumulator is destroyed IFE7 Output 4 hex digits Output the 4 hex digits 2 bytes in the DPTR register The A accumulator is destroyed 1FEA Output 4 hex digits followed by space As per OUT4H but with a trailing space The A accumulator is destroyed IFED Output space Output a space The A accumulator is destroyed 1FFO Output ascii string Output the ascii string pointed to by the DPTR register The string must be terminated by a NULL character 00 On exit the DPTR register is left pointing to the NULL character The A accumulator is destroyed 1FF3 Output string preceeded by CR LF As per PDATA except that carriage return line feed preceeds the ascii string The accumulator is destroyed Output Carriage Return Line Feed Output carriage return and line feed characters to the terminal The A accumulator is destroyed 12 Micro Valley Systems MVS 31 User s Manual RDTIME WRTIME 1FF9 Read the time and date f
10. an existing breakpoint This prevents one breakpoint from overwriting or overlapping another when they are inserted back into the user s program prior to running it The user s program is started with the J command The program will run in real time until a breakpoint is encountered at which point control is transferred to the monitor The monitor restores the user s original code displays the program registers and any watchpoint data and waits for a command The program counter address shown is that of the NEXT instruction to be executed Press G to continue executing Wait on What about the breakpoints When the breakpoint was encountered the monitor restored the user s original code bytes ie all the breakpoints were removed from the user s program Before continuing to execute the user program the monitor must put all the breakpoints back However it cannot do this until AFTER it has executed the next instruction If breakpoints were restored immediately the next instruction would never be executed as it would be a breakpoint To overcome this problem the monitor automatically executes a single step first The monitor regains control after the single step restores all breakpoints and then transfers control back to the user s program The user s code always runs in real time between breakpoints except for that first instruction Unfortunately there is an exception to this rule Remember that a breakpoint replaces three bytes of
11. register above it A disassembled output of the opcode at the PC address is also displayed The register bank displayed RO 7 is determined by bits rr in the Program Status Word DS Display Special function registers Syntax DS Display the current contents of the 8031 Special Function Registers SFRs Two lines are printed as follows PO P2 IE IP SBUF SCON TCON TMOD THO TLO TH1 TL1 XX XX XX XX XX XX XX XX XX XX XX DT Display Time and date Syntax DT Displays the current date and time The time is displayed in 24 hour mode eg Mon 28 Aug 95 15 12 30 DW Display Watchpoints Syntax DW Display the address of all currently set watchpoints Micro Valley Systems MVS 31 User s Manual MI Modify Internal data memory Syntax MI lt xx gt The contents of internal data memory at address lt xx gt are displayed in hex and new hex data may be entered Address can be in the range 00 7F The following commands are valid space next location backspace previous location lt redisplay current location lt gt xe exit Entering any other non hex character will be followed by a and the command aborted A read after write test is NOT performed when entering data The command is useful for continually reading the contents of an I O port or hardware register MX Modify eXternal data memory Syntax MX xxxx
12. user code This means that if a breakpoint is set at a one or two byte instruction the following instruction s will also be affected After executing the initial single step the monitor checks whether the next instruction to be executed is within two address locations of a breakpoint If so the monitor cannot replace breakpoints and continue as this would corrupt the next instruction Therefore the monitor executes another single step The process is repeated until the return address is at least three bytes away from the breakpoint address This does not normally present a problem as the user s program will be running in real time again within one or two instructions of a breakpoint However this will depend on the next instruction to be executed An example will help to explain 15 Micro Valley Systems MVS 31 User s Manual Consider the following program segment MOV R6 10 SET TIME DELAY REQUIRED LOOP CJNE R6 0 LOOP WAIT UNTIL INTERRUPT COUNTER 0 Example 1 Register R6 is decremented within a timer interrupt routine The software waits for R6 to reach zero before continuing A simple time delay using continuous timer interrupts Assume that a breakpoint is set at the MOV instruction a two byte instruction The program runs to the breakpoint restores the user s code and stops The user presses G to continue The monitor executes a single step The next instruction CJNE is within two bytes of the breakpoint at the MO
13. 4 A3 5C LSB TO MSB ON EXIT A DESTROYED RTC OPEN PUSH DPH PUSH DPL PUSH B MOV DPTR RTCADDR POINT TO CLOCK CALENDAR CHIP MOV 72 SET UP FOR 72 READS RTC OPI MOVX A DPTR READ DATA BIT 26 Micro Valley Systems DJNZ MOV RTC OP2 MOV B RTC OPI A C5 LCALL WRCLOCK MOV A 3A LCALL WRCLOCK MOV A A3 LCALL WRCLOCK MOV A 5C LCALL WRCLOCK DJNZ POP POP POP RET B RTC OP2 B DPL DPH MVS 31 User s Manual UNTIL DONE SET UP TO SEND 2 BLOCKS OF C5 3A A3 5C SEND C5 SEND SSEND SEND 5C LOOP UNTIL BOTH BLOCKS SENT WRITE A BYTE TO THE CLOCK CALENDAR CHIP ONENTRY TO WRITE ON EXIT ALL REGISTERS PRESERVED WRCLOCK PUSH PUSH MOV DPTR RTCADDR MOVX RR MOVX RR MOVX RR MOVX RR MOVX RR MOVX RR MOVX RR MOVX RR POP POP RET DPH DPL DPTR A A DPTR A A DPTR A A DPTR A A DPTR A A DPTR A A DPTR A A DPTR A A DPL DPH POINT TO CLOCK CALENDAR CHIP WRITE BIT 0 WRITE BIT 1 WRITE BIT 2 WRITE BIT 3 WRITE BIT 4 WRITE BIT 5 WRITE BIT 6 WRITE BIT 7 27 Micro Valley Systems MVS 31 User s Manual READ A BYTE FROM THE CLOCK CALENDAR CHIP EXIT BYTE RETURNED IN A RDCLOCK PUSH DPH PUSH DPL PUSH B MOV DPTR RTCADDR POINT TO CLOCK CALENDAR CHIP MOV B 8 READ 8 BITS RDCLOCK1 PUSH ACC sSAVE ACCUMULATOR MOVX A
14. ANY INPUT FROM HOST PORT EXIT C 0 IF NONE 1 IF SO ANYIN PUSH DPH PUSH DPL PUSH ACC MOV DPTR SR MOVX A DPTR CLR C JNB A 0 ANYINI SETB C ANYINI POP ACC POP DPL POP DPH RET GET FIRST BYTE PRINT IT GET SECOND BYTE SAVE BYTE MVS 31 User s Manual READY TO OUTPUT FIRST DIGIT RETRIEVE BYTE STRIP OFF LEFT NIBBLE CONVERT TO ASCII WAS DIGIT 0 9 JUMP IF SO ELSE MUST BE LETTER A F OUTPUT DIGIT SAVE DPTR SSAVE POINT TO UART STATUS REGISTER GET UART STATUS ASSUME NO INPUT JUMP IF NO INPUT ELSE SET CARRY FLAG INPUT 22 Micro Valley Systems MVS 31 User s Manual INPUT 8 BIT CHARACTER FROM HOST PORT INTO A PUSH DPH SAVE DPTR PUSH DPL MOV DPTR SR POINT TO UART STATUS REGISTER INCHI MOVX A DPTR GET UART STATUS JNB A 0 INCH1 WAIT FOR INPUT MOV DPTR RHR POINT TO RECEIVE REGISTER MOVX A DPTR CHARACTER DPL POP DPH RET INPUT 7 BIT CHARACTER WITH ECHO INTO A KK K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K INCHE LCALL INCH ANL 7 LJMP OUTCH HEX ADDRESS 4 DIGITS INTO DPTR EXIT CONDITIONS AS PER INHEX INAHEX LCALL IN2HEX JC INAHEXX MOV DPH A LCALL IN2HEX JC INAHEXX MOV DPL A CLR C INAHEXX RET GET HEX BYTE 2 DIGITS INTO A EXIT CONDITIONS AS PER INHE
15. DIY Electronics Southern Cross II 8031 Single Board Computer MVS 31 System Monitor User s Manual Written by MicroValley Systems 24 Ballandry Crescent Greensborough 3088 Melbourne Australia 613 9434 3806 Micro Valley Systems MVS 31 User s Manual Contents Hips 2 MVS 31 Monitor Debugger Features 2 Getting Started u sabanas eee 2 Monitor commands and conventions 2 Command Set coepto diee rto o a ie e RR 3 Monitor Commands Description 4 DA DisAssemble program rre Deere QE 4 DB Display Breakpoints eene neret enne 4 DI Display Internal data memory 4 DX Display eXternal data memory 5 DR Display eerte e 5 DS Display Special function registers 5 DT Display Time and date un noie erii e nets 5 DW Display
16. ER CJNE A 30 INDEC1 5 IT lt 0 NOTDEC JUMP IF SO ERROR CJNE A 3A INDEC2 5 IT gt 9 INDEC2JNC NOTDEC JUMP IF SO CLR SUBB 30 CONVERT ASCII TO DECIMAL RET GET BCD BYTE 2 DECIMAL DIGITS INTO A K K K K K K EXIT CONDITIONS AS PER INDEC BCD PUSH B SAVE B REGISTER LCALL INDEC GET FIRST DECIMAL DIGIT JC BCDX EXIT IF ERROR SWAP A MOVE TO HIGH NIBBLE MOV BA SAVE INTO B LCALL INDEC GET SECOND DECIMAL DIGIT 24 Micro Valley Systems JC ADD CLR BCDX POP RET MVS 31 User s Manual BCDX COMBINE WITH FIRST DIGIT C B RESTORE B REGISTER WRITE TIME TO CLOCK CALENDAR CHIP ONENTRY ADDRESS 8 BYTE BLOCK CONTAINING NEW TIME DATA DATA BLOCK MUST BE IN INTERNAL RAM AREA DATA FORMAT YY MM DD DOW HRS MINS SECS SECS 100 ON EXIT A DESTROYED 2 NO OTHER REGISTERS AFFECTED WRTIME MOV A RO ADD AE MOV WRTIMEI LCALL RTC OPEN MOV A RO LCALL WRCLOCK DEC MOV A RO RO LCALL WRCLOCK DEC MOV A RO RO LCALL WRCLOCK DEC MOV A RO ANL RO LCALL WRCLOCK DEC MOV A RO ORL ANL RO LCALL WRCLOCK DEC MOV A RO RO LCALL WRCLOCK DEC MOV A RO RO LCALL WRCLOCK DEC MOV A RO RO LCALL WRCLOCK CLR RET C 25 ACCESS CLOCK CHIP GET SECS 100 WRITE IT GET SECONDS GET MINUTES GET HOU
17. I 0 MODE REGISTER 1 MR2 EQU 8 0 MODE REGISTER 2 SR EQU SPI STATUS REGISTER READ CSR EQU SPI CLOCK SELECT REGISTER WRITE CMR EQU 8 2 COMMAND REGISTER WRITE RHR EQU SPI 3 RECEIVE HOLDING REGISTER READ THR EQU SPI 3 TRANSMIT HOLDING REGISTER WRITE ACR EQU 8 4 AUXILIARY CONTROL REGISTER WRITE ISR EQU SPI 5 INTERRUPT STATUS REGISTER READ IMR EQU SPI 5 NTERRUPT MASK REGISTER WRITE CTU EQU SPI 6 COUNTER TIMER UPPER READ CTUR EQU 8 6 COUNTER TIMER UPPER REGISTER WRITE CTL EQU 8 7 COUNTER TIMER LOWER READ CTLR EQU SPI 7 COUNTER TIMER LOWER REGISTER WRITE PRINT ASCII STRING TO HOST PORT PRECEEDED B Y CR LF DPTR POINTS TO START OF STRING STRING MUST BE TERMINATED BY 0 EXIT CONDITIONS AS PER PDATA PSTRING LCALL PCRLF OUTPUT CR LF FIRST OUTPUT ASCII STRING TO HOST PORT DPTR POINTS TO START OF STRING STRING MUST BE TERMINATED BY 0 ON EXIT A DESTROYED DPTR POINTS TO STRING TERMINATOR 0 PDATA CLR A OFFSET 0 MOVC A A DPTR CHARACTER JZ PDATAX EXIT IF TERMINATOR 0 LCALL OUTCH ELSE PRINT CHARACTER INC DPTR POINT TO NEXT CHARACTER SJMP PDATA CONTINUE WITH REST OF STRING PDATAX RET END OF STRING FINISHED 20 Micro Valley Systems MVS 31 User s Manual gt gt se K K F K K K K K K K OUTPUT CR LF TO HOST PORT EXIT A DESTROYED
18. Micro Valley Systems MVS 31 User s Manual W enter Watchpoint Syntax W lt xx gt Enter a watchpoint at address lt xx gt Watchpoints can only be set in internal data memory address range 00 7F A maximum of 8 watchpoints are allowed A number of checks are done when entering the watchpoint such as Have the maximum number of watchpoints already been set Does a watchpoint already exist at that address K Kill watchpoint Syntax K lt xx gt Kill delete the watchpoint at address xx Address can be in the range 00 7F Entering X or x instead of an address deletes ALL watchpoints currently set V View watchpoint data Syntax V View display the contents at the watchpoint addresses The watchpoint address is printed followed by a colon followed by the data at that address S0 Load a Motorola S19 format file S1 Load a Motorola S19 format file Syntax S1 Loads a Motorola 19 formatted file into memory Data transfer is via the host serial port This command is normally terminated on receipt of an S9 record Clears any breakpoints already set There is no need to enter the S1 command as this is part of the Motorola file format Just send the file and the monitor will automatically detect it Each start of block character S is echoed back to the screen Load errors cause the command to abort immediately Load errors are caused by either a non hex character received or by a checksum error
19. One of the following error messages is displayed whenever a load error occurs Error Bad hex character received Press lt ESC gt to exit Error Bad checksum Press lt ESC gt to exit No read after write testing occurs as the file is loaded It is up to the user to ensure that the file is loaded into the correct memory locations Micro Valley Systems MVS 31 User s Manual Load an Intel HEX format file Syntax Load an Intel HEX formatted file into memory Data transfer is via the host serial port This command is normally terminated on receipt of an EOF record Clears any breakpoints already set There is no need to enter the command as this is part of the Intel file format Just send the file and the monitor will automatically detect it Each start of block character is echoed back to the Screen Refer to S1 command for further details Register Modify commands These commands allow the user to modify any of the internal Special Function Registers SFRs simply by entering its name The monitor will respond with the address of the register and its current contents Enter any new hex data as required or press Enter to exit Example gt P0 80 xx xx current contents in hex Entering DPTR will display both DPL DPH together and allow both to be modified by entering a single 16 bit value DPH value first Note that the RO R7 registers accessed will depend on t
20. Output ascii string preceeded by CR LF PCRLF 1FF6 Output Carriage Return Line Feed RDTIME 1FF9 Read the time and date from the clock calendar WRTIME 1FFC Write new time and date to clock calendar Monitor Functions Description 10 Micro Valley Systems MVS 31 User s Manual NXTCMD ANYIN INCH INCHE INHEX IN2HEX INAHEX INDEC BCD OUTCH 1FCO Transfer control to the MVS 31 monitor Program control is transferred to the monitor IFC3 Check for character input 1 if a character received C 0 if no character received 1FC6 Input character without echo The 8 bit character is returned in the A accumulator 1FC9 Input character with echo The character is returned in the A accumulator with the most significant bit bit 7 clear The character is also echoed to the terminal 1FCC Input a hex digit The hex digit is returned in the right nibble of the A accumulator IFCF Input 2 hex digits The hex digits are returned in the A accumulator 1FD2 Input 4 hex digits The 4 hex digits are returned in the DPTR register Any non hex character will be returned in the A accumulator If valid hex data is entered then the A accumulator is preserved 1 05 Input a decimal digit The decimal digit is returned in the right nibble of the A accumulator 1FD8 Input 2 decimal BCD digits The decimal digits are returned in the A accumulator 1FDB Output character Output the character in the A
21. RS A 01111111 SET FOR 24 HOUR MODE GET DAY OF WEEK A 00010000 sSIGNORE RESET PIN A 11011111 TURN ON OSCILLATOR GET DATE GET MONTH GET YEAR MOVE POINTER TO END OF DATA AREA Micro Valley Systems MVS 31 User s Manual K K K K K K K K K K K K K K K K READ TIME FROM CLOCK CALENDAR CHIP K ON ENTRY RO ADDRESS OF 8 BYTE BLOCK WHERE CLOCK DATA WILL BE 2 RETURNED DATA BLOCK MUST BE IN INTERNAL RAM AREA DATA FORMAT YY DD DOW HRS MINS SECS SECS 100 ON EXIT A DESTROYED NO OTHER REGISTERS AFFECTED RDTIME MOV A RO MOVE POINTER TO END OF DATA AREA ADD 7 MOV LCALL RTC OPEN ACCESS CLOCK CHIP LCALL RDCLOCK GET SECS 100 MOV RO A SAVE IT DEC R0 LCALL RDCLOCK GET SECS MOV RO A SAVE IT DEC R0 LCALL RDCLOCK GET MINS MOV RO A SAVE IT DEC R0 LCALL RDCLOCK GET HRS ANL A 01111111 ALWAYS 24 HOUR MODE MOV SAVE IT DEC R0 LCALL RDCLOCK GET DOW ANL 07 MASK OFF ALL BUT DOW BITS MOV RO A SAVE IT DEC R0 LCALL RDCLOCK GET DATE MOV RO A SAVE IT DEC R0 LCALL RDCLOCK GET MONTH MOV RO A SAVE IT DEC R0 LCALL RDCLOCK GET YEAR MOV RO A SAVEIT RET OPEN ACCESS TO THE CLOCK CALENDAR CHIP FIRST EXECUTE 72 READS ENSURE THAT THE RTC IS CLOSED THEN WRITE THE 64 BIT RECOGNITION PATTERN THE HEX RECOGNITION PATTERN IS C5 3A4 A3 5C C5 3
22. V instruction so the monitor executes another single step However the program will not step past LOOP until register R6 reaches zero Therefore the monitor will continuously single step the CJNE instruction The program is not running in real time The user s program will only run in real time once it has passed the CJNE instruction Setting breakpoints at one and two byte instructions can also have other consequences Once again an example will help AAAA JC BBBB IF CARRY CLEAR CLR A CLR C BBBB MOV 0 855 Example 2 The two instructions before label BBBB are both single byte instructions Setting a breakpoint at either of these instructions will also affect the MOV instruction During execution it is possible that the program will bypass the breakpoint and jump directly to label BBBB as at AAAA However the MOV instruction has been altered by the breakpoint and the program could crash Most programmers collect subroutines and position them at the end of their code I certainly do Setting a breakpoint within two bytes of the end of a subroutine would also affect the start of the following subroutine That subroutine will not run correctly when called and could crash as well As a general rule do not set breakpoints within two bytes prior to the destination of a jump instruction or the start of a subroutine Breakpoints Single Stepping and Interrupts The single stepping function in the monitor uses T
23. X IN2HEX PUSH B LCALL INHEX JC IN2HEXX SWAP A MOV BA LCALL INHEX JC IN2HEXX ADD CLR C IN2HEXX POP B RET GET 8 BIT CHARACTER STRIP OF HIGH BIT AND OUTPUT IT GET FIRST BYTE 2 DIGITS EXIT IF ERROR SAVE IT GET SECOND BYTE SAVE IT 5 B REGISTER GET FIRST HEX DIGIT EXIT IF NOT HEX PUT DIGIT INTO HIGH NIBBLE SAVE IT GET SECOND DIGIT EXIT IF NOT HEX ADD IN FIRST DIGIT RESTORE B REGISTER 23 Micro Valley Systems MVS 31 User s Manual GET HEX CHARACTER 1 DIGIT INTO A EXIT C 1 IF CHARACTER IS NOT HEX DIGIT 0 9 A F C 0 OTHERWISE INHEX LCALL INCHE GET ASCII CHARACTER CJNE A 30 INHEX1 IS IT lt 0 INHEXI JC NOTHEX JUMP IF SO ERROR CJNE A 3A INHEX2 5 IT gt 9 INHEX2 JNC INHEX3 JUMP IF SO CLR C SUBB 30 CONVERT ASCII TO HEX RET INHEX3 A DF CONVERT TO UPPER CASE CJNE A 41 INHEX4 15 CHARACTER lt INHEX4 JC NOTHEX JUMP IF SO ERROR CJNE A 47 INHEXS5 15 IT gt INHEX5 JNC NOTHEX JUMP IF SO ERROR CLR C SUBB 37 CONVERT ASCII TO HEX RET HERE IF INVALID HEX OR DECIMAL DIGIT NOTHEX NOTDEC EQU SETB RET C SET CARRY ERROR DECIMAL CHARACTER 1 DIGIT INTO A LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLI ON EXIT 1 IF CHARACTER IS NOT DECIMAL DIGIT 0 9 0 OTHERWISE LCALL GET ASCII CHARACT
24. and ascii Modify internal and external data memory Display all internal 8031 registers including the Special Function Registers SFRs Modify all 8031 registers and SFRs individually Disassemble code memory Download files from a host PC in both Motorola 519 and Intel HEX formats Runs code in REAL TIME Program execution and debugging with jump to program continue from breakpoint single stepping next in line single stepping Set watchpoints to display flags and variables e User accessible functions for various I O routines such as input and output character etc Getting Started Refer to the Getting Started Running in 8031 Mode section in the Southern Cross II Manual for details on configuring the hardware Turn on the power when ready The monitor uses automatic baud rate detection to configure the host port Press Carriage Return Enter The following sign on banner should be displayed KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK DIY Electronics Southern Cross II gt CK lt Ck k k k x lt k k k x k k k k lt lt k k k x k k k k CK k k k lt lt k k k k Sk lt k k k k Sk k k k X lt X X MVS 31 System Monitor Version x x dd mon yy Copyright c 1995 MicroValley Systems Australia Ck lt lt k k lt k k lt K k k lt k Ck lt k k lt k k k k k k lt k k k k k k k k k k k k kx k k k lt ko Type at the prompt to display a list of available commands Invali
25. and data fields Intel HEX format The Intel HEX format is similar to the Motorola S19 format in that the file is also broken up into records and fields All hexadecimal values are represented as ASCII characters The following table defines each field within a record Record Mark An ASCII colon indicates the start of a record Byte Count Two ASCII characters representing the number of data bytes in this record An EOF record has two ASCII zeros in this field Load Address Four ASCII characters representing the address at which to start loading this record high byte first This field contains four ASCII zeros in an EOF record Record Type Two ASCII characters identifying the type of record 00 Data Records 01 EOF Record bytes in an EOF record byte count load address record type and data fields 18 Micro Valley Systems MVS 31 User s Manual Appendix B Error Messages Error No breakpoint at this address The breakpoint routine in the monitor has been called but a breakpoint does not exist at that address The user s program is probably corrupt and should be downloaded again Error Bad hex character received Press lt ESC gt to exit An invalid hex character was received while downloading a file Valid hex characters are 0 9 A F upper or lower case Abort the file transmission before pressing the lt ESC gt key Check that the file is not corrupted and download again if all OK Error Bad checksum
26. d commands will be ignored and displayed Monitor commands and conventions MVS 31 is ready to accept keyboard commands whenever the gt prompt is displayed These commands consist of one or two characters followed by any hexadecimal parameters as required Commands and parameters may be entered in upper or lower case Throughout this manual the following conventions are used e The command typed by the user appears first e Parameters to be entered by the user are shown inside lt gt symbols eg xxxx Entering a non hex character during entry of hex parameters will cause the command to abort and a displayed e Ascii characters are defined to be in the range 20 7D All hexadecimal parameters are preceeded by symbol Micro Valley Systems MVS 31 User s Manual Command Set Summary Display help screens DA DisAssemble code DB Display Breakpoints DI Display Internal memory in hex and ascii DX Display eXternal memory in hex and ascii DR Display Registers DS Display Special function fegisters SFRs DT Display Time and date DW Display Watchpoints MI Modify Internal memory MX Modify eXternal memory ST Set Time and date space Single step N Next in line instruction single step G Go from current Program Counter value J Jump to user program E Enter breakpoint C Clear breakpoint W enter Watchpoint K Kill watchpoint V View watchpoint data SO S1 Load Motorola 519 format file Load Intel HEX format f
27. emory is also able to access the user program RAM NOTE The monitor uses four bytes of user program RAM beginning at address 7FFC Three bytes are used to assemble a program patch for accessing internal data RAM The fourth byte is used to access an optional clock calendar chip User code must NOT reside in this area as it will be overwritten 14 Micro Valley Systems MVS 31 User s Manual Breakpoints Things you should know A short description of how breakpoints are implemented by the monitor is necessary in order that the user is aware of certain anomalies that can occur Breakpoints are not affected by pressing RESET but are automatically cleared after downloading a file Entering a breakpoint consists of replacing three bytes of the user s code beginning at address xxxx with an LCALL instruction into the monitor The bytes not replaced when the breakpoint is entered but rather when control is transferred to the user program via a J G or N command The user s code is intact in memory whenever the monitor program is in control Do not change any data at an address where a breakpoint is set or the next two locations The new data will be replaced with the original data when control is transferred back to the user s program A check is done when breakpoints are entered to test for overlapping breakpoints The monitor will not allow a breakpoint to be entered if it is within two address locations either side of
28. he current register bank selected in the PSW register Micro Valley Systems MVS 31 User s Manual User Accessible Input Output Functions The MVS 31 monitor provides a large number of I O functions which can be called from user programs These functions are accessed by executing an LCALL lt xxxx gt instruction from the user s program where lt xxxx gt is the address of the routine required The I O function equates are supplied on disk in a file called MVS31 EQU Include this file at the start of your program to access these functions A number of 8031 registers are used to pass arguments between the I O functions and the user program Generally 8 bit arguments are passed via the A accumulator and 16 bit arguments via the the DPTR register Unless otherwise specified all other registers are preserved Refer to the specific function for further details Some I O routines require a number of bytes of user stack space Refer to the software listings in Appendix C for further details All the input hex and input decimal calls exit with C 0 if valid data is entered If a non hex or decimal character is entered then the routine exits with C 1 and the character is returned in the A accumulator All the input output functions use the host serial port NOTE Use a LJMP NXTCMD instruction to terminate the user s program This method allows control to be passed back to the monitor when the program has finished Input Output Func
29. ile A Accumulator B B register DPH Data Pointer High byte DPL Data Pointer Low byte DPTR Data Pointer 16 bits IE Interrupt Enable register IP Interrupt Priority register PO Port 0 Port 1 P2 Port 2 P3 Port 3 PCON Power Control register PSW Program Status Word RO Register 0 Register 1 R2 Register 2 R3 Register 3 R4 Register 4 R5 Register 5 R6 Register 6 R7 Register 7 SBUF Serial Port Buffer register SCON Serial Port Control register SP Stack Pointer TCON Timer Counter Control register TMOD Timer Counter Mode control register THO Timer Counter 0 High byte TLO Timer Counter 0 Low byte TH1 Timer Counter 1 High byte TL1 Timer Counter 1 Low byte Micro Valley Systems MVS 31 User s Manual Monitor Commands Description DA DisAssemble program Syntax DA lt xxxx gt Disassemble the binary code in program memory beginning at address lt xxxx gt The display format is as follows 1000 020F2E LJMP OF2E 1003 EA MOV A R2 etc Note that all numeric values are displayed in hexadecimal Instructions that contain a relative offset such as JC CINE DJNZ AJMP etc have the actual destination address printed instead of the offset Therefore the instruction 1004 B47005 70 100 1007 xxxxxx has the offset value 05 added to the address of the next instruction 1007 to form the destination address 100C One line of code is disassembled and printed and then output pauses Press l
30. imer 2 of the 8032 52 processor The timer is set to generate an interrupt during execution of the next instruction The instruction will be completed and the interrupt will then transfer control back to the monitor Some instructions such as RETI and those accessing the IE and IP registers block this interrupt until at least one more instruction has been executed This could result in several instructions being executed before the monitor regains control The monitor disables all interrupts clears the EA bit whilst it is running Therefore any interrupts occurring while the monitor is waiting for a command will be ignored The monitor enables all interrupts sets the EA bit before tranferring control back to the user s program via the J G N or lt space gt commands If the user s program needs to stop interrupts it should do so on an individual basis and not by using the global EA bit 16 Micro Valley Systems MVS 31 User s Manual In order for single stepping to function correctly the monitor initializes the interrupt priority of timer 2 to be higher than all the other interrupts the PT2 bit in the IP register is set and all others are cleared Timer 2 interrupts are enabled by setting the ET2 bit in the IE register The PT2 and ET2 bits are always set by the monitor when single stepping Setting another interrupt source to the same priority level as timer 2 could affect the proper operation of the single step func
31. rom the clock calendar Returns 8 bytes of clock data into a memory buffer pointed to by the RO register Internal memory must be used for this function The data is in Binary Coded Decimal BCD format and is organised as follows Month Date Year Day of Week Hours Minutes Seconds 1 100ths of seconds The Hours byte is returned in 24 hour format 1pm 13 hours The RO register is unaffected Register A is destroyed IFFC Write new time and date to clock calendar On entry register RO points to an 8 byte memory buffer containing the new time and date information to be written into the clock calendar chip Internal memory must be used for this function The data should be in BCD format and organised as the RDTIME function The hours byte should be in 24 hour format No check is made for valid data The RO register is unaffected Register A is destroyed 13 Micro Valley Systems MVS 31 User s Manual What happens at RESET The monitor can detect the difference between a power on reset POR and pressing the RESET button The POR sequence is as follows Set the monitor stack pointer The monitor uses its own separate stack area Initialize the hosr serial port automatic baud rate detection Print the signon banner Clear all breakpoint entries Initialize the user s interrupt vectors at 4000 Initialize user s registers Print gt prompt and wait for command STOR Do
32. routine will itself be interrupted before it can finish causing the stack to overflow eventually Of course the program will stop at the breakpoint again Interrupts will be processed when the user s program is running between breakpoints This is also true even if pressing G causes the program to continuously single step as in example 1 Even though the program is not running in real time interrupts will still be processed in between single steps 17 Micro Valley Systems MVS 31 User s Manual Appendix A Downloadable File Formats Motorola S19 format The Motorola 19 format breaks up a file into separate blocks or records Each record is further divided into fields containing information about that record All fields contain ASCII characters to represent hexadecimal values For example the single hex byte 5A is represented as two characters ascii 5 and ascii A The following table defines each field within a record Record Type Two ASCII characters identifying the start and type of record ASCII 51 Data Record ASCII 59 EOF Record Byte Count Two ASCII characters representing the number of bytes to follow including the Address Data and Checksum fields An EOF record has a byte count of three Load Address Four ASCII characters representing the address at which to start loading this record high byte first This field contains four ASCII zeros in an EOF record bytes in an EOF record byte count load address
33. t CR gt to exit the command or any other key to disassemble the next opcode DB Display Breakpoints Syntax DB Display the address of all currently set breakpoints DI Display Internal data memory Syntax DI lt xx gt Display the contents of internal data memory starting at address lt xx gt in hex and ascii 16 bytes per line Non ascii characters are displayed as a period This command displays the 16 bytes starting at address lt xx gt and pauses Valid commands are Space 2 next 16 bytes backspace previous 16 bytes lt CR gt cv eed exit Address range is from 00 to 7F and is automatically wrapped around as needed Micro Valley Systems MVS 31 User s Manual DX Display eXternal data memory Syntax DX xxxx Display the contents of external data memory starting at address xxxx in hex and ascii 16 bytes per line Non ascii characters are displayed as a period Valid commands as per the DI command The address range is from 0000 to FFFF and is automaticall wrapped around as needed DR Display Registers Syntax DR Display the current contents of the 8031 registers The Program Status Word is displayed as individual bits Two lines are printed as follows A B DPTR SP RO R1 R2 R3 R4 R5 RO R7 CAFrrOxP PC Opcode Mnemonic XX XX XXXX XX XX XX XX XX XX XX XX XX XXXXXXXX XXXX XXXXXX XXXXXXXXXX The first line is a heading and the second line is the contents of the corresponding
34. tion Example 3 We want to single step through a timer interrupt routine The timer interrupts are occurring at regular intervals say 100uS We set a breakpoint inside the interrupt routine and then start the program The interrupt occurs and the program stops at the breakpoint The monitor is waiting for a command Meanwhile the user s timer is generating many more interrupts but they are ignored When control is passed back to the user s program with a space command there will be two interrupts pending one from timer 2 and one from the user s interrupt timer If the interrupt timer has the same priority level as timer 2 it will get precedence and the single step will be ignored The user s interrupt routine will interrupt itself and the user s stack will grow Wherever possible the interrupt priorities should be left unchanged In this case all interrupts will be ignored when single stepping As mentioned in the previous example single stepping through an interrupt routine is possible by first setting a breakpoint within the routine and then running the program When the interrupt occurs the program will hit the breakpoint and stop All monitor commands are now available including single stepping Single stepping through an interrupt routine will ignore any further interrupts However pressing G will allow further interrupts to be processed Should another interrupt be pending when is pressed then it is possible that the interrupt
35. tions and Interrupts All of these I O functions use one or more 8031 registers not only to pass arguments back and forth but also within the functions themselves For example inputting characters using INCH requires that during execution of the function the DPTR register hold the address of the host port even though it is left unchanged once the function exits If the INCH routine is interrupted whilst waiting for input and the DPTR register is altered before returning to the function then it will no longer be pointing to the host port Any character returned will be garbage Therefore user interrupt routines should leave the A and DPTR registers unchanged If they are to be used in the interrupt routine push them on to the stack first and pop them off before exiting Summary of Input Output Functions NXTCMD 1FCO Transfer control to MVS 31 monitor ANYIN 1FC3 Check for character input INCH 1FC6 Input character without input INCHE 1FC9 Input character with echo INHEX 1FCC Input a hex digit IN2HEX 1FCF Input 2 hex digits IN4HEX 1FD2 Input 4 hex digits INDEC 1FD5 Input a decimal digit BCD 1FD8 Input 2 decimal digits OUTCH 1FDB Output character OUTHEX 1FDE Output hex digit OUT2H 1FE1 Output 2 hex digits OUT2HS 1FE4 Output 2 hex digits followed by space OUT4H 1FE7 Output 4 hex digits OUT4HS 1FEA Output 4 hex digits followed by space OUTS 1FED Output space PDATA 1FFO Output ascii string PSTRING 1FF3

Download Pdf Manuals

image

Related Search

Related Contents

  Bluetooth / USB Interface 7 607 545 500  Samsung SF-650 用戶手冊  AT&T 1175 User's Manual  PRIUX home    US Robotics Wireless USB Print Server  Bullard T3 Series Thermal Imager User Manual www.bullard.com  Toshiba Satellite S75D-A7272  User Manual - ADFWeb.com  

Copyright © All rights reserved.
Failed to retrieve file