0% found this document useful (0 votes)
172 views33 pages

8051-31 Microcontroller

Uploaded by

Malavika R Nair
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
172 views33 pages

8051-31 Microcontroller

Uploaded by

Malavika R Nair
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 33
8031/51 MICROCONTROLLER TRAINERKIT (SEVEN SEGMENT DISPLAY) Velespleleiwiseleie le I ET bd | L iL) J ABT “ff otf u te Ete EG te EI [EF ( (% PT Table of Contents SYSTEM INTRODUCTION 1 GENERAL DESCRIPTION .. SYSTEM SPECIFICATION SYSTEMCAPABILITIES HARDWARE DESCRIPTION 2 GENERAL MEMORY . VODEVICES.... 8279 (Keyboard & Display Controller) . 8255 (Programmable Peripheral Interface) 8251 (USART) .. 8253 (Programmable Internal Timer) .. DISPLAY .... BATTERY BACK-UP .... COMMAND DESCRIPTION KEYBOARD DESCRIPTION LISTOF COMMANDS .. COMMAND DESCRIPTION .. [] oo GBREGGGRNNASSS SN EXAMINE/MODIFY DATA MEMORY (EXMEM) EXAMINE/MODIFY PROGRAM MEMORY (EPMEM) GO SINGLE INSTRUCTIONS. . BLOCK MOVE PROGRAM MEMORY TO PROGRAM (BM. BLOCKMOVE DATAMEMORY TOPROGRAM MEMORY (8M.DP) .. BLOCK MOVE DATA MEMORY TO! DATAMEMORY (BM.DD) .. DELETE (DELD) INSERT (INSD) FILL .... ONBOARD INTERFACES GENERAL DETAILS OF INTERFACES AS-232C INTERFACE Table of Contents Table of Contents \UD RATESELECTION SERIAL MODE INTERFACE SERIALCOMMANDS DUMP DATA MEMORY (DD) ENTER DATA MEMORY (ED) FILL MEMORY (FL) ... SINGLE INSTRUCTION (SI) EXECUTIONIN FULL SPEED (GO) REGISTER DISPLAY (RG) MEMORY MAPPING OMAPPING SUBROUTINES & SAMPLE PROGRAMS INTERRUPT SAMPLEPROGRAMS Program-t . DEMOPROGRAM FORCRT/SERIAL MODE .. Program 8 Program-9 Program-10 Program-11 Program-12 Program-13 Program-14 Program-15 Program-16 nt wwe 8S 1 Oy OST OA, Ba & y . » Table of conten. 4 ooh & th 8 ml Vt fell 9 == s » (—[- & am sew s (- f—=[- | He \ voesubb cs BM OOO EP OS ET ET ESE Table of Contents DETAILS OF CONNECTORS BUS CONNECTOR-CN1 POWER CONNECTOR-CNS TIMER (8253) CONNECTOR-CN2 PPI (8255-1) CONNECTOR-CN3 PPI (8255-Il) CONNECTOR-CNG .. RS-232 CONNECTOR-CNG . SOFTWARE PACKAGES COMMUNICATION BETWEEN PC & VMC-8031 KIT UPLOADING... DOWNLOADING APPENDIX INSTRUCTIONS THAT AFFECT FLAG SETTINGS. 8051 INSTRUCTIONSET.... 89C51/52 PROGRAMMER (OPTIONAL) BLOCK DIAGRAM... Table of Contents q 8235 SYSTEM INTRODUCTION GENERAL DESCRIPTION VMC-8031/8051/89C51 is asingle board MICROCONTROLLER TRAINING/DE- most popular Intel's 8031/8051, 8 bit VELOPMENT KIT configured around the /g9C51 can be used to train Engineer's single chip micro controller. VMC-8031/8051 about the architecture, instruction set and capabilities of the 8031 chip and also for actually controlling any industrial process etc. The kit communicates with the outside world through a key board having 28 hex keys and seven segment hexadecimal display.. The kit has the capability of interacting with an IBM_PC compatible PCXT/AT system. 5 32K bytes of RAM and 32K bytes of EPROM. a memory can be very easily expanded to 128K AM and ROM. The monitor is incorpo 32K bytes of RAM has an address of yMC-8031/8051/89C51 provide: The total on board program & dati bytes in an appropriate combination of R rated from 0000-1 FFF and the necessary 2000-3FFF. 31/8051/89C51 provides 48 programmable Vv ucture of VMC-80: le Timer/Counter for generating any type of The Input/Output str 6 bit programmabl O lines. It has got 1 counting etc. s system monitor software is very powerful and provides powerful software commands various software utilities. The kit provides various like INSERT, DELETE, BLOCK MOVE, RELOCATE, STRING, FILL & MEMORY COMPARE etc. which are very helpful in debugging/developing the software. st of the command avail- er friendly. The on board resident serial monitor covering mo: The system also provides a kes the monitor more U able in keyboard mode. A help menu mat VMC-8031/8051/89C51 is configured around the internatlo is the most popular bus for process control and real tim address, data and control lines are available at the FRC connector. expandable for any kind of application. ackup to store the program i nationally adopted Bus, which 1 applications. All the The Kit is fully The kit has onboard battery b noase of power failure. System Introduction es 8031/51 HEX User's Manu®—— a SYSTEM SPECIFICATION ie © PN Oar wn CPU 8031/8051/89C51 MEMORY ..... .. Total on board capacity of 128K bytes@x. RAM ..... .. 32K bytes and space for further exParerl iy sion .. 32K bytes of EPROM loaded with pof 9 ROM ..... erful program. sae) TIME! .. 16 bit programmable timer/counter usin, 8253 Se VO... . 48 V/O lines using 8255 PPI. S38 KEYBOARD... . 10 keys for command, &_* 16 keys for hexadecimal data entry Se 1 key for vector interrupt & «1 5 1 key for reset LED DISPLAY .. -. 6 seven segment display (4 for addre: yos’Ss BC B BS Ss eS 8 “sv. B® BRD DB 3 COMMAND DESCRIPTION KEYBOARD DESCRIPTION VMC-8031/8051/89C51 has 28 keys and six-seven segment display to communi- cate with the outside world. As VMC-8031/8051/89C51 is switches on, a mes- sage -‘UP 51’ is displayed on the display after pressing Reset.The key board is as shown below: serer| || |ctreg | | eneal |) |oiseRl Resey | | Ft SHIFT H 5 2 : La EXREG | | p.prc| || |seria 8 9 A oa sl B fepmenq || | iso | |) | ELo : ' 6 7 EXM pm.o0} || | co 4) pm.oP) || | FIL , 3 : pre | || | next : ‘ RESET Reset the system. SHIFT Provides a second level command to some keys. GO To execute the program. sl To execute the program in single step mode. EXREG Examine Register; allows user to examine and modify the contents of different registers. EXMEM .... Examine Program Memory; allows user to examine/modify any data memory location. PRE Previous is used as an intermediate terminator in case of Examine Memory. It decrements the PC contents and writes the contents of data field to the address displayed in the address location. ‘Command Description 9 8031/51 HEX User's Manual 's Man 3 for a 80. Hi si : stem is waiting = lay indicates that sy will : CU a oh ea anne the user gives a data, the ose NEXT Increment is used as a intermediate terminator in case 4 4 command. If, instead of Seria of address field inaieales: thet cout : Examine Memory, Examine Register etc. It increments th display ‘-Err’. A dot on the the data of any memory location is PC Contents and writes the data lying in data field at thé 4 expects an address. eee Data Field. location displayed at address field. dot is displayed on the L' d address in hexadecimal form as all data and a Terminator is used to terminate the command and write tk VMC-8031/8051/89C51 accepts : The Gata in data field at the location displayed in address field, given in the table - 1. i. PLAY BMOD ~~ Allows user to move a block of data Memory to another deta ECIMAL | BINARY | LED DIS! AL D memory. : HEXADECIM) a 0 000 a ‘ BM.PP 5 7 | 0001 i = > 2 0010 ¢ BM.DP 7 3 oott 3 3 : : 0100 u FILL. » 4 é 0101 $s INS . 5 : ot10 & 7 ¥ ont a DELD % 7 8 4000 8 8 1001 g 2 9 SETBR ~ Set Break point allows user to set i 1 7 oY a se a break 10 the user program, Point anywhere é > A " 4011 6 7 CLRBR ~~ @iear Break point allows user to Clear a break point » j 2 00 y where in the user program, Polnt angy c a 4101 d » ENBR Enable Break poi D é z Point allows user to ir ! at . where in the user Program, Snable a break Point any" ap E : 1 e 1 DPBR Dis ; F Play Break point allows us; Ps the break point was set ‘er to see the address wher P.PRG i & +. This key is for further ©Xpansion SERIAL ...., . This key is used f Or Serial Communication with PC. . of numeric par : am : imiters, - P&'Meters separated by PRE : ee Le Command Description . Command Descripti All commands are followed by a set NEXT & «4 (Execute) to work as deli a gare rT TT a 8031/51 HEX User's Manual LIST OF COMMANDS 1. RESET EXAMINE/MODIFY REGISTER GO SET BREAKPOINT ENABLE BREAKPOINT DISABLE BREAKPOINT 9. DISPLAY BREAKPOINT 10. CLEAR BREAKPOINT 11, SINGLE INSTRUCTION PN2aa wp ‘} al ® 12, BLOCK MOVE FROM PROGRAM MEMORY TO PROGRAM MEMORY x 18, BLOCK MOVE FROM DATA MEMORY TO PROGRAM MEMORY “* 14. BLOCK MOVE FROM DATA MEMORY TO DATA MEMORY 8 15. DELETE DATA al 6 16. INSERT DATA 17. FILL COMMAND DESCRIPTION RESET This key initializes the VMC-8031/8051/89¢54 Ki display. A ‘-’ on the left most end of display indic: it and displays ‘. UPS1" on the. ing a valid command, ‘ates that the system is. expect- A EXAMINE/MODIFY REGISTER (ExpEq This command is used to examine/mo, wants to examine the contents of aij dify any internal regi A ‘Qister of the CPI ~~ the fegisters, one can start ‘ron a Reg. = Command Description A a —— EXAMINE/MODIFY DATA MEMORY { . EXAMINE/MODIFY PROGRAM MEMORY " £6 I mana WN WAGG - h by pres: ‘t key. Whereas if some and ne all the registers by pressing next y soeciie registers is to be examined, then the key for that register can be entered Greet. The contents of any register can be changed. Syntax on) ir EXREG key, the contents of A reg. are displayed in the me Pe taen Pea the contents by entering the data and pressing NEXT data ie ess NEXT to see the contents of next registers, On pressing NEXT a ae the system will display the contents of all the registers. The registers ot ee d in the sequence of A, B, PCH, PCL, DPH, DPL, SP, PS, TLO, THO, as + 70D, SCO, IE, RO to R7. If at any stage one wants to terminate the Tonmmand, just ‘press "" key, the system will display "-". EXAMINE/MODIFY DATA MEMORY (EXMEM) i mmand is used to examine the contents of any of the data memory er and modify the contents of the RAM area. [ ] Syntax exe CE) tate CEQ CO ir i it is displayed in the address field. One can now enter Saeed Hea (fe which fa to examine, and press NEXT. The con- Me Sn location is displayed in the data field. If one wants to examine the tents oF ne next location, just press NEXT and the address in the address field oT sented by one and its contents will be displayed in the data field. pu vay i one wants to examine the content of previous location just press Seed syand the address in the address field will be decremented by one and its ae will be displayed in the data field.
[ ] i i the data and to modify the contents of any RAM location, then enter tere NeXT The data field will be written in the address displayed in the address a ind simultaneously the contents of next location will be displayed.|f at any caine wants to terminate the command, just press "." key, the system stat display "-". 7 Command Description 8031/51 HEX User's Manu’ 8031/51 HEX User's Manual EXAMINE/MODIFY PROGRAM MEMORY EPMEM ' This command is d ir a used to examine the contents of any of the program memo* Syntax - [ ] :
he rest of the operation is same as explained in EXMEM ¢ ommand. Go This command is used to execute the : speed. On pressing idress field with tk Program in full clock 9 addre: program is to be execute. Press Terminate Oe of the progr the program and E will be displayed in the agdvc The CPU will start executir! ir Syntax [
] SINGLE INSTRUCTIONS This command is used C to execute the ressing SI, tt fs deplay : Hes a te eee counter content is displayed onion a ee i . Hone wants to modi Bowes fet id entering the addi ea A ress, press NEXT, the contents of ee da scent A red address ig qj is dis. command at any stage, one ca 3c . indi displayed in the address field. Onoen fat using (.) or any memory location without pres i sing Reset. 2 Command Deseripti RMS NRT we VY Ue > » 3 a 3 2 Syntax
Cc.) (=) BLOCK MOVE PROGRAM MEMORY TO PROGRAM MEMORY (BM.PP’ This command allows the user to move the block of program from the program memory location to another program memory location. On pressing SHIFT and BM.PP key a dot is displayed in the address field. Enter the starting address of the block to be moved and press NEXT. Again a dot is displayed. Now enter the end address of the block and press NEXT. Again a dot is displayed. Now enter the destination address and press Terminate (.) key. A ‘-' is displayed in the display. [NEXT] Syntax C.D BLOCK MOVE DATA MEMORY TO PROGRAM MEMORY (BM.DP) Its works the same way as explained above except that the movement of informa- tion is from data to program area. syntax eendaddress> (_._) BLOCK MOVE DATA MEMORY TO DATA MEMORY (BM.DD) Syntax Cea) «destination address> ‘Command Description eel 8031/51 HEX User's ManuéS—— DELETE (DELD) RD This command allows the user to delete one or more instructions from the user...) program. In this command all the memory referenced instructions also get modi- ; fied accordingly to keep the logic of the program same. The foll atione~. is to be entered: - The following informaticeS~t__4) 1) Starting address of the user program. 2) End address of the user program. 3) Address of the location from where onwards the bytes are to be deleted SD 4) Address of the location till where the bytes are to be deleted. If the delete iperation is performed in a program, the jum; > ; & memory referenced instructions need to be modified. eerie a : On pressing SHIFT and DELete Key, some address is di ‘ starting address of the program and press NEXT. Now erent eee tO BP press NEXT. A dot is displayed at the end of the Address field. N ness ang & starting address from where the bytes are to be deleted and press NEX enter tH \._4 dot is displayed at the end of address field, Enter the end address an yo bytes are to be deleted and press Terminator (.) key. A Ss till where the, 2 the address field indicating thatthe system is ready to accept te Pe displayed ih if mana. Syntax A | 6 SF i oN _# NEXT on os INSERT _(INSD This command allows the user to insert on ann ino le Or me i . program. This following information is required to be enterea in the use 1) Starting address of the program. 2) End address of the program. al Command Descriptio » 8031/51 HEX User's Manual 3) Address from where the bytes are to be entered, 4) No. of bytes to be entered. 5) Data, On pressing SHIFT and INSD, a ‘.' is displayed in the address field. Enter the starting address of the program from where you want to insert and press next. again a '.' is displayed. Now enter the end address of the program and press NEXT. Now enter the address of the program where the ytes are to be inserted and press NEXT. The system will display the '.’ again. Now enter the no. of bytes to be inserted and press NEXT. The system will display the address where you wish to enter the bytes. With its current data in the data field. Enter the bytes you want to insert using NEXT key. When all the bytes are entered, a ‘.' will be displayed indicating that the Insert is completed. Syntax (Next) starting address of program at which insertion should start> eno. of bytes to be inserted> NEXT actual bytes to be entered separated by NEXT> «starting address of the program/data block> FILL This command allows the user to fill a memory area (RAM) with a constant. The following information is required to be entered. 4) Starting address of the memory area from where the data should be stored. 2) End address of the memory area till were the data should be stored. 3) The constant with which the data should be done i.e, 22. Press SHIFT and FILL. A '.' will be displayed in the address field. Enter the starting address and press NEXT. Again a.’ will be displayed. Now enter the end address till where the filling to be done and press NEXT. Again a ‘.' will be Command Description a 8031/51 HEX User's Mant—® b displayed. Now enter byte to be filled and Press '' key. The system will displa isplay Syntax (NEXT) Ger) | Gut 9, % Gaht fy¥v ta yb ( 4 ONBOARD INTERFACES GENERAL DETAILS OF INTERFACES VMC-8031/8051/89C51 provides the following on-board interfaces as mentioned earlier. 1) RS-232C interface through 8251 USART chip. 2) Serial Mode Interface. RS-232C INTERFACE The RS-232C interface is provided on VMC-8031/8051/89C51 through Intel's USART chip 8251 (Universal Synchronous Asynchronous Receiver Transmitter). It is a seven line interface with all seven signal lines being brought out at Connector space CN7, which is a 9 pin D type Male Connector. The pin detail for this interface is as follows: SIGNAL 45V Receive Transmitte DTR (Data Terminal Ready) GND DSR (Data Set Ready) RTS (Receive Terminal Ready) CTS (DATA TERMINAL READY) NC 53 for baud rate generation. COrNonrana The 8251 uses Timer 0 of 82: The VMC-8031/8051/89C51 monitor contain a software for connecting VMC-8031/ 8051/89C51 through this interface to the serial port of IBM-PC compatible com- puter. The commands are provided for storing the contents of system memory to the floppy drive in Intel's HEX format and same way the Intel HEX files can be loaded into the system memory. port of the IBM-PC Compatible Computer can be The interface to the serial rate viz. 19200, 9600, 4800, 2400 & 1200 which can be achieved at any of the baud Onboard Interfaces 17 8031/51 HEX User's Manu selected as explained in the chapter- in Serial Monitor commands. However for operating = at 19200 baud, only PC/AT should be used. ° Ss aL ¢ i BAUD RATE SELECTION The user can set the VMC-8031/8051/89C51 kit at the desired baud r. | following the procedure given below: ae Pasty 1) Press serial key on kit keyboard. 2) Press the required key from the table given below: ow oT Key to be pressed | Baud rate selected cH A’ 5 9 19200 1 9600 3 4800 7 2400 F 1200 [eee 200 Renee ; ols 3) Press FILL key. A message SEr will be displayed Gisplay of Kit and if the computeriterminal is also cet xt t Seven Segmen a message: same baud rate, ( VMC-51> SERIAL COMM. a COMMAND> Sf appears on the computer screen. SF NB Onboard Interface 18 a F ® ——— | SERIAL MODE INTERFACE 5 Utility of this kit is that it can be interfaced with PC through serial port for operations with the help of PC Keyboard. ) 2) 3) 4) 5) Connect the kit to the Serial port of PC with the help of cable to be connected at CN6. Switch ON the kit & PC. Run the HYPER TERMINAL and set the COM port & Baud rate. Press RESET, SERIAL and the desired numeric keyof the kit and FILL. The Display on monitor will be as follows. vMC-51 SER COMM. COMMAND> SERIAL COMMANDS VMC-8031/8051/89C51 has a Serial Interface which allow the user to execute most of the key board commands through the ASCII Keyboard. VMC-8031/8051/ 89C51 has a serial interface through USART 8251. The system can be interface with the serial port of a IBM-PC/XT/AT compatible Computer. Program having capture facility. The following commands are available through Serial Mode. Use only CAPITAL letters for executing the commands. “ DUMP DATA MEMORY ¢ ENTER DATA MEMORY “> FILL MEMORY “ SINGLE INSTRUCTION GO (EXECUTE) + REGISTER DISPLAY + DOWNLOAD + UPLOAD ‘Serial Mode Interface DD ED FL SI GO RG DL UP 19 8031/51 HEX User's Mant’ DUMP DATA MEMORY (DD) This command dumps the data memory between and including two specifier address separated by a space. Syntax DD ic The starting address should not be higher than the end address. ENTER DATA MEMORY (ED) C This command is used for entering data bytes in to data memory area. Syntax ED On pressing the PC content is i the PC content is decremented whic! data of the location shown. For comi incremented and on pressing sbyte to be filled> SINGLE INSTRUCTION (SD This command is used for runnin: . . a pro i i . instruction by instruction, 9 @ Program in single instruction mode i.e Syntax S| <¢RS After the execution of an instruction, the c i Atel gan cystom Wate fore Cane ny ‘ontents of all the registers are di ; urn to be pressed for thi the next instruction. For coming out of this command press Esc ee = 50 Serial Mode Interta £5 9» 9 9 a aS a 8031/51 HEN User's Manua EXECUTION IN FULL SPEED (GO) This command is used to execute a program in full clock speed mode. Syntax GO | REGISTER DISPLAY (RG) This command displays the contents of all the registers of 8031 controller. Syntax RG MEMORY MAPPING The 8031/8051 chip supports 64K bytes of program memory and 64K bytes of data memory. That means the total memory which the 8031 can address physi- cally is 128K bytes. Since in a practical situation, the user may need the same memory area for Data as well as programs, the system VMC-8031/8051/89C51 has been designed in a way that the same memory chip can be used as program/data memory. There are three memory sockets provided on the kit. The two sockets are pro- vided with the memory (RAM & Monitor ROM) and one socket is free for the memory expanded by user. The RAM area provided with the address range from 2000-3FFF. The address of memory is from 6000-7FFF. ee eee ee Serial Mode Interface ll UU VO MAPPING 8031/51 HEX User's Manu A Various chips used in VIMC-8031/8051/89C51 are 2 x 8255, 8253, 8279, an 8251. The addresses for these I/O devices are given below ¢ eo [onnector] Device Selected| Port Name Port Address ‘ CNS 8255-1 FFOO Port A Ss FFOI Port B FFO2 Port C Ss FFOS Control Word cN4 8255-II FFO4 Port A é FFOS Port B é FFO6 Port C FFO7 Control Word 6 ON2 8253 FFOC Counter 0 < FFOD Counter 1 FFOE Counter 2 “A FFOF Control Word Ne 8251 FFO8 Data In/Outward FFog Command/Status Word 8279 FFis Mode Word FFI9 Control Word € 22 Serial Mode Intertac v3 rs) sss eves be BE 2 £1 a 6 SUBROUTINES & SAMPLE PROGRAMS ViMiC-8031/8051/89C51 monitor uses certain subroutines for its operation, which can also be used by the user of his programs. The addresses of these routines and their descriptions are given here: oad Label Description of routine 6F7H DISPLAY _ | This routine displays DPTR on address field. No Register is destroyed 073EH RDADD: This routine reads address a has terminator, No other register is destroyed 42DBH PRMPT: This routine displays prompt on CRT TERM: No register is destroyed 8H MESSAGE: | This routine displays message on the PC 15h soreen in Serial Terminal Emulation Mode Input : DPTR has message table address 24H indicates end of message H OUTCHR: This routine outputs the byte on RS-232C 1608! serial port. Input : Accumulator has byte to be outputted, No other register affected. 30H INCHR: This routine inputs character from serial port . into accumulator. No other register affected. 1694H OUTASCII | This routine unpacks the hex byte into two hex nibbles then transmits ASCII. Equivalents of the two on RS-232C Serial Port. Input : A has the hex byte. No register is affected. cE Subroutines & Sample Programs 23 8031/51 HEX User's Manu. 8031/51 HEX User's Manual —_).]q SAMPLE PROGRAMS Sample Programs are given here to the user to understand the programming techniques of 8031/8051/89C51 microcontrollers. Program-1 FLASHING DISPLAY OF SUPERB ON SEVEN SEGMENT DISPLAY ON EXECUTING THIS PROGRAM FROM ADDRESS 2000H, “SUPERB” MES- SAGE FLASHES ON THE DISPLAY OF THE KIT. Address Label Description lof routine 07E2H GETCDE This routine searches the table 7 Input : A has byte to be searched in table DPTR has starting address of table onctie | _ RAM location 4E has number entries in table Ey Output : A has Position number of character, in table IF found Else Carry is set indicating charater not found, F INTERRUPT P There are two extern: al interrupts called INTO & INTY Interrupt INTO is Used for keyboard &nd interrupt INT1 i Ff fi s free for the user. Thé different interrupts, Timer, Serial Interface addresses are as follows: rP FUNCTION San ae Location ws farting ress : seats nF 0003 , . a F TF 2 ~ , ‘mer, serial interface can not be used directl s our monitor area starts trom 0000 to 1FFF. So We are given jump locaton a nA area of corresponding above facility. x Subroutines & Sample Prograr . ® Address Code Label Mnemonic Operand Comments "90 20 2E HERE: MOV - ~, DPTR,#202E ;SUPERB message saa 12 06 F7 LCALL —O6F7 sdisplay routine 200: 2006 | 7B 00 Mov R3,#0 7A 00 LOOP2: MOV R2,#0 ae DAFE LOOP: DJNZ ,' R2,200A _;delay code cs BFA DUJNZ‘ —_-R3,2008 nea be 0 34 MOV *, DPTR,#2034 ;blank message oe ° ‘e F7 LCALL O6F7 sdisplay routine oon MOV R3,#0 00 ‘ 014 |76 00 Loops: MoV R2,#o 2016 | 7A FE LOOPS: DJNZ ) R2,2018 idelay code 2018 paar DJNZL/ 3,206 1A 0 zag oe Sto ‘eee 31, 61,F5,C1 202E|_49 83 31 61 FS 5 a EFADR2: DFB FF, FF, FF, FF, FF, FF zose FEFFFEFFFFE iblank display 25 ‘Subroutines & Sample Programs 8031/51 HEX User's Manud Program-2 HEXADECIMAL ADDITION OF TWO NUMBERS fing tt 6 ecuting the program a ‘! appears in the address field. Enter the fs. operand in hex and press next. a‘. appears again. Enter the next operand in hex and press next. The sum of two no. is. displayed. 6 Address Code Comments nee 8165. START: MOV 81.865 Jnitialise stack 2003) 12 07 3E —PLCALL.” 073E Label Mnemonic Operand we rand 2006 0 ad the first ope! MOVX= — A@DPTR) store in OAH and OBh 2007 FS 0A Mov OAA 2009 AS INC DPTR e 200A EO MO A@DPTR , 200B F50B Mov SBA a : 200D 1207 3E LCALL O73E stead second operand os 7 ae MOVX — A@DPTR : Mov OCA store in OCh and ODh 2013 AS ING DPTR 2014 £0 MOVX ~——A.@DPTR 2015 F50D Mov ODA 2017 C3 ‘ : cLR cS solear the car 2018 £5 0B Mov A0B _ 201A 25 0D ADD ’ AD ‘add them F and move 201C F582 MOV 82,0 result 201E ES0A Mov Aon‘ a 2020 35 0C ADDC gc 2022 F583 Mov aA em " = ACALL 2098 20: HALT: SUMP 2026 stop the processor 2028 £5 83 PRINT: Mov A83 ‘ : 202A CO 82 PUSH ga 202C 90 20 67 Mov DPTI 2020 99 R,#2067 ACI ALL = 2054 ‘display the result —_———_—- 26 Subroutines & Sample Progral”™ ee ee. 8031/51 HEX User's Manual Address Code Label Mnemonic Operand Comments 2031 DO 82 PoP 82 2033 £5 82 MOV Ag2 2035 90 20 67 MOV DPTR.#2067 2038 A3 INC DPTR 2039 A3 INC DPTR 203A 11 54 ACALL 2054 203C 90 20 67 wov DPTR,#2067 203F AS INC DPTR 2040 A3 INC. DPTR 2041 A8 INC \ DPTR 2042 A3 Inc \ DPTR 2043 78 02 MoV Ro,#02 2045 74 10 FILL: MOV AO 2047 1207 E2 LCALL —O7E2 204A FO MOVX — @DPTRA 2048 AS ING DPTR 204C D8 F7 DJNZ ——-RO,2045 204E 90 20 67 Mov DPTR,#2067 2051 1206 F7 LCALL —O6F7 2054 F50A CODE: Mov OAA 2056 54 FO ANL A.FO pose C4 SWAP OA 2059 12 07 E2 LCALL —O7E2 20sc FO MOVX = @DPTR|A p0sD ES 0A Mov AOA pose 54 0F ANL A#OF 2061 AS INC DPTR 062 12 07 E2 LCALL —07E2 3065 FO MOVX — @DPTRA 2066 22 RET TEMP: DFB 2067 00 00 00 00 00 00,00,00,00,00,00 ‘Subroutines & Sample Programs 27 Ne 8031/51 HEX User's Manual 8031/51 HEX User's Mant. fa aaecious Label Mnemonic Operand Comments Program-3 £ INC aa! To read and add 5 8-bit nos. and display 8-bit result. On executing this Coded 2035 AS MOV RO,#04 from 2000, the sum of the five numbers stored at addr. 2045 is displayed 2036 78 04 FILL: MOV. AHO neglecting carry. lp 2038 74 10 TCALL O7E2 get code from code table Uy 203A 12.07 2 INC DPTR Address Code Label Mnemonic Operand Comments ip 203E AS DUNZ RO,2038 ] 203F 08 F7 TR#204A 2000 90 20 45 Mov DPTR,#2045, AP 2041 90 20 44 ae oe 2003 78 00 Mov Ro,#00 7 ‘ + 2044 22 00,00,00,00,00 2005 75 0A 05 Mov 0A,#05 ow 2045 0000000000 DAT: DFB 0.09 ee 2008 75 Fo 00 Mov Ro,#00 “204A 00.00 00.00.00 TEMP: DFB — 2008 ES FO NEXT: MOV ARO 2000 93 MOVC = A@A+DPTR read table lp Program-4 OF TWO NUMBERS oe 11 cece aes (to : in the address field. Enter the 2010 05 FO INC Ro Ls ecuting the program from 2000 a '.’ appears in ars again. Enter the next 2012 DS OAF6 DJNZ ——OA,,2008 Tg One rand in decimal and press NEXT. A.’ appe is displayed. If the sum 2015 FB MOV or iA has sum : es coin decimal and press NEXT. The sum of no no. Is displayed. ' . € and il | I in the result. 2016 90 20 4a Mov DPTR,#204a, 1 aoa than two digits, the carry is ignored in 2019 11 23 ACALL 2023 . its q Operand Comment 201B 1206 F7 LCALL O6F7 display sum £P address Code Label Mnemonic Op 201E 80 FE HALT: SIMP 2016 : START: MOV 81,865 Jinitialise stack : & 5 i 2020 S UPDATE: ADD ARO ‘update addition . 2000 75 = = LCALL 073E stead the first operand Mov ROA © 2003 12 INC DPTR 2022 22 RET — 2006 A3 MOVX A@DPTR___ store LOWER BYTE 2023 FS 0A CODE: Moy OAA © 2007 £0 Mov OAA sin OAh oe ec . ea 2 Tip 2008 oa 3E LOALL —073E yread second operand SWAP A wr 200A INC DPTR 2028 1207 E2 12 D AB en Gt recAl O7E2 ‘Get code from code table pe MOVX — A@DPTR 2 MOovx @DPTRA y 200E ADD AOA yadd as hex 202C E50A Mov AOA F — ao0F 2504 DA A decimal adjust aco 202E 54 OF ANL AMOF 7. woo MOV 8A 2030 A3 INC DPTR 2d lee MOV 83,400 2031 12 07 E2 LCALL 79 T 2014 75 - ACALL 2018 ‘display the result 2034 FO MOVX — @DPTRA : 2017 111 a nple Programs , Subroutines & Samp! 28 Subroutines & Sample Progra: _ mma armsan aa aaeT ————————— Label Mnemonic Operand Address Code Comments 2019 20 FE HALT: SJMP 2019 stop the proces: 201B £5 83 PRINT: MOV A838 if 201D co 82 PUSH 82 - 201F 90 20 5A Mov DPTR,#205A 2022 1147 ACALL 2047 display the result ‘ 2024 DO 82 POP 82 2026 5 82 MoV Ag2 @ 2028 90 205A Mov DPTR,#205A a 2028 A3 ING DPTR 2020 A3 INC DPTR f 202D 1147 ACALL 2047 202F 90 205A Mov DPTR,#205A 2032 AS INC DPTR 2033 AS INC DPT 2034 A3 INC ce me 2035 A3 INC DPTR iy XQ 2036 78 02 Mov Ro,#02 c 2038 7410 FILL: MOV AgHO Basa i Gr Ee LeALL eye ‘get code for blank 203D FO MOvx @DPTRA 203E AS INC DPTR 203F D8 F7 DJNZ —_-RO,2038 2041 90 20 5A MOV DPTR,#2054 2044 12 06 F7 LCALL —06F7 ‘print result : 2047 F50A CODE: Mov OAA r 2049 54 FO ANL Astro 2048 C4 SWAP A 204C 12 07 E2 LCALL O7E2 sget the cod : 204F FO Movx @DPTRA “ 2050 E50A Mov AOA 2052 54 0F ANL AWOF 2054 A3 INC DPTR ww Subroutines & Sample Program >, w Address Code 2058 2059 205A 8031/51 HEX User's Manual Label Mnemonic Operand Comments 12 07 E2 LCALL O7E2 get the code FO MOVX @DPTRA 22 RET 00 00 00 00 00 TEMP: DFB Program-5 PROGRAM: Reads a hex byte from the keyboard of the kit and split it into two nibbles and stores MSB in 2050H and LSB in 2051H. On executing the program enter the data and press Enter. 00,00,00,00,00,00 Address Code Label Mnemonic Operand Comments 2000 2003 2006 2007 2008 2009 200B 2006 200D 200E 2010 2013 2014 2015 2016 2017 ‘Subroutine: 75 81 65 12 07 3E Ag £0 FB 54 FO C4 F8 £8 54 OF 90 20 50 FO AS E8 FO. 02 00 4E START: MOV LCALL INC -5 & Sample Programs 81,465 073E DPTR A,@DPTR RSA AgFO A ROA A\RO A.HOF DPTR, #2050 @DPTRA DPTR ARO @DPTR,A 004 sinitialise stack sread the first operand eS 8031/51 HE User's Mant! i Program-6 PROGRAM: To see if the no. is odd or even On executing program agké for ward. Enter the word and press ‘.’. If ‘O" appears ©n screen word is odd. If ‘E’ appears on screen word is even. = a Comments 2000 7 MOV pee S a a START: 81,#65 itialise stack ae LCALL O73E iread the first = INC DPTR joperand oe A@DPTR —_smove the last byte ae ASE ito check the Isb Sas ea A#FE,2012 ibit if one the no. cee DPTR,#201A is odd if zero the 2012 90 20 20 eae es ote Paes pao ‘display status 2018 80 Fi a8 E —_sHALT: SMP aig stop the 20 61 FF FF FF FF FFEMSG:DFB 61, FF, FF, ’ — 2020 03 FF FF FF FF FF ODD ete . MSG: DFB 03, FF, FF, FF, FE FE Program-7 PROGRAM: HEX MULTIPLICATION Re: ads two hex bytes from keyboard multiplies them and display ys result. Address Code 2000 75 81 65 START: MOV 2003 12 07 3E LCALL 2006 A3 INC 2007 £0 Movx 2008 F50A Mov 200A 12 07 3E LCALL ea 32 Label Mnemonic Operand Comments —— iinitialise stack aes read te first operand A Sue ‘Move te last byte y ito ace 073E stead second operand , Subroutines & Sample Prograr’ ~ cd = ee Label Mnemonic Operand 8031/51 HEX User's Manual Address Code 200D A3 ae 200E EO ses 200F FS5FO ay 2011 ESO0A Mov 2013 Ad MUL 2014 85 FO 83 ee 20017 F5 82 boy 2019 74 00 _ 201B FO _— 2016 11 20 ACALL 201E 80 FE ALT: SUMP 2020 E583 PRINT: MOV 2022 C0 82 BUS 2024 90 20 5F Mov 2027 11 4C ACALL 2029 DO 82 POP 202N ES 82 - 202D 90 20 SF baal 2023 AS ne 2031 AS Inc ee ic ACALL 2034 90 20 5F Mov 2037 AS INC a Inc 2039 AS INC 203A AS ae 203B 78 02 st con a FILL: MOV ear 12 07 €2 LCALL 2042 FO Te 2043 A3 a DJNZ Subroutines & Sample Programs Label Mnemonic Operand Comments DPTR A.@DPTR ROA AOA ARO 83,RO 82,A A,#00 @DPTRA 2020 201E Ag3 82 DPTR,#205F 2046 82 A82 DPTR,#205F DPTR DPTR 2040 DPTR,#205F DPTR DPTR DPTR DPTR R0,#02 AWHO O7E2 @DPTRA DPTR R0,203D ;move te second byte to ace cbring operands to ‘Aand B smultiply smove on to dptr display in adress field ;stop te processor display te result 33 Address Code Label Mnemonic Operand 2046 90 20 5F Mov 2049 12 06 F7 LCALL 204C F50A CODE: mov 204 54 FO ANL 2050 C4 swap 2051 1207 E2 LOALL 2054 FO MOVX 2055 EF OA Mov 2057 54 0F ANL 2059 AS INC 205A 12 07 E2 LCALL 205D FO MOVX 205E 22 RET 205F 0000000000 TEMP: DFB 34 8031/51 HEX User's Manual DEMO PROGRAM FOR CRT/SERIAL MODE DEMO PROGRAM FOR Chisbayaeeeaerseee Comments —— Program 8 paaeeeee This program displays a message on CRT. The following program will work in oer? Serial Mode and message will display in CRT monitor. OAA AJFO Address Code Label Mnemonic Operand Comments A O7E2 2000 75 81 55 Mov 81,455 @DPTR,A 2003 90 20 1E Mov DPTR,#201E AOA 2026 1215 F8 LCALL 15F8 A#OF 2009 02 12 DB LMP 12DB DPTR 201E 56,49,4E,59,54,49,43,53,24 Ce Program-9 @DPTR,A: 00,00,00,00,00,00 This program reads a key from the 101 ASCII keyboard of CRT and split it into two nibbles and stores MSB nibble in 2021H MLL. and LSB in 2030H M.L. Subroutines & Sample Prograt™ a gs rd Address Code Label Mnemonic Operand Comments 2000 75 81 55 MOV 81,855 2003 12 16 3D LCALL 1630 2006 FB MOV R&A 2007 54 FO ANL AAFO swaP A 2009 C4 200A FB MOV ROA 2008 EB Mov AOS 2000 54 0F NL AgOF 200E 90 20 30 RN neTH E2090 2oit FO MOVX @ DPTRA 2012 A3 INC DPTR 2013 &8 MOV Ago 2014 FO MOVK @DPTRA 2015 02 12 DB WMP =12DB rt i Subroutines & Sample Programs = 8031/51 HEX User's Mani > 8031/51 HEX User's Manual i Program-13 This program displa i ae plays a character on CRT when ASCII code is 6 Subtraction of 2 numbers. and stored result at 3012 address. aa e 6 Address Code Label Mnemonic Operand Comments ress Code Label Mnemoni. - nic > Operand Comments Ls 3000 78 05 MOV RO, #05H 312 number ee MOV 81.65 (> 3002 79 04 MOV R1,#04H 2° number aaa toe MOV Aaa 3004 3 cLRC 12 16 08 LCALL 1608 L¢ 3005 8 MOV A, RO 2008 02 12 08 WMP 4208 f 3006 99 SUBB A, Ri ;sub result at A reg. Program-11 Lg 3007 90 30 12 , MOV DPTR, #3012H result at 3012 address : A FO 7 MOVX @DPTR, A This progra i a ine Program displays the no. in accumulator on CRT. S 3008 80 FE a 4 a F a Address Code Label Mnemonic Operand co 5 f > The result at 3012 address will be 01H. of ® mments . f 2000 75 81 65 Mog # © Program-14 2003 74 44 on ee J) > Division of 2 nos. and stored result at 8012 address. 2005 12 16 94 LCALL cy gs : 2008 02 12 DB UMP 4208 § Address Code Label Mnemonic Operand Comments ‘ K Program-12 e a € 3000 78 08 MOV RO, #08H :1% number Addition of 2 numbers and stored re ey meee ve ee sult at 3012 address, oct MOV A, RO Address Code Label Mnemoni ¢ 3005 89 FO MOV B, RI m f onic Operand = Comments 3007 84 DIV AB divide 3000 78 04 MOV Ro, #oau f 3008 90 30 12 MOV DPTR, #3012H div result at 3012 add : ie 3002 79 05 MOV Rt, #051 it number 3008 FO MOVX @DPTR, A 3004 E8 MOV A, Ro 2" number L 3000 80 FE SJMP 300C 3005 29 ADD A. ¢- A, RI It at 3012 address will be 04H 3006 90.30 12 vadding resul ce The result al ae MOV DPTR, #3012H result It at A reg, 7 3009 MOVX@DPTR A | Mt S012 address 300A 80 FE SUMP soon 7 The result at 3012 address will be ogty i? a Subroutines & Sample Progra es Na Gubroutines & Sample Programs i SO31/51 HEX User's Manu& Program-15 Multiplecation of 2 nos. and stored result at 3012 address Address Code Comments Label Mnemonic Operand 3000 78 03 MOV RO, #03H 1° number 3002 79 02 MOV Ri, #02H :2"° number “ 3004 E8 MOV A, RO 3005 89 FO MOV B, R1 3007 Ad MUL AB ; Mmultiplecation 3008 90 30 12 MOV DPTR, #3012H —:mul, result at 3012 add. 300B FO MOVX @DPTR, A 300C 80 FE SJMP 300C. The result at 3012 address will be O6H Program-16 Example to demonstrate the workin: 8031/51 Microcontroller Kit. Program to add two hexadecimal number stored in accumulator and registe! respectively and obtaining the result in accumulator with full speed executi¢ under the effect of software breakpoint. : ig and importance of software breakpoint Address Code Label Mnemonic Operand Comments 2000 74 25 MOV A, #25H ie eee i 2002 7A 34 MOV Ra, #34H 2 number 2004 2A ADD A, Re f sadding R2 with A Setting of software breakpoint to examine il i the result i or examine any other register while executing the pone tal earn oo Subroutines & Sample Progra’? a Ww 8031/51 HEX User's Manual For setting of point we must follow the below procedure : 1. Disable the previous breakpoint SHIFT > DISBR => FILL 2. Clear the breakpoint SHIFT -> CLRBR--> FILL 3. Enable the breakpoint SHIFT --> ENBR --> FILL 4. Setting of breakpoint at desired address SHIFT --> SETBR --> e ~> FILL im which is A=59H Fe the result after execution of the above prograt (oH Poe 59H) software breakpoint can be set at 2005 memory address as follows : SHIFT -> SETBR --> <2005> > FILL Now executing program in full speed mode through GO command and examining the content of accumulator, it gives 59H (the desired result). * Breakpoint can be set at any other address also. 39 Subroutines & Sample Programs The pin details of the various connect DETAILS OF CONNECTORS BUS CONNECTOR-cN1 The address data and sol connector. The details of lors are given here for your reference. PINS SIGNALS PINS SIGNALS. +5V 2 +5V i 4 GND A03 6 AD7 ae 8 AD6 fos 10 ADS ADO . avi A? 14 AIS AG ie aa oS 18 A13 > 20 At2 wo 20 Att A2 24 A10 At Pe ao 28 AB WR 30 AD Ne . #2 i u NC ALE fig ALE 38 7 40 42 44 46 48 50. al me of the control lines of the 8031 are brought out att 1 these are given below: 5, Sf, v i a & 8&8 Ss 8031/51 HEX User's Manual POWER CONNECTOR-CNS PINS SIGNALS RON -12V +12V GND +5V TIMER (8253) CONNECTOR-CN2 PINS SIGNALS. PINS SIGNALS 1 GATEO 2 GND 3 OUTO 4 OUT1 5 CLKO 6 GATE1 7 GATE2 8 CLK 9 OUT2 10 CLK2 PPI (8255-1) CONNECTOR-CN3 The W/O lines are brought out at this connector. Pin details are given below: PINS SIGNALS PINS SIGNALS 1 4PC4 2 1PC5 3 1PC2 4 APC3 5 1PCO 6 1PC1 7 1PB6 8 1PB7 9 1PB4 10 1PBS a] 4PB2 12 1PB3 13 1PBO 4 1PBt 15 1PA6 16 41PA7 17 1PA4 18 1PAS 19 {PA2 20 APA3 2 1PAO 22 1PA1 4PC6 24 4PC7 a GND. 26 GND. Details of Connectors PPI (8255-11) CON! NECTOR-CN4 8031/51 HEX User's Manus [PINs | _ SIGNALS Pins | SIGNALS i fa 2Pca a 3 | 2Pc2 a | os | 5 2PC0 6 2PC le ; 2PBG 8 al 8 2PB4 10 2PB5 it 2pB2 12 2PB3 2PB0 14 5 2Pag 16 ee 7 2PAs 18 om 19 2pa2 20 eens x ale 2 2PA3 23 2Pc6 oes ree % 2PC7 RS-232 CONNECTOR-CN6 a PINS SIGNALS | Pins | | PINS SIGNALS 45 3 ™ : al op 4 pTRC : mee 6 DsAC : ns 8 cTsc a | a a Details of Connector™ @ ee a 7 \a \e\"0 \9 (9 iF wor lw ir iy 2 » » SOFTWARE PACKAGES COMMUNICATION BETWEEN PC & VIMC-8031 KIT THROUGH HYPER TERMINAL IN WINDOWS 98/2000/XP a) Connect the serial port of PC with the D type Connector of the RS-232-C at CN6 Connector of kit. b) Press serial key on kit keyboard. c) Press the required key from the table given below: Key to be pressed | Baud rate selected 0 19200 1 9600 3 4800 7 2400 F 1200 Press FILL key. A message SEr will be displayed on the Seven Segment display of kit and if the computer/terminal is also set at the same baud rate, a message: VMC-51> SERIAL COMM. COMMAND> appears on the computer screen. After loading HYPER TERMINAL, set the parameters as shown in the table d e) below: PARAMETERS TO SET | COMMANDS TO GIVE (HYPER TERMINAL) SPEED 4800 BAUDRATE SP 4800 DUPLEX MODE FULL DU FULL PARITY NONE PA NONE STOP BITS 1 Si | DATA BITS 8 DA 8 CWAIT DELAY 20 cw 20 LwalT DELAY 20 lw 20 EMLATION NONE EM _NONE Software Packages 8031/51 HEX User's Manu J : » Your PC & Kit are now linked for communication and all your instructions Cal now be operated from your PC Keyboard. : All serial commands mentioned in this chapter will be fed through PC Keyboard Uploading & Downloading can also be done through this Kit. a Ds LS) UPLOADING Ls ~~ 2034 HYPER TERMINAL provides a feature by which the data stored in vac up 8051/89C51 can be stored in the floppy diskette of PC/XT/AT. This 4. achieved by following the instructions given as below: J : tes * After loading the HYPER TERMINAL and setting the desired parameter 1 following message is displayed on the screen of PC 5) VMC-51> SERIAL COMM. > ce COMMAND» _ After this message uploading can be proceeded as follows : {~ a) Write UP Dy b) Select Traster from the Menu bar and select Capture Text. ©) Now itwill ask for a file name from which you want to save your hex file. Givé- 7 any name such as TEST and press .then press from the d) Address range which was set at the be. along with the data. e) Now again select Transfer option from Menu and then select Capture Tex’) and then press . 4 Transfer --> Capture Text --> Stop fl f) The data captured is now store in the file, defined b il ‘ . y the file nar Thy, and uploading is complete. ime (TEST gining will be displayed on the scree! p v The following procedure is to be adopted for downloading the above file from PC ‘ f VMG-8031/8051/89C51. 7 The DL'¢ mmand loads the data from your diskette to the memory of the Kit! 0 sat a 8031/51 HEX User's Manual a) Write ‘DL’. b) Select Transfer from the Menu bar and select Transfer Text. c) Select the desired Hex file (Program you want to download in trainer kit and press d) The desired hex file is downloaded into the trainer kit from your PC. e) The program stored in the file will be loaded into memory of your kit at the adress specified in the program. EG Software Packages | 8031/51 HEX User's Manual APPENDIX MNEMONIC BYTE cyc INSTRUCT, b 1ON a SUBB A\An 1 1 S THAT AFFECT FLAG SETTINGS, SUBB Adirect 2 1 SUBB_ A,#data 2 1 IN . STRUCTION FLAG - INC OA ji 1 cy ov AC i INC @Ri 1 1 z r 5 Sp INC Ra 1 1 x . Bice INC DPTR 1 1 x Z TH INC direct 2 1 0 x a b. DEC A 1 1 0 a ¥y DEC @Ri 1 1 x a => DEC Rn 1 1 | DEC direct 2 1 x - MUL AB 1 4 x 5 DV AB 1 4 Fi ry DAA 1 1 Sy 9 rt LOGICAL OPREATIONS x 3 = x ‘f MNEMONIC BYTE | cYc x ry ANL A@Ri 1 1 x iD ANL An 1 1 Mo\ a 80 V Cbit x Th ANL — Adirect 2 1 51 INS x zi ANL — Aydata 2 1 T ‘ RUCTION SET 4 ANL — direct,A 2 1 ARITH oa ANL direct,#data 3 2 METIC OPERATIONS . oS ORL A@Ri 1 1 7? 1 1 AD : ORL ARn ADD A,@RI | eve] XC. S ORL Adirect 2 1 App Rn u 1 i ORL Avdata 2 1 ADD Adirect 1 1 a ORL — direct,A 2 1 ADDC Agel? : ' a ORL direct#tdata 3 2 A /@Ri : Fl Fi Apne ARn 1 { XALA@RI : ' ADD A.direct 1 1 7 XRL ARN Buea data 2 1 ss A,QRi 2 1 4 1 a & 3g 3s 3 x & = ‘Appendix -A 48 MNEMONIC BYTE cyc XRL Adirect 2 1 XAL Atdata 2 1 XRL — direct,A 2 1 XPL direct,#data 3 2 cR OA ; i = 1 1 ft A 1 1 A OA 1 4 = 7 1 1 ae 1 1 Sune 8 1 1 DATA TRANSFER ———— BYTE cyc MOV A@RI 1 : MOV ARN : MOV Adirect 2 ! Mov Adfdata ; ' Mov @RIA : : oy @Ri,direct 2 “ OV @Rij#data 2 ; es RA OV Rndirect MOV Rnitdata 2 2 iy directa 2 1 ea direct @Ri : ' a direct, Rn . . a direct direct 3 - cay direct,#data 3 7 Mov DPTR stdatarg : ' C A@AsDPTR MOVC _A@asPc 1 2 8031/51 HEX User's Manual MNEMONIC BYTE cYC MOVX. MOVX MOVX MOVX. PUSH POP XCH xCH XCH XCHD. A@Ri A@DPTR @RI,A @DPTRA direct direct A@Ri A,Rn A,direct A,@Ri anweanynaaaa aaa wynnnwyn BOOLEAN VARIABLE MANIPULATION BOOLEAN VARAEEeee—Eerer— Eee MNEMONIC BYTE_| CYC GR ¢ 1 1 SETB C 1 1 Cel. C 1 1 CLR bit 2 1 SETB bit 2 1 CPL obit 2 1 ANL Cit 2 2 ANL Cit 2 ; ORL = Ghbit 2 5 ORL = Cybit 2 ; Mov G,bit 2 , MOV bit, 2 ROGRAM AND M PI IACHINE CONTROL PROGRAM AND MACHINE SS cyc MNEMONIC BYTE 1 Nop 1 RET 1 . RETI 1 Ee Appendix -A MNEMONIC BYTE CYC ACALL addri1 = 2 AJMP = addr11 2 & LCALL addrié6 3 2 LUMP addri6 3 2 SJMP rel 2 2 JMP — @A+DPTR 1 2 DJNZ — Rnyrel 2 2 DJNZ — direct,rel 3 2 Z rel 2 2 JNZ rel 2 2 JC rel 2 2 UNC tel 2 2 JB bit,rel 3 2 JNB bit,rel 3 2 JBC bityrel 3 2 CINE Airect,rel 3 2 CJNE A,#data,rel 3 2 CJNE @Ri,#data,rel 3 2 CJNE__Rni#data,rel 3 2 SPECIAL FUNCTION REGISTER 8031/51 HEX User's Manuc= Register (MSB) Symbol or | te | ts | mw | ts | me | om |g” address ress r Po | Pos | pos | pos | pos | poz | os | poo | aoniiony e 81H(129) be 82H(130) ee 83H(131) cro | po | we} az POON = | WE] GF | cro} pp | ine ora 99) 7 Tro | TRO} tet | m1 | to | ito ; twoo | Gatel ct Tow | wo Toate! ot | om | mo pty 27 TLO " BAH(138) 88H(139) 8CH(140) Appendix - see ee O'2'2'2'9 FU DDD Ov 22 2 DB ® ® 8031/51 HEX User's Manuat Register | (LSB) Byte ‘Symbol bs te bt to Address THI 8DH(141) Pt P16 | P12 | T2EX | T2 oe SCL cai | CTI | cTol ‘SCON shi ase | i | al | ‘SBUF P2 P26 | P25 | P24 | P23 | P22 | Pai | P20 OAQH(208) IE — | ere | es | em | ext | eto | exo | oAgh(168) * ENO ead | est | eso | ert | ext | ero | exo | oasH(t68) + CMLO QASH(169) + CML OAAH(170) + CML2 OABH(171) + CTLO OACH(172) + CTL OADH(173) + cre OAEH(174) + CTL3 OAFH(175) P3. AD | WR | Tt | TO | INTI | INTO | TXD | AXD | OBOH(176) Ip — | — | pre | ps | pri | Pxt | Pro | PxO | OBsH(1e4) * IPO — PAD PS1 PSO PT PX1 PTO | PXO OBSH(184) + Pa cwmi | cao |emsrs|cMsra|cmsRs|cMsr2|cMsRi|cMSRO| 0COH(192) + PS aoc? | apes | apes | adc | apcs | ADC2 | ADCt | ADCO | OC4H(196) + ADCON |ADC.1 |ADC.0 | ADEX | ADC! | ADCS |AADR2 |AADR1 |AADRO | OCSH(197) + ADCH oceH(198) T2CON TF2 | EXF2 | RCLK | TCLK |EXEN2| TR2 | C/T2 |CP/RL2) OC8H(200) * TM2IR toov | cmi2 | cuit | cmio | cts | cTi2 | ctl | CTIO | oC8H(200) + CMHO 0CSH(201) RCAP2L OCAH(202) + CMH OCAH(202) RCAPZH ocBH(203) + oMH2 OCBH(203) ie osctie mn OCDH(205) + cmH OCDH(205) OCEH(206) a OTHE OCFH(207) + CTH3 Psw cy | aC | FO | ASI | RSO | OV | FL | P| ODOH(208) + 1S1CON ensi | sta | sto} si | AA | cAI i aa z sista | sca | sca | sce | scr 1 sco} 0 | 0 ODAH(218) : an SLAVE ADDRESS ~ ODBH(219) EG “Appendix -A ' & —_ Reaster | ws : c wef SOT ete eee | to | ites] be | pases | —O ACC o- cre | ery, | A008] Ace) Accs] acc.a] acc.2] acc.1] acco ceo) «| gy + TM2CON ae ECM2 | ECM1 | EcMo| ECT3 | Ect2 | ECT1 | ECTO 0E8H(232) q * GHzcON) Tals] Taso} rzeR | Taeo | taPt | rapo |ewsi} r2mso| OEAHR) | -M® tag | 8! She! copa! Gan | cr | crea! rr oesHi2) | f oe 0ECH(236) » ce | oevriea7) |S oo rar Tess | spas | seus | spea | spaz | spar | sPu0 | oBeHe3) a e a7 | TP | nPss | Reue| apes | nao | pat | RPao | SEFHSS ( + IPL fa 86] 85 | a4 | Bs | a2 | Bt ei oFOH(240) 2 + PWMO. Pew2! pew! pemo! pers! pct2 | pcti | pcto oranioas) | cone oFCH(252) a ee oFDH(259) { = ores) | NOTES: > 1. “denotes the dit re le 2. + denot difference between 80C552 and 8051 : es the addition of 80C552 i cf n JUMPER SELECTION Ct 2D Fi ro ‘or C i 7 ‘ommunication 2 my For os in = For ‘ va SID/SOD - 456) | (7 > 1 ‘ ‘o i 7 Mt 8031/51 HEX User's Manual 89C51/52 PROGRAMMER (OPTIONAL) The on-board 89C51MICRO CONTROLLER (MC) Programmer provides the follow- ing useful commands. 1. BLANK CHECK 4. VERIFY 2, DUPLICATE 5. READ 3. ERASE 6. LOCK BLANK CHECK The command is used to check whether the MICRO CONTROLLER (MC) in the Zero insertion force socket (ZIF socket) is blank or not. If the MICRO CONTROL- LER (MC) is completely blank, a terminator sign ‘(—)' is displayed. If the MICRO CONTROLLER (MC) is not biank then all the address of the location which are containing data are displayed. Syntax P.PRG <3 > Syntax P.PRG <1 > <> VERIFY This command is used to verify data lying in the MICRO CONTR s of RAM> NEXT> in any area of VMC-51M with the ata lyin ine en » plugged in the ZIF socket. OLLER (MC) Syntax IEXT> P.PRG <2 > <7 See eee 89C51/52 Programmer 3 a - z 8031/51 HEX User's Manual READ — 2 os [a ——— This command / 9C51/52 PROGRAMMER (OPTIONAL) Pe land is used to read the contents of the MICRO CONTROLLER (MC! o v | Placed on the ZIF socket and store in the RAM area as required by the user. MC-8031/8051/89C51 provides an on board programmer for 89C51/52 syntax quir y > Microcontroller chips of ATMEL make. P.PRG <5 > the following functions can be performed on the 89C51/52. Put Microcontroller in : Soe arti = ' CONTROLLER (MC)> “NOXTo ssa MC> — eee ERASING 2. Programming This comi : = 8) Blank Checking essful excutetion this (-) displ 7 f lay. 6. Re Syntax play =) ‘eading P.PRG The description of how to use above functions are given follows: C 5 1. Erasing This command i ' ‘ior Press key of Kit, Select will display on Seven Segment Display this (—) diepay, 10 locking the programmer Alter the successful excl 5 of kit, Press <0> key of kit. "=" will come on kit. Syntax » 2. Programming | PPRG <4><05 Press key of Kit. Select will display on Seven Segment Display \ of kit. t Press <1> key of kit then Write starting address of RAM. | n Press key then ending address of RAM then starting address of » Microcontroller. On pressing key address will increase by FF byte on z address field of kit. After sometime "-" will come on kit. t » 3. Verifying | Press key of Kit. Select will display on Seven Segment Display 9 of kit. i f Microcontroller. 58 <2> key of kit then Write starting address of » ie ee key then ending address of Microcontroller then starting Y i 7 ." will come on kit. » dress of RAM. On pressing key. After sometime "=" Wl ss —89051/52 Programmer 2 prog cl 89C51/5 Co tti‘(“‘«‘té«~*s it RL es ;® ¢ seor's MOTI 3031/51 HEX User's Mant ee EK 4, Blank Checking Press key of Kit. Select will display on Seven Segment DisPl Press <3> key Press key of Kit. Select will display on Seven SegTe" ‘ey of kit the: t> key M. O: : er. i n Write starting address of Microcontroll ng 2 ¥ then ending address of Microcontrol er " Pressing key. After sometime "=" W! ee Savevuvsy deve ATMEL Make Microcontroller Starting Address 0000 0000 End Address OFFF 1FFF exveeceseeTee 8031/51 HEX User's Manual ure 2255-1 enan| || |oiseA e F ust DEF DBF Som ut leur! DEPT c 8 IseTsR HEX KEYBOARD DSP ons 60. eto] FILL SHIFT} Senta ‘ADDRESS: DSA 55-1 A P.PRG| INSD leu.00| 'Bu.oP| NeXT DPE KEYBOARD, st PRE RESET] IEXREG PME! ExME em.pP| lus Jus w BATTERY BACKUP! p p oe rr Q h i cn. ae Jae STC INTERFACE REALTIME CLOCK, pa ure ar VMC-31/51P_ 8 a ct Se ae a ae vow |__] [ TE vee J MEMORY AREA AMERICOUNTER dk l i 7 MANIVYL MITIONLN + no 20 20 1s Oe | cn Block Diagram

You might also like