8051-31 Microcontroller
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 UUVO 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 238031/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 Programs8031/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 Ne8031/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 eS8031/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 33Address 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 iSO31/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 ProgramsThe 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 ConnectorsPPI (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 Packages8031/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 -A48 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 -AMNEMONIC 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 Programmer3 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 then ending address of Microcontroller. On pressing come on kit. '09.> key of Kit. Select w display on Seven Segment ti "09-> 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