Weekly Class Log

Week

Date

Class activity

Part A: Assembly Programming

W01

0214

Preface

Course introduction

Lecture

Microprocessor & Microcontroller

Levels of programming languages

8051 Architecture

Introduction to 8051

8051 simulatorEdSim51 (See www.edsim51.com )

Program examples

EdSim51 examples: Example 1, 2, 3

In-class practice

ICP-A01-01: Installation of EdSim51 program

ICP-A01-02: Example 1, 2, 3

W02

0221

Lecture

8051 Memory organization.htm

8051 Address modes.htm

Number systems in microcomputers.htm

edsim51 - 7-segment display.htm

Learning of instructions and programming: RR; RL; ANL; ORL; #

Program examples

EdSim51 Example 1: Binary Pattern on the Port 1 LEDs

EdSim51 Example 2: Echoing the Switches to the LEDs

EdSim51 Example 3: Multiplexing the 7-segment Displays

In-class Practice

ICP-A02-01: One LED rotates to the right

ICP-A02-02: Two LEDs rotate in opposite directions

ICP-A02-03: 7-segment display of 89AB (from L to R) & CDEF (from R to L)

----------- Hint

W03

0228

228 Peace Memorial Day

W04

0307

Lecture

8051 - Interrupt.htm

8051 - Timer.htm

edsim51 - explanation on Example 6.htm

How to reconfigure the circuit connection (For the ICP of today) – Dynamic interface

Learning of instructions and programming: CALL; RET; RETI; ORG; $

Program examples

EdSim51 Example 5: Ramp Signal on the DAC Output

EdSim51 Example 6: Taking Samples from the ADC and Displaying them on the Scope via the DAC

In-class Practice

ICP-A03-01 : Example 6 with INT 1 and Timer 1

W05

0314

Lecture

edsim51 - hardware - component and connection

8051 - Conditional Jumps and Time Delays

8051 - Subroutines and the Stack     ( example program - stack role in subroutine call.asm ) 

8051 Address modes : indirect address mode

Learning of instructions CPL, NOP, DJNZ, CJNE, PUSH/POP, CALL(ACALL, LCALL), JMP(SJMP, AJMP, LJMP), etc.

 Learning of programming with edsim51 Rn or ARn?     A or Acc?      using 0

Program examples

Average of a Set of Numbers   (Observation: DJNZ, CJNE, & the stack.)

  (To show the advantage of the Indirect Address Mode compared with the Direct Address Mode.)

ICP-A04-prep - LED pattern rotates left.asm

ICP-A04-prep - poll to change rotation direction of LED pattern.asm

Registration

Please finish this非實名登錄

Project

Assignment

In-class Practice

ICP-A04-01 : Interrupt to change rotation direction of LED pattern.asm

W06

0321

Lecture

edsim51 - keypad

Learning of instructions and programming: ANL, ORL, “MOV @Ri,A”, 2FH.0, etc.

Program examples

EdSim51 Example 7: Scanning the Keypad

      (Note: 1. Observe the change in R0. 2. What update frequency is better? 3. Observe the content of the stack during scanning.)

ICP-A05-prep - keyPadScan as a subroutine (key numbers 3 ~ 8 go wrong).asm

ICP-A05-prep - keyPadScan as a subroutine.asm

In-class Practice

ICP-A05-01 : Scanning the keypad continuously and storing the key number (without using interrupt)    [Solution]

    (Note: This program tends to have a problem of repeatedly storing key numbers.)

ICP-A05-02 : Scanning the keypad continuously and storing the key number (without using interrupt) (preventing repeated storing)

ICP-A05-03 : keyPadScan driven by a timer interrupt       [ solution ]

W07

0328

Lecture

8051 - serial port

8051 - PSW

Learning of instructions and programming:

 

Old exams

Please finish this非實名登錄

Program examples

1. parity bit test.asm

2. EdSim51 Example 8: Transmitting Data on the 8051 Serial Port

    Note: Select “4800 Baud Rate” in the UART device.

 

    Question: In this program, what binary code is moved to SBUF when 'a', 'b', and 'c', respectively, are to be transmitted to the UART device?

    Answer:

Symbol to be transmitted to the UART device:

'a' (= 01100001Y)

'b' (= 01100010Y)

'c' (= 01100011Y)

Binary code transmitted from the processor

(Binary code moved to SBUF):

 

    Question: When you select "Even parity", "No parity", or "Odd parity" in the UART device, what symbols appear on the display of the UART device.?

    Answer:

Parity selected in the UART device:

Even parity

No parity

Odd parity

Symbols shown on the UART device:

 

Summary: Parity issue of a, b, c

 

Before running the program, set some breakpoints. Run the program and observe the TI flag when it changes to 1.

In-class Practice

ICP-A06-01 : Transmitting Data on the 8051 Serial Port - with Odd Parity

ICP-A06-02 : Transmitting Data on the 8051 Serial Port - using Interrupt

W08

0404

Children's Day.

W09

0411

Lecture

8051 - Subroutines and the Stack     ( example program - stack role in subroutine call.asm ) 

8051 - serial port

Learning of instructions and programming:

Program examples

EdSim51 Example 9: Receiving Data on the Serial Port Example 9 with clearer comment

 

    Answer the following questions with "Even parity", "No parity", or "Odd parity", respectively, in the UART device.

      Question (A): Enter "012345" in the Tx window and press "Tx Send". What data are stored in the RAM?

      Question (B): After the processor receives and stores the data, what is the value of PC?

      Question (C): Press "Tx Reset", enter additional symbols "6789" in the Tx window, and press "Tx Send". What are the additional data stored in the RAM?

    Answer:

Parity selected in the UART device:

      Even parity      

      No parity      

      Odd parity      

(A) Data stored in the RAM:

(B) PC =

(C) Additional data stored in the RAM:

 

In-class Practice

ICP-A07-01 : Numeral test (Use this template to develop your program)

ICP-A07-02 : Transmit a numeral ASCII after receiving it from serial input (at 19200 bps)

W10

0418

Lecture

edsim51 - motor

Learning of instructions and programming: MOVC, #HIGH, #LOW, etc. 

Program examples

Edsim51 Example 10 = The motor.asm

In-class Practice

ICP-A08-01 : Motor direction control with simplified instruction sequence   (Hint)

W11

0425

Midterm Exam

(Postponed)

Part B: Assembler Programming

W05

0314

Assignment

Assembler One (Mutual discussion is encouraged but plagiarization is prohibited!)

W11

0425

Demonstration

Demonstrate to a TA during any ordinary class from 03/21 to 04/25.

W12

W13

0502

0509

Turn in

Please upload your (1) Assembler program & (2) Program description

Check your turn-in status

Part CCPU Design

W11

0425

Lecture

Logisim installation

RAM in logisim

Practice using RAM in logisim

Practice building a subcircuit ALU in logisim

In-class- Practice

ICP-C01-01 Practice using RAM with "Separate load and store ports"

ICP-C01-02 Build a simple ALU

W12

0502

Midterm Exam

Style: open-book, internet-connected

Time: 18:00 ~ 20:30

Place: Rm. 223

Problem sheet

Midterm solution

Midterm score

W13

0509

Project

Please upload your (1) Assembler program & (2) Program description

Check your turn-in status

Lecture

(In-classroom/online)

Create your own library    (template)

Datapath design

After-class download: The teacher’s datapath.circ 

In-class Practice

ICP-C02-01 Practice data path design      

W14

0516

Lecture

Microprogramming

Microprogram - template ( download )

dataPath.circ & Lib ( download )

In-class Practice

ICP-C03-01 Practice for microprogram design      

W15

0523

Lecture

What is an instruction decoder?    

                   (Download A simple CPU to demonstrate the definition of instructionDecoder.circ)

Implementation of instruction decoding for our CPU design    

                   (Download   +microprogramming-2021Fall.circ from last week; ROM content for instructionDecoder lecture.)

In-class Practice

ICP-C04-01 Practice instruction decoding   

W16

0530

Lecture

Program counter for our CPU design

                   (Download+instructionDecoder-2022Spring.circ, ROM content, microinstruction template for programCounter lecture)

In-class Practice

ICP-C05-01: Finish test program 1 and 2.    

W17

0606

Activity

 

Review, Q & A, etc.

 

W18

0613

Final Exam

Style: Internet-connected, open-book

Time: 18:00 ~ 20:30

Place: Online

Scope: CPU design.   (The assembler project will NOT be included.)

 

Online Final Exam

 

W19

0620

 

Deadline to submit the semester score to school