System Program Developments of 8051 Program Structure and

  • Slides: 48
Download presentation
System & Program Developments of 8051 ® Program Structure and Design ® Introduction ®

System & Program Developments of 8051 ® Program Structure and Design ® Introduction ® Advantages and Disadvantages of Structured Programming ® The Three Structures: statements, loops, choice ® Pseudo Code Syntax ® Assembly Language Programming ® Tools & Techniques for Program Development The Development Cycle ® Integration and Verification ® Command Environments ® 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 1

Introduction ® Structured Programming: ® Organizing and coding programs that reduces complexity, improves clarity,

Introduction ® Structured Programming: ® Organizing and coding programs that reduces complexity, improves clarity, and facilitates debugging and modifying ® All programs may be written using only three structures: statements, loops, and choice—too good to be true. ® Introduce Structure programming to assembly language programming Flowcharts ® Pseudo code ® Assembly language ® 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 2

Flowcharts Decision block Off-page connector Process box Predefined process (subroutine) Input/Output block Program flow

Flowcharts Decision block Off-page connector Process box Predefined process (subroutine) Input/Output block Program flow arrow Program terminator 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 3

Pseudo Code ® Strict adherence to structure in combination with informal language ® [get

Pseudo Code ® Strict adherence to structure in combination with informal language ® [get a character from the keyboard] ® IF 2021/5/20 [condition is true] THEN [do statement 1] ELSE BEGIN [do statement 2] [do statement 3] END T. L. Jong, Dept. of E. E. , NTHU 4

Advantages & Disadvantages of Structured Programming ® Advantages: ® Simple to trace, debug ®

Advantages & Disadvantages of Structured Programming ® Advantages: ® Simple to trace, debug ® Finite number of structures ® Structures as building block ® The set of structure is complete ® Structures are self-documenting, easy to read ® Structures are easy to describe in flowcharts, syntax diagrams, pseudo code, . . ® Increased program productivity 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 5

Advantages & Disadvantages of Structured Programming ® Disadvantages: ® Only a few high-level languages

Advantages & Disadvantages of Structured Programming ® Disadvantages: ® Only a few high-level languages (Pascal, C, PL/M) accept the structures directly; others require extra translation stage ® Structured program may execute slower and require more memory ® Some problems (a minority) are more difficult to solve using only the three structures ® Nested structures can be difficult to follow 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 6

The Three Structures ® Statements ® [count = 0] ® PRINT_STRING(“Select Option: ”) ®

The Three Structures ® Statements ® [count = 0] ® PRINT_STRING(“Select Option: ”) ® Loops (iteration) ® WHILE/DO ® REPEAT/UNTIL ® Choice ® IF/THEN/ELSE ® CASE 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 7

The WHILE/DO Statement ® WHILE [condition] DO [statement] (statement might not be performed at

The WHILE/DO Statement ® WHILE [condition] DO [statement] (statement might not be performed at all!) Enter Condition True? WHILE [c == 1] DO [statement] No ENTER: STATEMENT: Yes Statement 2021/5/20 Exit EXIT: T. L. Jong, Dept. of E. E. , NTHU JNC EXIT (statement) JMP ENTER (continue) 8

WHILE/DO: SUM Subroutine [sum (A) = 0] WHILE [length (R 7) > 0] DO

WHILE/DO: SUM Subroutine [sum (A) = 0] WHILE [length (R 7) > 0] DO BEGIN [sum = sum + @pointer (R 0)] [increment pointer] [decrement length] END 8051 code (closely structured; 13 bytes) (loosely structured; 9 bytes) SUM: CLR A LOOP: CJNZ R 7, #0, STAM JMP EXIT STAM: ADD A, @R 0 INC R 0 DEC R 7 JMP LOOP: EXIT: RET SUM: 2021/5/20 CLR INC MORE: DJNZ RET SKIP: ADD INC SJMP T. L. Jong, Dept. of E. E. , NTHU A R 7, SKIP A, @R 0 MORE 9

WHILE/DO Pseudo code: WHILE [ACC != CR AND R 7 != 0] DO [statement]

WHILE/DO Pseudo code: WHILE [ACC != CR AND R 7 != 0] DO [statement] Enter ACC != <CR>? 8051 code: ENTER: No Yes R 7 != 0? No Yes Statement 2021/5/20 Exit CJNE A, #0 DH, SKIP JMP EXIT SKIP: CJNE R 7, #0, STAM JMP EXIT STAM: (one or more statements). . JMP ENTER EXIT: (continue) T. L. Jong, Dept. of E. E. , NTHU 10

The REPEAT/UNTIL Statement ® REPEAT [statement] UNTIL [condition] (statement performed at least once) Enter

The REPEAT/UNTIL Statement ® REPEAT [statement] UNTIL [condition] (statement performed at least once) Enter REPEAT UNTIL [statement] [c == 1] Statement No Condition True? ENTER: (statement) JNC ENTER EXIT: (continue) Yes Exit 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 11

The REPEAT/UNTIL Statement ® REPEAT UNTIL [ACC = @pointer] [increment pointer] [ACC == ‘Z’

The REPEAT/UNTIL Statement ® REPEAT UNTIL [ACC = @pointer] [increment pointer] [ACC == ‘Z’ or ACC == 0] Enter 8051 code: Get a char Inc pointer No Char = “Z”? Yes No STAM: MOV INC JZ CJNE EXIT: RET A, @R 0 EXIT A, #’Z’, STAM Char = 0? Yes Exit 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 12

The IF/THEN/ELSE Statement ® IF [condition] THEN [statement 1] ELSE [statement 2] Enter No

The IF/THEN/ELSE Statement ® IF [condition] THEN [statement 1] ELSE [statement 2] Enter No condition true? Statement 2 Yes Statement 1 Exit 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 13

The IF/THEN/ELSE Statement [input character] IF [input character == graphic] THEN [echo character] 8051

The IF/THEN/ELSE Statement [input character] IF [input character == graphic] THEN [echo character] 8051 code: ELSE [echo ‘. ’] Enter Input character No Graphic char? Echo “. ” Echo char Exit 2021/5/20 Yes (closely structured; 14 bytes) ENTER: ACALL INCH ACALL ISGRPH JNC STMENT 2 STMENT 1: ACALL OUTCH JMP EXIT STMENT 2: MOV A, #’. ’ ACALL OUTCH EXIT: (continue) (loosely structured; 10 bytes) ACALL INCH ACALL ISGRPH JC SKIP MOV A, #’. ’ SKIP: ACALL OUTCH (continue) T. L. Jong, Dept. of E. E. , NTHU 14

The CASE Statement Enter CASE [expression] OF 0: [statement 0] 1: [statement 1] 2:

The CASE Statement Enter CASE [expression] OF 0: [statement 0] 1: [statement 1] 2: [statement 2]. . N: [statement 0] [default] END_CASE expression No 0? 1? 2? Yes Statement 0 Yes Statement 1 Yes Statement 2 expression n? No Yes Statement n default Exit 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 15

The CASE Statement [input a character] CASE [character] OF ‘ 0’: [statement 0] ‘

The CASE Statement [input a character] CASE [character] OF ‘ 0’: [statement 0] ‘ 1’: [statement 1] ‘ 2’: [statement 2] ‘ 3’: [statement 3] END_CASE Enter Input character char == “ 0”? Yes Action 0 No char == “ 1”? Yes Action 1 No char == “ 2”? No Yes Action 2 char == “ 3”? No Yes Action 3 Exit 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 16

The CASE Statement 8051 code: (closely structured) ACALL INCH CJNE A, #’ 0’, SKIP

The CASE Statement 8051 code: (closely structured) ACALL INCH CJNE A, #’ 0’, SKIP 1 ACT 0: . . JMP EXIT SKIP 1: CJNE A, #’ 1’, SKIP 2 ACT 1: . . JMP EXIT SKIP 2: CJNE A, #’ 2’, SKIP 3 ACT 2: . . JMP EXIT SKIP 3: CJNE A, #’ 3’, EXIT ACT 3: . . EXIT: 2021/5/20 (continue) (loosely structured) ACALL INCH ANL A, #3 ; reduce to 3 bits RL A MOV DPTR, #TABLE JMP @A+DPTR TABLE: AJMP ACT 0 AJMP ACT 1 AJMP ACT 2 ACT 3: . . JMP EXIT ACT 0: . . JMP EXIT ACT 1: . . JMP EXIT ACT 2: . . EXIT: (continue) T. L. Jong, Dept. of E. E. , NTHU 17

The GOTO Statement GOTO statement can always be avoided by using the structures. Sometimes

The GOTO Statement GOTO statement can always be avoided by using the structures. Sometimes GOTO statement provides an easy method of terminating a structure when errors occur. ® GOTO statements usually becomes unconditional jump in assembly implementation. Extreme caution is needed. ® Never exit a subroutine using GOTO instead of normal return for the return address will be left on the stack and eventually stack overflow will occur. ® 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 18

Pseudo Code Syntax Tips of using pseudo code: ® Use descriptive language for statements

Pseudo Code Syntax Tips of using pseudo code: ® Use descriptive language for statements ® Avoid machine dependency in statements ® Enclose conditions & statements in brackets: [] ® Begin all subroutines with their names followed by a set of parameters: () ® End all subroutine with RETURN () ® Use lower text except reserved words & subroutine names ® Indent all statements from the structure entry points and exit points ® Use the commercial at sign (@) for indirect addressing 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 19

Suggested Pseudo Code Syntax Reserved words: BEGIN END REPEAT UNTIL WHILE DO IF THEN

Suggested Pseudo Code Syntax Reserved words: BEGIN END REPEAT UNTIL WHILE DO IF THEN ELSE CASE OF RETURN Arithmetic operators: + addition subtraction * multiplication / division % modulus (remainder after division) 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 20

Suggested Pseudo Code Syntax Relational operators: == true if values equal to each other

Suggested Pseudo Code Syntax Relational operators: == true if values equal to each other != true if values not equal to each other < true if first value less than second <= true if first value <= second > true if first value > second >= true if first value >= second && true if both values are true || true if either value is true Bitwise Logical operators: & logical AND | logical OR ^ logical XOR ~ logical NOT (one’s complement) >> logical shift right << logical shift left 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 21

Suggested Pseudo Code Syntax Assignment operators: = set equal to op = assign operator

Suggested Pseudo Code Syntax Assignment operators: = set equal to op = assign operator shorthand where “op” is one of + - * / % << >> & ^ | Precedence operators: () Indirect addressing: @ 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 22

Suggested Pseudo Code Syntax Operator Precedence: () ~ * + << < == &

Suggested Pseudo Code Syntax Operator Precedence: () ~ * + << < == & ^ | && || = 2021/5/20 @ / >> <= != += % > >= -= *= /= etc T. L. Jong, Dept. of E. E. , NTHU 23

Suggested Pseudo Code Syntax Structures: Statement: [do something] Statement block: BEGIN [statement] END WHILE/DO:

Suggested Pseudo Code Syntax Structures: Statement: [do something] Statement block: BEGIN [statement] END WHILE/DO: WHILE [condition] DO [statement] 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 24

Suggested Pseudo Code Syntax CASE/OF: REPEAT/UNTIL: REPEAT [statement] UNTIL [condition] IF/THEN/ELSE: IF [condition] THEN

Suggested Pseudo Code Syntax CASE/OF: REPEAT/UNTIL: REPEAT [statement] UNTIL [condition] IF/THEN/ELSE: IF [condition] THEN [statement 1] (ELSE [statement 2]) 2021/5/20 CASE [expression] OF 1: [statement 1] 2: [statement 2] 3: [statement 3]. . n: [statement n] [default] END T. L. Jong, Dept. of E. E. , NTHU 25

Assembly Language Programming Labels Use labels that are descriptive of the destination they represent

Assembly Language Programming Labels Use labels that are descriptive of the destination they represent Comments Use comments wherever possible Comment conditional jump instructions using a question similar to the flowchart Comment Blocks At the beginning of each subroutine: name of the sub, operations, entry conditions, exit conditions, name of other subroutines used, name of registers affected, etc. 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 26

INLINE SUBROUTINE EXAMPLE ; ******************************************** ; ; INLINE INPUT LINE OF CHARACTERS ; LINE

INLINE SUBROUTINE EXAMPLE ; ******************************************** ; ; INLINE INPUT LINE OF CHARACTERS ; LINE MUST END WITH <CR> ; MAXIMUM LENGTH 31 CHARACTERS INCLUDE <CR> ; ; ENTER: NO CONDITIONS ; EXIT: ASCII CODES IN INTERNAL DATA RAM ; 0 STORED AT END OF LINE ; USES INCHAR, OUTCHR ; ; ******************************************** INLINE: PUSH 00 H ; SAVE R 0 ON STACK PUSH 07 H ; SAVE R 7 ON STACK PUSH ACC ; SAVE ACCUMULATOR MOV R 0, #60 H ; SET UP BUFFER AT 60 H MOV R 7, #31 ; MAX LENGTH OF LINE STMENT: ACALL INCHAR ; INPUT A CHARACTER ACALL OUTCHR ; ECHO TO CONSOLE MOV @R 0, A ; STORE IN BUFFER 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 27

INLINE SUBROUTINE EXAMPLE INLINE: STMENT: SKIP: EXIT: 2021/5/20 PUSH MOV ACALL MOV INC DEC

INLINE SUBROUTINE EXAMPLE INLINE: STMENT: SKIP: EXIT: 2021/5/20 PUSH MOV ACALL MOV INC DEC CJNE SJMP CJNE MOV POP POP RET 00 H 07 H ACC R 0, #60 H R 7, #31 INCHAR OUTCHR @R 0, A R 0 R 7 A, #0 DH, SKIP EXIT R 7, #0, STMENT @R 0, #0 ACC 07 H 00 H ; SAVE R 0 ON STACK ; SAVE R 7 ; SAVE ACCUMULATOR ; SET UP BUFFER AT 60 H ; MAX LENGTH OF LINE ; INPUT A CHARACTER ; ECHO TO CONSOLE ; STORE IN BUFFER ; INC BUFFER POINTER ; DEC LENGTH COUNTER ; IS CHAR = <CR>? ; YES, EXIT ; NO, GET ANOTHER CHAR ; END WITH NULL CHAR ; RESTORE REGISTERS FROM ; STACK T. L. Jong, Dept. of E. E. , NTHU 28

INLINE SUBROUTINE EXAMPLE ; ********************************************** ; INCHR INput CHa. Racter from serial port ;

INLINE SUBROUTINE EXAMPLE ; ********************************************** ; INCHR INput CHa. Racter from serial port ; enter: no condition ; exit: ASCII code in ACC. 0 to ACC. 6; ACC. 7 cleared; ctrl-C aborts ; to prompt ; ********************************************** INCHR: JB X 13_BIT, IN 1 ; if x 13 installed, use interrupt flag RI JNB r_flag, $ ; wait for receive_flag to be set CLR ET 1 ; begin “critical section” CLR r_flag ; >>> clear receive_flag and… MOV A, r_buff ; >>> read receive_buffer SETB ET 1 ; end critical section SJMP IN 2 ; ; if x 13 is not installed, test RI flag IN 1: JNB RI, $ ; wait for receive interrupt RI CLR RI ; clear RI flag MOV A, SBUF ; done! IN 2: CLR ACC. 7 ; clear parity bit (o error checking) CJNE A, #ETX, IN 3 ; if ctrl-C, JMP GETCMD ; warm start IN 3: RET 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 29

INLINE SUBROUTINE EXAMPLE ; ********************************************** * ; OUTCHR - OUTput CHa. Racter to serial

INLINE SUBROUTINE EXAMPLE ; ********************************************** * ; OUTCHR - OUTput CHa. Racter to serial port with odd parity added in ; ACC. 7 ; enter: ASCII code in ACC ; exit: . Character written to SBUF; <CR> sent as <CR><LF>; all ; registers intact ; ********************************************** * RSEG EPROM OUTCHR: PUSH A NL: MOV C, P ; if x 13 installed, use interrupt flag RI CPL MOV JB JNB CLR MOV SETB SJMP 2021/5/20 C ACC. 7, C X 13_BIT, OUT 1 t_flag, $ ET 1 t_flag t_buff, A ET 1 OUT 2 ; add odd parity ; if x 13 installed, use interrupt ; wait for transmitter ready ; begin “critical section” ; >>> clear flag and … ; >>> load data to transmit ; end critical section ; T. L. Jong, Dept. of E. E. , NTHU 30

INLINE SUBROUTINE EXAMPLE OUTCHR: NL: OUT 1: OUT 2: OUT 3: OUT 4: 2021/5/20

INLINE SUBROUTINE EXAMPLE OUTCHR: NL: OUT 1: OUT 2: OUT 3: OUT 4: 2021/5/20 RSEG EPROM PUSH A MOV C, P CPL C ; add odd parity MOV ACC. 7, C JB X 13_BIT, OUT 1 ; if x 13 installed, use interrupt JNB t_flag, $ ; wait for transmitter ready CLR ET 1 ; begin “critical section” CLR t_flag ; >>> clear flag and … MOV t_buff, A ; >>> load data to transmit SETB ET 1 ; end critical section SJMP OUT 2 ; ; if x 13 is not installed, test TI flag JNB TI, $ ; wait for transmitter ready CLR TI ; clear TI flag MOV SBUF, A ; done! CLR ACC. 7 ; remove parity bit CJNE A, #CR, OUT 3 ; if <CR>? MOV A, #LF ; yes, add <LF> and send it JMP NL ; warm start POP A ; no restore A and JNB p_bit, OUT 4 ; check if send to print CALL PCHAR ; yes, send to printer RET ; no, done and return T. L. Jong, Dept. of E. E. , NTHU 31

Assembly Language Programming Saving Registers on the Stack Especially for nested subroutine calls, and

Assembly Language Programming Saving Registers on the Stack Especially for nested subroutine calls, and building complex programs using subroutine building blocks. Avoid changing the working registers when returns. The Use of Equates Defining constants with equates makes programs easier o read and maintain. The Use of Subroutines Divide and Conquer – subdivide large and complex operations into small and simple operations. These small and simple operations are programmed as subroutines and used as building blocks of the large complex program. 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 32

OUTSTR SUBROUTINE EXAMPLE OUTCHR OUTSTR Enter Add odd parity To character Get a char

OUTSTR SUBROUTINE EXAMPLE OUTCHR OUTSTR Enter Add odd parity To character Get a char From string Char != 0? Enter TX buffer empty? No Yes No Clear flag Yes OUTCHR Exit Write character To transmitter Clear parity bit Inc pointer Exit 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 33

OUTSTR SUBROUTINE EXAMPLE Pseudo code for OUTCHR (char) [put odd parity in bit 7]

OUTSTR SUBROUTINE EXAMPLE Pseudo code for OUTCHR (char) [put odd parity in bit 7] REPEAT [test transmit buffer] UNTIL [buffer empty] [clear transmit buffer empty flag] [move char to transmit buffer] [clear parity bit] RETURN () Pseudo code for OUTSTR (pointer) WHILE [(char = @pointer) != 0] BEGIN OUTCHR(char) [increment pointer] END RETURN() 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 34

OUTSTR SUBROUTINE EXAMPLE ; ******************************************** ; OUTCHR: OUTPUT A CHAR IN ACC W. ODD

OUTSTR SUBROUTINE EXAMPLE ; ******************************************** ; OUTCHR: OUTPUT A CHAR IN ACC W. ODD PARITY VIA ; SERIAL PORT ; ENTER: NO CONDITION, ASCII CHAR IN ACC ; EXIT: ASCII CODE W. ODD PARITY SENT OUT & ACC. 7=0 ; ******************************************** OUTCHR: MOV C, P ; PUT PARITY BIT IN C FLAG CPL C ; CHANGE TO ODD PARITY MOV ACC. 7, C ; ADD TO CHAR AGAIN: JNB TI, AGAIN ; TX EMPTY? CLR TI ; YES, CLEAR FLAG AND MOV SBUF, A ; SEND OUT CHARACTER CLR ACC. 7 ; STRIP OFF PARITY BIT AND RET ; RETURN ; ******************************************** ; USES OUTCHR ; OUTSTR: MOV A, @DPTR ; GET CHARACTER JZ EXIT ; IF 0, DONE AND EXIT CALL OUTCHR ; OTHERWISE SEND IT INC DPTR ; INC POINTER SJMP OUTSTR 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 35 EXIT: RET

Assembly Language Programming Program Organization ® Equates ® Initialization instructions ® Main body of

Assembly Language Programming Program Organization ® Equates ® Initialization instructions ® Main body of program ® Subroutines ® Data constant definitions (DB and DW) ® RAM data locations defined using the DS directive 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 36

Tools & Techniques for Program Development The Development Cycle 2021/5/20 T. L. Jong, Dept.

Tools & Techniques for Program Development The Development Cycle 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 37

Specifying Software ® User interface: how the user will interact with and control the

Specifying Software ® User interface: how the user will interact with and control the system ® Detail system operations below the user level – independent of user interface ® Modularized system function with inter-module communication ® Interrupt driven, ISR, time-critical subroutine 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 38

Designing Software ® Flowcharts ® Pseudo code Editing and Translation ® Assemble time errors

Designing Software ® Flowcharts ® Pseudo code Editing and Translation ® Assemble time errors checking: syntax errors only 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 39

Preliminary Testing ® Run time errors will not appear until the program is executed

Preliminary Testing ® Run time errors will not appear until the program is executed by a simulator or in the target system. ® Debugger – a system program that executes a user program for the purpose of finding run-time errors. ® Debugger can set breakpoints, singlestepping, examine and modify registers, memories, etc. during program execution 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 40

Hardware Development ® Specifying hardware: assign quantitative data to system functions, physical size/weight, CPU

Hardware Development ® Specifying hardware: assign quantitative data to system functions, physical size/weight, CPU speed, memory, I/O ports, optional features, etc. ® Designing Hardware: ® breadboarding, ® wire-wrapping, ® PCB layout ® practice makes perfect 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 41

Hardware Development ® Preliminary Testing: ® Visual checks – before power applied ® Continuity

Hardware Development ® Preliminary Testing: ® Visual checks – before power applied ® Continuity checks – ohmmeter check each connecting wire, IC pin to IC pin ® DC measurements – no ICs, DC voltages varied ® AC measurements – IC installed, verify clock signals, and so on ® Functionality Testing – drive RESET w a low f (1 k. Hz) square wave, write test software or monitor program to debug each function of the hardware board 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 42

Detailed Steps in the Development Cycle 2021/5/20 T. L. Jong, Dept. of E. E.

Detailed Steps in the Development Cycle 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 43

Integration and Verification ® Hardware Software Integration test ® Software Simulation – simulator ®

Integration and Verification ® Hardware Software Integration test ® Software Simulation – simulator ® Hardware Emulation – hardware emulator or in-circuit emulator (ICE) ® Execution from RAM – effective & simple testing for software in the target system 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 44

Intel Hexadecimal Format Field Bytes Description Record mark 1 “: ” indicates start-of-record Record

Intel Hexadecimal Format Field Bytes Description Record mark 1 “: ” indicates start-of-record Record length 2 Number of data bytes in record Load address 4 Start address for data bytes Record type 2 00 = data record; 01 = end record Data bytes 0 -16 Checksum 2 2021/5/20 data Sum of all bytes in record + checksum = 0 T. L. Jong, Dept. of E. E. , NTHU 45

Intel Hexadecimal Format 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 46

Intel Hexadecimal Format 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 46

Integration and Verification ® Executing from EPROM – firmware burnt in EPROM using EPROM

Integration and Verification ® Executing from EPROM – firmware burnt in EPROM using EPROM writer ® Executing from on-chip flash (8952), EPROM (8752), EEPROM, (OTP, MTP) using Universal Programmer/Writer ® The Factory Mask ROM – for mass production ® Executing from SRAM downloaded from host into the SBC-51 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 47

The Development Environment 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 48

The Development Environment 2021/5/20 T. L. Jong, Dept. of E. E. , NTHU 48