Real-time system programs

Size: px
Start display at page:

Download "Real-time system programs"

Transcription

1 by ORV BALCOM Simple Task Scheduler Prevents Priority Inversion Here is a method of task scheduling using a single interrupt that provides a deterministic approach to program timing and I/O processing. This approach can be implemented on any microprocessor system that can generate maskable interrupts at a fixed rate and has sufficient stack space. Nance Paternoster Real-time system programs are required to perform a multitude of different tasks at different times. The program s task scheduler controls the time of activation of each task. Often, a generalpurpose real-time operating system is used. The task scheduler of most realtime operating systems assigns priorities to these tasks, allowing higher priority tasks to preempt lower priority tasks. In most applications, data must be passed between priority levels. To ensure data integrity, a system of semaphores is used to control access to the common data. This can lead to a problem referred to as priority inversion, a condition in which a low-priority task holds up a higher priority task while the lower task is using the data. This problem, as well as possible solutions, has been the focus of numerous recent articles in this magazine. Naomi Avigdor discusses the problem and gives various suggestions for dodging the issue. 1 For the more analytically inclined, Ray Obenza provides an overview of rate monotonic analysis, a tool for guaranteeing realtime performance. 2 E. Douglas Jensen, the technical director of real-time engineering at Digital Equipment Corp., states that real-time generally means real-fast. 3 What is needed, he says, is to differentiate between hard and soft deadlines for real-time computations. Hard real-time conventionally, Jensen writes, is defined as deterministic in the sense that the only critical computations are those with deadlines, and scheduling objective is that these computations must always meet their deadlines, or the system has failed. This would imply that that it is acceptable for some tasks to be missed and for the user to not know where the program is at all times. I don t know about you, but I always want to know what my programs are doing. If the program s state can always be determined (the program is deterministic), there can be no priority inversion. Do-While Jones, possibly with tongue in cheek, went to the other extreme, extolling the advantages of interrupt-free program designs EMBEDDED SYSTEMS PROGRAMMING JUNE 1995

2 Interrupt-driven designs tend to be chaotic and non-deterministic, he writes. While I agree with his statement, I think Jones has left out a very important case between no interrupts and interrupt-driven designs. There is a program designed to use a single interrupt as a timing and scheduling tool. The interrupt is generated by internal (to the CPU) or external hardware at a fixed rate. Since the interrupt is not asynchronous to the program operation, the program can be deterministic and the program s state can be known at any time. The timing of the interrupt must be based on the external asynchronous requirements of the system. Since 99.99% of real-time embedded systems, by CPU count, have only one user and are doing only one job, I contend that none of the previous complications are necessary. For all but the most complex single-user systems, you must ensure that every higher priority task runs to completion before giving control to lower priority tasks. The program state can be determined at any time. As Jensen pointed out, if there is not enough CPU horsepower, the lower priority tasks may get shorted. What is important is that the tasks, by priority, run to completion. You would think an embedded system has to have a multitasking real-time operating system. SINGLE INTERRUPT TASK SCHEDULER Most embedded real-time microcomputer programs require the handling of asynchronous inputs and outputs. This I/O must be handled in a controlled and timely manner, or elusive program bugs can occur. Real-time programs also have tasks that are synchronous to the program operation. They must be performed at fixed intervals, synchronized to program operation, and sometimes synchronized to some external repetitive input. This article examines a method of task scheduling using a single interrupt that provides a deterministic approach to program timing and I/O processing. It can be implemented on any microprocessor system that can generate maskable interrupts at a fixed rate and has sufficient stack space. While index registers are not needed, they simplify the programming of reentrant subroutines. The Z80 and MC68HC11 microprocessors meet these requirements. To look at most articles and advertisements, you would think an embedded system has to have a multitasking real-time operating system. This expectation is a holdover from the days when CPUs were expensive. In those days, mainframes and minis had operating systems that allowed multiple users at the same time. Since there was only one CPU, users had to share it. Generally, these systems allocated a portion of the CPU time to each user on a rotating basis. Instead of scheduling tasks by allocating various amounts of CPU time based on priorities, take the following approach. The program will run in a continuous timed loop, called the background loop. During each background, different tasks are performed in order, and then the program enters a tight loop until it is time to start the background again. These are the lowest priority tasks. Variations in latency will not affect program performance. Typical background tasks would perform such functions as service a display, archive data, or perform built-in test routines. JUNE 1995 EMBEDDED SYSTEMS PROGRAMMING 45

3 68HC11 STACK POINTER MOVEMENT These diagrams show the 68HC11 and Z80 stack pointers and stack contents traced through the activation of the foreground routine and its subsequent interruption. Each horizontal line represents a byte. The approaches differ, since the 68HC11 automatically stacks the registers when interrupted while the Z80 has a duplicate register set that can be used during interrupt servicing. In the following diagram for the 68HC11, PCH0, PCL0 is the return address to the interrupted background program. PCH1, PCL1 is the return address to the interrupt service routine. PCH2, PCL2 is the return address to the foreground routine after the second interrupt. Stack Pointer First interrupt Foreground and Return to interrupted Address initiated 2nd interrupt Background (Hex) 10FF < Top of Stack 10FE 10FD < Assume 4 bytes used by Background at time of 1st interrupt 10FC. < SP after return 10FB PCL0 < 1st int PCL0 PCL0 from 1st int 10FA PCH0 PCH0 PCH0 10F9 IYL IYL IYL 10F8 IYH IYH IYH 10F7 IXL IXL IXL 10F6 IXH IXH IXH 10F5 ACCA ACCA ACCA 10F4 ACCB ACCB ACCB 10F3 CCR CCR CCR 10F2 PCL1 <--JSR to--> PCL1.< SP after return from Foreground 10F1 PCH1 Foreground PCH1 10F0 10EF < Assume 3 bytes used by Foreground at time of 2nd interrupt 10EE.. < SP after 2nd int 10ED PCL2 < SP at 2nd int 10EC PCH2 10EB IYL 10EA IYH 10E9 IXL 10E8 IXH 10E7 ACCA 10E6 ACCB 10E5 CCR 10E4. < SP during 2nd int Usually, some repetitive tasks must be done at a rate higher than the background rate. These tasks can be synchronous or asynchronous. The synchronous tasks are called foreground tasks. The individual foreground tasks may have different activation rates, but the rates are usually multiples of each other. The foreground is often initiated by an interrupt at a fixed timed interval. Typical foreground tasks are servicing analog input or output, servicing a real-time control loop, or implementing digital filters. The other tasks are not synchronized with the foreground and background and occur at times determined by sources outside the program. The timing of their occurrence must be considered random with respect to the program timing. Figure 1 depicts the timing of a single background loop of this type of program. The traditional way to process asynchronous I/O is to let each service request interrupt the background and foreground process. When an asynchronous input or output request is detected, the CPU interrupts the program in process and vectors to the appropriate interrupt service routine. After servicing is complete, the program returns to the program in progress. If there are two or more asynchronous service routines, the program requires some sort of prioritization of the routines. As the number of different functions increases, the complexity of prioritizing the interrupts also increases. This becomes especially obvious while debugging the program with an in-circuit emulator. Elusive bugs caused by a second interrupt during an interrupt service routine are the bane of this approach. There is a program design that simplifies the program operation and eliminates these problems. The design uses only one CPU-generated interrupt, so prioritizing is unnecessary. Although you might not be able to meet some requirements with this design, it is applicable to most real-time systems. First, let s look more closely at the problems associated with processing asynchronous I/O. INTERRUPT I/O PROCESSING In an interrupt service routine, interrupts generally remain disabled to ensure that another interrupt doesn t cause an exit from the first service routine. Consequently, the second request cannot be serviced until the first one is complete. The system requirements specify the maximum latency in servicing a given I/O request. If the length of time required for any other service routine exceeds the latency, the specification will not be met. During the initial program design, these requirements are usually met. But later, when changes are made, 46 EMBEDDED SYSTEMS PROGRAMMING JUNE 1995

4 Z80 STACK POINTER MOVEMENT In this diagram for the Z80, the PCH0, PCL0 and PCH2, PCL2 addresses have the same meaning as in the 68HC11 example. PCH3, PCL3 is the address of the foreground service routine and is pushed to the stack before the return from interrupt to activate the foreground. Stack Pointer First interrupt Foreground and Return to interrupted Address initiated 2nd interrupt Background (Hex) FFFF < Top of stack FFFE FFFD < -Assume 6 bytes used by Background at time of 1st interrupt FFFC FFFB FFFA. < SP after return FFF9 PCH0 < 1st int PCH0 PCH0 from 1st int to FFF8 PCL0 PCL0 PCL0 Background FFF7 PCH3 <-Foreground ->. Foreground Stack FFF6 PCL3 address pushed. usage, assume FFF5 to stack followed. 3 bytes. < SP after return FFF4 by a Return PCH2 < SP at 2nd from 2nd int FFF3 PCL2 interrupt FFF2. < SP during 2nd interrupt FIGURE 1 Foreground-background program timing. it is very easy to add improvements to one service routine and affect the response time to all others. The insidious part is that since the different I/O requests are asynchronous, the problem will show up randomly. It is a simple matter to see if the multiple prioritized interrupt approach will work. The interrupt service routines must be prioritized, the maximum execution time for each routine determined, and maximum required response latency for each routine specified. For each routine, the response latency for a given routine is the maximum time required for any routine plus the sum of the time required for all routines of a higher priority. This assumes that a higher priority routine can only be activated once while waiting for a lower priority routine. If not, the time needed by the routine must be multiplied by the number of times it can be activated. As the number of different interrupt routines increases, this procedure gets very complicated. When there are more than a few routines, the lower priority routine latency lengthens. On a worst-case basis, it often exceeds the specification. The program designer then resorts to probability theory to say that all those higher priority interrupts could never occur at once and everything will work all right. Sure, until the first demonstration or qualification testing. Also, any change in the code of any service routine requires recalculating the timing. WITH POLLED I/O PROCESSING There is a very simple solution for this problem that is applicable to most real-time systems. If the foreground and background processes are interrupted at a sufficiently high rate that any asynchronous I/O latency requirement is met, all I/O can be serviced by simple polling during the single interrupt. Inherent in this approach is dividing the I/O service routines into two parts: one that is required at the higher interrupt rate and the remainder that can be executed at the foreground rate. The following is a detailed explanation of the latter approach. First, determine the minimum latency for all functions. If it is possible to operate the CPU at a fixed interrupt rate less than half this latency, the approach will probably work. For example, if the program is receiving data at 9,600 baud, it takes 1,004 ms to receive a start bit, eight data bits, no parity, and one stop bit. If it is possible to operate the CPU with an interrupt every 500 ms, received data will be available every other interrupt on the average. Data will never be available more frequently than three interrupts in a row. Next, the individual service routines must be split into two parts. The first part, executed during each interrupt service routine, must input or output data if available. The second part, generating output data or processing input data, will be scheduled at the foreground rate. 48 EMBEDDED SYSTEMS PROGRAMMING JUNE 1995

5 The program is initialized to have a single interrupt operating at a fixed rate. The program will then enter the background loop with the interrupt enabled. When the background is interrupted, the code will service all asynchronous requirements by polling. The interrupt code also can maintain any required counters since its rate is constant. At the completion of the interrupt code, the program returns to the background. After a predetermined number of interrupts, the program executes the foreground code instead of returning to the background loop. Interrupts must be enabled during foreground, so that it too can be interrupted. Without this, foreground may overrun the next interrupt and violate the I/O latency requirements. Figure 2 shows this timing relationship. An example of this approach is a program that sends and receives serial data line by line. Data is passed between the foreground and interrupt code in buffers able to hold a line of data. During each interrupt, the output code tests if the output device is busy. If not, it will send the next character until the buffer is empty. Also, the interrupt input code checks if another input character is available. If so, it will be read and placed in local storage. When the program detects an end of line, it sets a flag to signal the foreground and moves the line from local storage to the input buffer. If moving the data takes too long, two buffers can be used and pointers to the two buffers swapped when the line is complete. The foreground portion of the output code tests if the output buffer is empty. When the buffer is empty and there is a new line to transmit, the foreground fills the buffer and sets a flag. The interrupt code sees the flag and begins transmitting data. The foreground portion of the input code monitors the flag or pointer from the interrupt code. When a line is received, it begins processing it while the interrupt code receives the next line. The first part of the service routines is executed each interrupt. Since the FIGURE 2 Interrupt, foreground, background program timing. time between interrupts is half the maximum latency for any service routine, data is guaranteed to be handled in a timely manner. Obviously, the total of the interrupt portions of the service routines and any interrupt housekeeping must execute much more quickly than the period between interrupts. If it doesn t, the CPU needs more horsepower. INTERRUPT ACTIVATION The interrupts must be activated at a fixed rate. The MC68HC11 has an internal counter TCNT, a 16-bit register that is continually incremented by the E clock. There is a prescalar that can be set to 4, 8, or 16 during program initialization. The counter cannot be reset by the program, but it can be compared to one of five 16-bit compare registers. When the counter and the compare register are equal, an interrupt will be generated if enabled. After each interrupt, the program must add the counts to the next interrupt to the last value in the compare register and load it to the register. The Z80 lacks an internal counter. External counters can consist of discrete devices that can be read as memory, an I/O port, or the Z80 s companion device, the counter/timer circuit. The counter/timer circuit is a multiplechannel counter timer that can be used to initiate interrupts at a fixed rate. The period between interrupts does not have to be exact. Timing of the program will only be based on the cumulative number of interrupt activations. If the period between one interrupt and the next is longer than normal, it will only affect the latency in I/O servicing. So, it is often prudent to disable the interrupts within the foreground or background code, which should be done while moving blocks of data acquired within the interrupt routine or foreground. Disabling interrupts is only acceptable if they are disabled for a fraction of the interrupt period. Generally, the time required to execute the code within the interrupt routine should be a fraction of the repetition period, say 30%. If it takes too long, there will be no time for the rest of the program. Theoretically, the code could take up to two interrupt periods without disastrous results. Good design would not ever let the execution time exceed an interrupt period. FOREGROUND ACTIVATION Activating the foreground routines in place of the background is not difficult but requires some planning. Remembering that the foreground will probably be interrupted, it is important that it does not share registers or RAM with the interrupt routines. The timing of the 50 EMBEDDED SYSTEMS PROGRAMMING JUNE 1995

6 foreground activation can be scheduled by a counter in the interrupt routine. For example, the foreground can be activated every 32 interrupts. If certain foreground tasks occur less frequently than others, it is best to activate the most frequent one directly and let the foreground code schedule the slower tasks. The foreground is activated by a call from the interrupt routine before the normal return from interrupt. The actual approach differs between the Z80 and the MC68HC11. The way the machine state is saved upon entering an interrupt also differs and must be considered when calling to foreground. Listing 1 shows the calling procedure for the foreground routines when using a Z80. The code segment demonstrates the portion of the interrupt service routine used to call the foreground routine. In this case, the foreground is called every eight interrupts. The assumed hardware uses a counter to set a flip-flop to activate each interrupt. The flip-flop output is connected to pin 16, INT* of the Z80. When the interrupt is serviced, the flipflop is reset by writing to a port. A flag is set while in the foreground to ensure that it is not called a second time while it is executing. When an interrupt is serviced by the Z80, only the return address is pushed to the stack. No registers are saved. Normally, the registers (except the index registers) are swapped with the alternate registers for use during the interrupt servicing. If the index registers are to be used during interrupt servicing, they must be pushed to the stack. All registers must be restored before returning from the interrupt or calling the foreground. To properly execute a return from interrupt with a Z80, a RETI instruction must be executed. This will enable interrupts and return to the address on the stack that is normally the program counter location before the interrupt. To call to the foreground routine, load the HL register with the address of the foreground entry and push it to the LISTING 1 Z80 foreground activation. ; Constants: TRUE equ 0FFH FALSE equ 0 ; Port locations ClrI equ0aah ; The port to clear interrupt F-F ; Variable storage, based at RAM. ForeFlag equ RAM ; Foreground lockout flag Real equ ForeFlag+1 ; 2 byte free running interrupt clock ; IntReal: This is where the program ; comes from the interrupt vector. IntReal: EX AF,AF ; Swap the registers. dont use <IX>, <IY> EXX LD HL,(Real) ; Bump interrupt clock INC HL LD (Real),HL ; The other interrupt routines would be ; done here. ; Call foreground every 8 interrupts. LD A,(Real) AND 7 ; Every 8 interrupts JP NZ,NotInFgd LD HL,ForeFlag LD A,(HL); Dont allow lock CP TRUE JP Z,NotInFgd LD (HL),TRUE LD HL,Forgnd ; Set new return PUSH HL ; To the stack NotInFgd: OUT A,(ClrI) ; Reset interrupt latch EX AF,AF ; Restore registers EXX EI RET ; NOTE: use RETI here if the hard- ; ware uses the Z80 interrupt chain ; to prioritize interrupts. ; Foreground routines. ; Called every 8 interrupts. Forgnd: PUSH AF PUSH BC PUSH DE PUSH HL PUSH IX ; Only store the index regs A/R PUSH IY ; Do the foreground routines here. POP IY POP IX POP HL POP DE POP BC LD A,FALSE ; Release foreground LD (ForeFlag),A POP AF RET stack. This is done before swapping the alternate registers. When the RETI is executed, the program counter will be set to the foreground code location. Future interrupts will interrupt the foreground in the same manner they interrupted the background. When in the foreground, all registers must be saved by pushing them to the stack. Any future interrupts must use the alternate registers, since the content of the registers belongs to the background. To exit the foreground, restore the registers and execute a RET. The program will return to where it left off in the background. It is best to disable interrupts before starting to store or restore the registers and enable the interrupt when complete. If this is not done, an interrupt could occur and push additional data to the stack between the stored registers, which could possibly cause a problem. Listing 2 shows the calling procedure for the foreground routines when using a 68HC11. The code segment demonstrates the portion of the interrupt service routine used to call to the foreground routine. In this case, the 54 EMBEDDED SYSTEMS PROGRAMMING JUNE 1995

7 LISTING 2 68HC11 foreground activation. ; Constants: TRUE equ 0FFH FALSE equ0 NumClocks equ 1024 ; Number of E clocks between interrupts OC1F equ 80H ; Clear Timer interrupt flag ; Port locations, after moving them to page 0. TOC1 equ 16H ; Output Compare 1 Register TFLG1 equ 23H ; Timer Interrupt Flag Reg. 1 COPRST equ 3AH ; Arm/Reset COP Timer Circuitry ; Variable storage, based at RAM. ForeFlag equ RAM ; Foreground lockout flag Real equ ForeFlag+1 ; 2 byte free running interrupt clock MastErr equ Real+2 ; Location tells program about errors LastComp equ MastErr+1 ; 2 byte storage for last compare value ; IntReal: This is where the program comes from the interrupt vector. IntReal: JSR ResetComp ; Reset the compare register and COP LDD Real ; Interrupt counter, 2 byte ADDD #1 STD Real ; The other interrupt routines would be done here. LDAA #FALSE CMPA ForeFlag ; See if flag is False BEQ NotInFgd ; Skip if not in foreground ; Check if program is still in foreground when it is time to enter it again. If so, it ; constitutes an error and cant be allowed to happen. LDAA Real+1 ; Get low byte ANDA #1FH ; Every 32 times BNE ExitInt ; Still in foreground if not 0 LDAA #TRUE STAA MastErr ; Show errors if here, overrun BRA ExitInt NotInFgd: LDAA Real+1 ; Get low byte ANDA #1FH; Every 32 times BNE ExitInt ; Not time for foreground yet LDAA #TRUE STAA ForeFlag ; Going to do it ; Foreground is called here. There should ; be nothing of value in the registers. JSR DoFgd ; Off to do the foreground, stack return LDAA #FALSE ; Return here after foreground STAA ForeFlag ; Foreground complete ExitInt: RTI ; Normal return, cleared I bit will be restored ; ResetComp: Reset the compare register and COP. Reset the interrupt flag bit. foreground is called every 32 interrupts. A flag is set to ensure that the foreground is not called a second time while it is executing. When an MC68HC11 interrupt is serviced, the return address is pushed to the stack followed by the index registers, the accumulator, and the condition code register. Execution of an RTI instruction to return from the interrupt routine will restore the registers, including the condition code register that contains the interrupt enable I bit. The program counter is restored to its position when interrupted. To call to the foreground routines, the I bit of the condition code register must be cleared to enable interrupts and a JSR to the foreground executed before the RTI of the interrupt routine. Since interrupts are again enabled, the foreground may be interrupted the same as the background. The background s version of the registers is still on the stack, so the foreground need not save the current state of the registers. To exit the foreground, all that is required is a normal RTS to return from a subroutine. The program will return to the interrupt routine (with interrupts enabled) and then to the background via an RTI, restoring the registers. ADDITIONAL CONSIDERATIONS Subroutines that may be called from both the interrupt routine and the foreground or background must be reentrant. This means that they may be interrupted at any time, reentered and executed to completion before finishing their original activation. The implication is that the routines must not use fixed RAM variable locations. They must either use registers, locations on the stack, or locations referenced to the index registers for variables. If the CPU has index registers, the best solution for using common subroutines is to allocate separate blocks of RAM for use by the interrupt routine, the foreground, and the background. The index registers can then be 56 EMBEDDED SYSTEMS PROGRAMMING JUNE 1995

8 LISTING 2 continued ResetComp: LDD LastComp ADDD #NumClocks STD LastComp STD TOC1 LDAA #55H STAA COPRST LDAA #0AAH STAA COPRST LDAA #OC1F STAA TFLG1 RTS ; Reset Timer #1, the interrupt timer ; Load the new value to the counter, 2 byte ; Reset the COP ; Clear interrupt flag ; DoFgd: Do the foreground routines. The program should be able to use all registers. DoFgd: CLI ; Clear I bit to enable interrupts ; Do the foreground routines here. RTS ; Return, end of foreground used as pointers into these blocks for common subroutine variable storage. The Z80 has three 16-bit registers and an 8-bit accumulator, which will suffice for most variables. The MC68HC11 has only a 16-bit accumulator, so it usually requires the use of index registers for dynamic variable storage. SATISFACTORY RESULTS We ve examined the requirements of program task scheduling and asynchronous I/O handling in a real-time system. We ve taken a look at a traditional method of prioritized interrupts and a simplified method using a single interrupt. In addition, we ve outlined approaches for implementing the single interrupt method for Z80 and MC68HC11 microprocessors. The single interrupt method will usually give satisfactory results. The key to this approach is that a higher priority task always runs to completion before turning control over to a lower priority task. This approach is deterministic. It can be analyzed for correctness, it will never invert priorities, and it is straightforward to debug. When its performance will satisfy the system requirements, the single interrupt method is the approach of choice. Orv Balcom has worked in the electronics industry for over 34 years, designing and programming microprocessor applications. In 1971, he founded Brown Dog Engineering, which provides custom engineering in areas of instrumentation and control systems and emphasizes the use of embedded microprocessor solutions. Balcom received his BS in mathematics from Long Beach State College. He can be reached at (310) , or by mail at Brown Dog Engineering, Box 427, Lomita, CA RESOURCES 1. Avigdor, Naomi, Handling Inverted Priorities, Embedded Systems Programming, March 1994, pp Obenza, Ray, Guaranteeing Real-Time Performance Using RMA, Embedded Systems Programming, May 1994, pp Jensen, E. Douglas, Eliminating the Hard/Soft Real-Time Dichotomy, Embedded Systems Programming, Oct. 1994, pp Jones, Do-While, Interrupt Free Design, The Computer Applications Journal, Feb. 1994, pp. 36.

Z80 Instruction Set. Z80 Assembly Language

Z80 Instruction Set. Z80 Assembly Language 75 Z80 Assembly Language The assembly language allows the user to write a program without concern for memory addresses or machine instruction formats. It uses symbolic addresses to identify memory locations

More information

MICROPROCESSOR AND MICROCOMPUTER BASICS

MICROPROCESSOR AND MICROCOMPUTER BASICS Introduction MICROPROCESSOR AND MICROCOMPUTER BASICS At present there are many types and sizes of computers available. These computers are designed and constructed based on digital and Integrated Circuit

More information

Interrupts and the Timer Overflow Interrupts Huang Sections 6.1-6.4. What Happens When You Reset the HCS12?

Interrupts and the Timer Overflow Interrupts Huang Sections 6.1-6.4. What Happens When You Reset the HCS12? Interrupts and the Timer Overflow Interrupts Huang Sections 6.1-6.4 o Using the Timer Overflow Flag to interrupt a delay o Introduction to Interrupts o How to generate an interrupt when the timer overflows

More information

The stack and the stack pointer

The stack and the stack pointer The stack and the stack pointer If you google the word stack, one of the definitions you will get is: A reserved area of memory used to keep track of a program's internal operations, including functions,

More information

Z80 Microprocessors Z80 CPU. User Manual UM008006-0714. Copyright 2014 Zilog, Inc. All rights reserved. www.zilog.com

Z80 Microprocessors Z80 CPU. User Manual UM008006-0714. Copyright 2014 Zilog, Inc. All rights reserved. www.zilog.com Z80 Microprocessors Z80 CPU UM008006-0714 Copyright 2014 Zilog, Inc. All rights reserved. www.zilog.com ii Warning: DO NOT USE THIS PRODUCT IN LIFE SUPPORT SYSTEMS. LIFE SUPPORT POLICY ZILOG S PRODUCTS

More information

MACHINE ARCHITECTURE & LANGUAGE

MACHINE ARCHITECTURE & LANGUAGE in the name of God the compassionate, the merciful notes on MACHINE ARCHITECTURE & LANGUAGE compiled by Jumong Chap. 9 Microprocessor Fundamentals A system designer should consider a microprocessor-based

More information

150127-Microprocessor & Assembly Language

150127-Microprocessor & Assembly Language Chapter 3 Z80 Microprocessor Architecture The Z 80 is one of the most talented 8 bit microprocessors, and many microprocessor-based systems are designed around the Z80. The Z80 microprocessor needs an

More information

M6800. Assembly Language Programming

M6800. Assembly Language Programming M6800 Assembly Language Programming 1 3. MC6802 MICROPROCESSOR MC6802 microprocessor runs in 1MHz clock cycle. It has 64 Kbyte memory address capacity using 16-bit addressing path (A0-A15). The 8-bit data

More information

Microcontroller Basics A microcontroller is a small, low-cost computer-on-a-chip which usually includes:

Microcontroller Basics A microcontroller is a small, low-cost computer-on-a-chip which usually includes: Microcontroller Basics A microcontroller is a small, low-cost computer-on-a-chip which usually includes: An 8 or 16 bit microprocessor (CPU). A small amount of RAM. Programmable ROM and/or flash memory.

More information

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Question Bank Subject Name: EC6504 - Microprocessor & Microcontroller Year/Sem : II/IV

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Question Bank Subject Name: EC6504 - Microprocessor & Microcontroller Year/Sem : II/IV DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Question Bank Subject Name: EC6504 - Microprocessor & Microcontroller Year/Sem : II/IV UNIT I THE 8086 MICROPROCESSOR 1. What is the purpose of segment registers

More information

MICROPROCESSOR. Exclusive for IACE Students www.iace.co.in iacehyd.blogspot.in Ph: 9700077455/422 Page 1

MICROPROCESSOR. Exclusive for IACE Students www.iace.co.in iacehyd.blogspot.in Ph: 9700077455/422 Page 1 MICROPROCESSOR A microprocessor incorporates the functions of a computer s central processing unit (CPU) on a single Integrated (IC), or at most a few integrated circuit. It is a multipurpose, programmable

More information

Introduction to Microcontrollers

Introduction to Microcontrollers Introduction to Microcontrollers Motorola M68HC11 Specs Assembly Programming Language BUFFALO Topics of Discussion Microcontrollers M68HC11 Package & Pinouts Accumulators Index Registers Special Registers

More information

8051 hardware summary

8051 hardware summary 8051 hardware summary 8051 block diagram 8051 pinouts + 5V ports port 0 port 1 port 2 port 3 : dual-purpose (general-purpose, external memory address and data) : dedicated (interfacing to external devices)

More information

8085 INSTRUCTION SET

8085 INSTRUCTION SET DATA TRANSFER INSTRUCTIONS Opcode Operand Description 8085 INSTRUCTION SET INSTRUCTION DETAILS Copy from source to destination OV Rd, Rs This instruction copies the contents of the source, Rs register

More information

2.8.3 / (Z80 Serial I/O)

2.8.3 / (Z80 Serial I/O) 283 / (Z80 Serial I/O) 80 SIO 80 / 80 bit bit bit bit SIO! 80 " Z80 SIO 2 # $ % Z80 SIO & IBM bisync ( byte) HDLC, IBM SDLC ( bit) '! # & ( modem modem )/" ' Cyclic Redundancy Check (CRC) ( ) 2831 Z80

More information

Z80 Family. CPU User Manual

Z80 Family. CPU User Manual Z80 Family CPU User Manual User Manual ZiLOG Worldwide Headquarters 532 Race Street San Jose, CA 95126-3432 Telephone: 408.558.8500 Fax: 408.558.8300 www.zilog.com This publication is subject to replacement

More information

CSC 2405: Computer Systems II

CSC 2405: Computer Systems II CSC 2405: Computer Systems II Spring 2013 (TR 8:30-9:45 in G86) Mirela Damian http://www.csc.villanova.edu/~mdamian/csc2405/ Introductions Mirela Damian Room 167A in the Mendel Science Building mirela.damian@villanova.edu

More information

Flash Microcontroller. Memory Organization. Memory Organization

Flash Microcontroller. Memory Organization. Memory Organization The information presented in this chapter is collected from the Microcontroller Architectural Overview, AT89C51, AT89LV51, AT89C52, AT89LV52, AT89C2051, and AT89C1051 data sheets of this book. The material

More information

HC12 Assembly Language Programming

HC12 Assembly Language Programming HC12 Assembly Language Programming Programming Model Addressing Modes Assembler Directives HC12 Instructions Flow Charts 1 Assembler Directives In order to write an assembly language program it is necessary

More information

Data Cables. Schmitt TTL LABORATORY ELECTRONICS II

Data Cables. Schmitt TTL LABORATORY ELECTRONICS II Data Cables Data cables link one instrument to another. Signals can attenuate or disperse on long wires. A direct wire works best for short cables of less than 10 ft. A TTL cable connection can use a Schmitt

More information

8051 MICROCONTROLLER COURSE

8051 MICROCONTROLLER COURSE 8051 MICROCONTROLLER COURSE Objective: 1. Familiarization with different types of Microcontroller 2. To know 8051 microcontroller in detail 3. Programming and Interfacing 8051 microcontroller Prerequisites:

More information

8-Bit Flash Microcontroller for Smart Cards. AT89SCXXXXA Summary. Features. Description. Complete datasheet available under NDA

8-Bit Flash Microcontroller for Smart Cards. AT89SCXXXXA Summary. Features. Description. Complete datasheet available under NDA Features Compatible with MCS-51 products On-chip Flash Program Memory Endurance: 1,000 Write/Erase Cycles On-chip EEPROM Data Memory Endurance: 100,000 Write/Erase Cycles 512 x 8-bit RAM ISO 7816 I/O Port

More information

Chapter 11 I/O Management and Disk Scheduling

Chapter 11 I/O Management and Disk Scheduling Operating Systems: Internals and Design Principles, 6/E William Stallings Chapter 11 I/O Management and Disk Scheduling Dave Bremer Otago Polytechnic, NZ 2008, Prentice Hall I/O Devices Roadmap Organization

More information

CoE3DJ4 Digital Systems Design. Chapter 4: Timer operation

CoE3DJ4 Digital Systems Design. Chapter 4: Timer operation CoE3DJ4 Digital Systems Design Chapter 4: Timer operation Timer There are two 16-bit timers each with four modes of operation Timers are used for (a) interval timing, (b) event counting or (c) baud rate

More information

Introduction. What is an Operating System?

Introduction. What is an Operating System? Introduction What is an Operating System? 1 What is an Operating System? 2 Why is an Operating System Needed? 3 How Did They Develop? Historical Approach Affect of Architecture 4 Efficient Utilization

More information

Interrupts. 1.Maskable interrupt request can be ignored or delayed by the microprocessor and used in telephone

Interrupts. 1.Maskable interrupt request can be ignored or delayed by the microprocessor and used in telephone Interrupts The interrupt I/O is a process of data transfer where-by an external device or a peripheral can inform the microprocessor that it is ready for communication The interrupt requests are classified

More information

AN141 SMBUS COMMUNICATION FOR SMALL FORM FACTOR DEVICE FAMILIES. 1. Introduction. 2. Overview of the SMBus Specification. 2.1.

AN141 SMBUS COMMUNICATION FOR SMALL FORM FACTOR DEVICE FAMILIES. 1. Introduction. 2. Overview of the SMBus Specification. 2.1. SMBUS COMMUNICATION FOR SMALL FORM FACTOR DEVICE FAMILIES 1. Introduction C8051F3xx and C8051F41x devices are equipped with an SMBus serial I/O peripheral that is compliant with both the System Management

More information

Technical Note. Micron NAND Flash Controller via Xilinx Spartan -3 FPGA. Overview. TN-29-06: NAND Flash Controller on Spartan-3 Overview

Technical Note. Micron NAND Flash Controller via Xilinx Spartan -3 FPGA. Overview. TN-29-06: NAND Flash Controller on Spartan-3 Overview Technical Note TN-29-06: NAND Flash Controller on Spartan-3 Overview Micron NAND Flash Controller via Xilinx Spartan -3 FPGA Overview As mobile product capabilities continue to expand, so does the demand

More information

EC313 - VHDL State Machine Example

EC313 - VHDL State Machine Example EC313 - VHDL State Machine Example One of the best ways to learn how to code is seeing a working example. Below is an example of a Roulette Table Wheel. Essentially Roulette is a game that selects a random

More information

Introduction to Embedded Systems. Software Update Problem

Introduction to Embedded Systems. Software Update Problem Introduction to Embedded Systems CS/ECE 6780/5780 Al Davis logistics minor Today s topics: more software development issues 1 CS 5780 Software Update Problem Lab machines work let us know if they don t

More information

Have both hardware and software. Want to hide the details from the programmer (user).

Have both hardware and software. Want to hide the details from the programmer (user). Input/Output Devices Chapter 5 of Tanenbaum. Have both hardware and software. Want to hide the details from the programmer (user). Ideally have the same interface to all devices (device independence).

More information

Exception and Interrupt Handling in ARM

Exception and Interrupt Handling in ARM Exception and Interrupt Handling in ARM Architectures and Design Methods for Embedded Systems Summer Semester 2006 Author: Ahmed Fathy Mohammed Abdelrazek Advisor: Dominik Lücke Abstract We discuss exceptions

More information

1. Computer System Structure and Components

1. Computer System Structure and Components 1 Computer System Structure and Components Computer System Layers Various Computer Programs OS System Calls (eg, fork, execv, write, etc) KERNEL/Behavior or CPU Device Drivers Device Controllers Devices

More information

An Introduction To Simple Scheduling (Primarily targeted at Arduino Platform)

An Introduction To Simple Scheduling (Primarily targeted at Arduino Platform) An Introduction To Simple Scheduling (Primarily targeted at Arduino Platform) I'm late I'm late For a very important date. No time to say "Hello, Goodbye". I'm late, I'm late, I'm late. (White Rabbit in

More information

Programmer s Model = model of µc useful to view hardware during execution of software instructions

Programmer s Model = model of µc useful to view hardware during execution of software instructions HC12/S12 Programmer s Model Programmer s Model = model of µc useful to view hardware during execution of software instructions Recall: General Microcontroller/Computer Architecture note: Control Unit &

More information

Modbus RTU Communications RX/WX and MRX/MWX

Modbus RTU Communications RX/WX and MRX/MWX 15 Modbus RTU Communications RX/WX and MRX/MWX In This Chapter.... Network Slave Operation Network Master Operation: RX / WX Network Master Operation: DL06 MRX / MWX 5 2 D0 Modbus Network Slave Operation

More information

6809 SBUG-E Monitor ROM Version 1.5

6809 SBUG-E Monitor ROM Version 1.5 6809 SBUG-E Monitor ROM Version 1.5 The 6809 SBUG monitor ROM is provided to enable the computer to communicate with a terminal for the purpose of various programming and debugging functions. It has been

More information

Linux Driver Devices. Why, When, Which, How?

Linux Driver Devices. Why, When, Which, How? Bertrand Mermet Sylvain Ract Linux Driver Devices. Why, When, Which, How? Since its creation in the early 1990 s Linux has been installed on millions of computers or embedded systems. These systems may

More information

Computer-System Architecture

Computer-System Architecture Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection General System Architecture 2.1 Computer-System Architecture 2.2 Computer-System

More information

Keil C51 Cross Compiler

Keil C51 Cross Compiler Keil C51 Cross Compiler ANSI C Compiler Generates fast compact code for the 8051 and it s derivatives Advantages of C over Assembler Do not need to know the microcontroller instruction set Register allocation

More information

Linux Scheduler. Linux Scheduler

Linux Scheduler. Linux Scheduler or or Affinity Basic Interactive es 1 / 40 Reality... or or Affinity Basic Interactive es The Linux scheduler tries to be very efficient To do that, it uses some complex data structures Some of what it

More information

CSE2102 Digital Design II - Topics CSE2102 - Digital Design II

CSE2102 Digital Design II - Topics CSE2102 - Digital Design II CSE2102 Digital Design II - Topics CSE2102 - Digital Design II 6 - Microprocessor Interfacing - Memory and Peripheral Dr. Tim Ferguson, Monash University. AUSTRALIA. Tel: +61-3-99053227 FAX: +61-3-99053574

More information

Programing the Microprocessor in C Microprocessor System Design and Interfacing ECE 362

Programing the Microprocessor in C Microprocessor System Design and Interfacing ECE 362 PURDUE UNIVERSITY Programing the Microprocessor in C Microprocessor System Design and Interfacing ECE 362 Course Staff 1/31/2012 1 Introduction This tutorial is made to help the student use C language

More information

Application Note 195. ARM11 performance monitor unit. Document number: ARM DAI 195B Issued: 15th February, 2008 Copyright ARM Limited 2007

Application Note 195. ARM11 performance monitor unit. Document number: ARM DAI 195B Issued: 15th February, 2008 Copyright ARM Limited 2007 Application Note 195 ARM11 performance monitor unit Document number: ARM DAI 195B Issued: 15th February, 2008 Copyright ARM Limited 2007 Copyright 2007 ARM Limited. All rights reserved. Application Note

More information

Debouncing Switches. Mechanical switches are one of the most common interfaces to a uc.

Debouncing Switches. Mechanical switches are one of the most common interfaces to a uc. Mechanical switches are one of the most common interfaces to a uc. Switch inputs are asynchronous to the uc and are not electrically clean. Asynchronous inputs can be handled with a synchronizer (2 FF's).

More information

SYSTEM ecos Embedded Configurable Operating System

SYSTEM ecos Embedded Configurable Operating System BELONGS TO THE CYGNUS SOLUTIONS founded about 1989 initiative connected with an idea of free software ( commercial support for the free software ). Recently merged with RedHat. CYGNUS was also the original

More information

Hardware and Software Requirements

Hardware and Software Requirements C Compiler Real-Time OS Simulator Training Evaluation Boards Installing and Using the Keil Monitor-51 Application Note 152 May 31, 2000, Munich, Germany by Keil Support, Keil Elektronik GmbH support.intl@keil.com

More information

A Utility for Programming Single FLASH Array HCS12 MCUs, with Minimum RAM Overhead

A Utility for Programming Single FLASH Array HCS12 MCUs, with Minimum RAM Overhead Freescale Semiconductor Application Note AN2720 Rev. 2, 04/2008 A Utility for Programming Single FLASH Array HCS12 MCUs, with Minimum RAM Overhead By Jim Williams 8/16-Bit Applications Engineering Austin,

More information

8-bit Microcontroller. Application Note. AVR134: Real-Time Clock (RTC) using the Asynchronous Timer. Features. Theory of Operation.

8-bit Microcontroller. Application Note. AVR134: Real-Time Clock (RTC) using the Asynchronous Timer. Features. Theory of Operation. AVR134: Real-Time Clock (RTC) using the Asynchronous Timer Features Real-Time Clock with Very Low Power Consumption (4µA @ 3.3V) Very Low Cost Solution Adjustable Prescaler to Adjust Precision Counts Time,

More information

Serial Communications

Serial Communications Serial Communications 1 Serial Communication Introduction Serial communication buses Asynchronous and synchronous communication UART block diagram UART clock requirements Programming the UARTs Operation

More information

Programming the Motorola MC68HC11 Microcontroller

Programming the Motorola MC68HC11 Microcontroller Programming the Motorola MC68HC11 Microcontroller CONTENTS: COMMON PROGRAM INSTRUCTIONS WITH EXAMPLES MEMORY LOCATIONS PORTS SUBROUTINE LIBRARIES PARALLEL I/O CONTROL REGISTER (PIOC) COMMON PROGRAM INSTRUCTIONS

More information

Lesson-16: Real time clock DEVICES AND COMMUNICATION BUSES FOR DEVICES NETWORK

Lesson-16: Real time clock DEVICES AND COMMUNICATION BUSES FOR DEVICES NETWORK DEVICES AND COMMUNICATION BUSES FOR DEVICES NETWORK Lesson-16: Real time clock 1 Real Time Clock (RTC) A clock, which is based on the interrupts at preset intervals. An interrupt service routine executes

More information

Faculty of Engineering Student Number:

Faculty of Engineering Student Number: Philadelphia University Student Name: Faculty of Engineering Student Number: Dept. of Computer Engineering Final Exam, First Semester: 2012/2013 Course Title: Microprocessors Date: 17/01//2013 Course No:

More information

PART B QUESTIONS AND ANSWERS UNIT I

PART B QUESTIONS AND ANSWERS UNIT I PART B QUESTIONS AND ANSWERS UNIT I 1. Explain the architecture of 8085 microprocessor? Logic pin out of 8085 microprocessor Address bus: unidirectional bus, used as high order bus Data bus: bi-directional

More information

Lecture 3 Addressing Modes, Instruction Samples, Machine Code, Instruction Execution Cycle

Lecture 3 Addressing Modes, Instruction Samples, Machine Code, Instruction Execution Cycle Lecture 3 Addressing Modes, Instruction Samples, Machine Code, Instruction Execution Cycle Contents 3.1. Register Transfer Notation... 2 3.2. HCS12 Addressing Modes... 2 1. Inherent Mode (INH)... 2 2.

More information

Appendix C: Keyboard Scan Codes

Appendix C: Keyboard Scan Codes Thi d t t d ith F M k 4 0 2 Appendix C: Keyboard Scan Codes Table 90: PC Keyboard Scan Codes (in hex) Key Down Up Key Down Up Key Down Up Key Down Up Esc 1 81 [ { 1A 9A, < 33 B3 center 4C CC 1! 2 82 ]

More information

Chapter 13. PIC Family Microcontroller

Chapter 13. PIC Family Microcontroller Chapter 13 PIC Family Microcontroller Lesson 01 PIC Characteristics and Examples PIC microcontroller characteristics Power-on reset Brown out reset Simplified instruction set High speed execution Up to

More information

1 Classical Universal Computer 3

1 Classical Universal Computer 3 Chapter 6: Machine Language and Assembler Christian Jacob 1 Classical Universal Computer 3 1.1 Von Neumann Architecture 3 1.2 CPU and RAM 5 1.3 Arithmetic Logical Unit (ALU) 6 1.4 Arithmetic Logical Unit

More information

Real-Time Systems Prof. Dr. Rajib Mall Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Real-Time Systems Prof. Dr. Rajib Mall Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Real-Time Systems Prof. Dr. Rajib Mall Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture No. # 26 Real - Time POSIX. (Contd.) Ok Good morning, so let us get

More information

CS311 Lecture: Sequential Circuits

CS311 Lecture: Sequential Circuits CS311 Lecture: Sequential Circuits Last revised 8/15/2007 Objectives: 1. To introduce asynchronous and synchronous flip-flops (latches and pulsetriggered, plus asynchronous preset/clear) 2. To introduce

More information

Chapter 1 Computer System Overview

Chapter 1 Computer System Overview Operating Systems: Internals and Design Principles Chapter 1 Computer System Overview Eighth Edition By William Stallings Operating System Exploits the hardware resources of one or more processors Provides

More information

Below is a diagram explaining the data packet and the timing related to the mouse clock while receiving a byte from the PS-2 mouse:

Below is a diagram explaining the data packet and the timing related to the mouse clock while receiving a byte from the PS-2 mouse: PS-2 Mouse: The Protocol: For out mini project we designed a serial port transmitter receiver, which uses the Baud rate protocol. The PS-2 port is similar to the serial port (performs the function of transmitting

More information

Freescale Semiconductor, I

Freescale Semiconductor, I Application Note 9/2003 Serial Monitor Program for HCS12 MCUs By Jim Williams 8/16 Bit Applications Engineering Austin, Texas Introduction This application note describes a 2-Kbyte monitor program for

More information

Exceptions in MIPS. know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine

Exceptions in MIPS. know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine 7 Objectives After completing this lab you will: know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine Introduction Branches and jumps provide ways to change

More information

Use of Simulator in Teaching Introductory Computer Engineering*

Use of Simulator in Teaching Introductory Computer Engineering* Int. J. Engng Ed. Vol. 15, No. 5, pp. 353±357, 1999 0949-149X/91 $3.00+0.00 Printed in Great Britain. # 1999 TEMPUS Publications. Use of Simulator in Teaching Introductory Computer Engineering* DAVID EDWARDS

More information

GETTING STARTED WITH LABVIEW POINT-BY-POINT VIS

GETTING STARTED WITH LABVIEW POINT-BY-POINT VIS USER GUIDE GETTING STARTED WITH LABVIEW POINT-BY-POINT VIS Contents Using the LabVIEW Point-By-Point VI Libraries... 2 Initializing Point-By-Point VIs... 3 Frequently Asked Questions... 5 What Are the

More information

Microcomputer Components SAB 80515/SAB 80C515 8-Bit Single-Chip Microcontroller Family

Microcomputer Components SAB 80515/SAB 80C515 8-Bit Single-Chip Microcontroller Family Microcomputer Components SAB 80515/SAB 80C515 8-Bit Single-Chip Microcontroller Family User's Manual 08.95 SAB 80515 / SAB 80C515 Family Revision History: 8.95 Previous Releases: 12.90/10.92 Page Subjects

More information

Jorix kernel: real-time scheduling

Jorix kernel: real-time scheduling Jorix kernel: real-time scheduling Joris Huizer Kwie Min Wong May 16, 2007 1 Introduction As a specialized part of the kernel, we implemented two real-time scheduling algorithms: RM (rate monotonic) and

More information

An Introduction to MPLAB Integrated Development Environment

An Introduction to MPLAB Integrated Development Environment An Introduction to MPLAB Integrated Development Environment 2004 Microchip Technology Incorporated An introduction to MPLAB Integrated Development Environment Slide 1 This seminar is an introduction to

More information

An Overview of Stack Architecture and the PSC 1000 Microprocessor

An Overview of Stack Architecture and the PSC 1000 Microprocessor An Overview of Stack Architecture and the PSC 1000 Microprocessor Introduction A stack is an important data handling structure used in computing. Specifically, a stack is a dynamic set of elements in which

More information

White Paper. Real-time Capabilities for Linux SGI REACT Real-Time for Linux

White Paper. Real-time Capabilities for Linux SGI REACT Real-Time for Linux White Paper Real-time Capabilities for Linux SGI REACT Real-Time for Linux Abstract This white paper describes the real-time capabilities provided by SGI REACT Real-Time for Linux. software. REACT enables

More information

Scan a Keypad with the BS2 For Pushbutton User Input

Scan a Keypad with the BS2 For Pushbutton User Input Stamp Applications no. 22 (December 96): Scan a Keypad with the BS2 For Pushbutton User Input 16-key matrix keypad software plus beginner s race-timer project by Scott Edwards THE BUTTON instruction offered

More information

Monitoring of Intravenous Drip Rate

Monitoring of Intravenous Drip Rate Monitoring of Intravenous Drip Rate Vidyadhar V. Kamble, Prem C. Pandey, Chandrashekar P. Gadgil, and Dinesh S. Choudhary Abstract A drip rate meter, for monitoring intravenous infusion, is developed using

More information

Embedded system programming: HCS12

Embedded system programming: HCS12 Embedded system programming: HCS12 Cross developments environments and tools XCC12 cross C compiler in particular Low level programming in C Embedded system programming: HCS12 1 Low level programming in

More information

AVR305: Half Duplex Compact Software UART. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

AVR305: Half Duplex Compact Software UART. 8-bit Microcontrollers. Application Note. Features. 1 Introduction AVR305: Half Duplex Compact Software UART Features 32 Words of Code, Only Handles Baud Rates of up to 38.4 kbps with a 1 MHz XTAL Runs on Any AVR Device Only Two Port Pins Required Does Not Use Any Timer

More information

================================================================

================================================================ ==== ==== ================================================================ DR 6502 AER 201S Engineering Design 6502 Execution Simulator ================================================================

More information

Microtronics technologies Mobile: 99707 90092

Microtronics technologies Mobile: 99707 90092 For more Project details visit: http://www.projectsof8051.com/rfid-based-attendance-management-system/ Code Project Title 1500 RFid Based Attendance System Synopsis for RFid Based Attendance System 1.

More information

BASIC COMPUTER ORGANIZATION AND DESIGN

BASIC COMPUTER ORGANIZATION AND DESIGN 1 BASIC COMPUTER ORGANIZATION AND DESIGN Instruction Codes Computer Registers Computer Instructions Timing and Control Instruction Cycle Memory Reference Instructions Input-Output and Interrupt Complete

More information

Small Hardware Development and Prototyping Board for the SX28

Small Hardware Development and Prototyping Board for the SX28 Project Report: Small Hardware Development and Prototyping Board for the SX28 Project Number: PR57 1. Project Description 2. Schematic Diagram 3. Physical Diagram 4. Component Layout Diagram 5. Bill of

More information

AN108 IMPLEMENTING A REALTIME CLOCK. Relevant Devices. Introduction. Key Points. Overview

AN108 IMPLEMENTING A REALTIME CLOCK. Relevant Devices. Introduction. Key Points. Overview IMPLEMENTING A REALTIME CLOCK Relevant Devices This application note applies to the following devices: C8051F000, C8051F001, C8051F002, C8051F005, C8051F006, C8051F007, C8051F010, C8051F011, and C8051F012.

More information

UNIVERSITY OF CALIFORNIA. Los Angeles. Software for A Fault Tolerant. Microcontroller Network. A thesis submitted in partial satisfaction

UNIVERSITY OF CALIFORNIA. Los Angeles. Software for A Fault Tolerant. Microcontroller Network. A thesis submitted in partial satisfaction UNIVERSITY OF CALIFORNIA Los Angeles Software for A Fault Tolerant Microcontroller Network A thesis submitted in partial satisfaction of the requirements for the degree Master of Science in Computer Science

More information

Lecture N -1- PHYS 3330. Microcontrollers

Lecture N -1- PHYS 3330. Microcontrollers Lecture N -1- PHYS 3330 Microcontrollers If you need more than a handful of logic gates to accomplish the task at hand, you likely should use a microcontroller instead of discrete logic gates 1. Microcontrollers

More information

COMPUTERS ORGANIZATION 2ND YEAR COMPUTE SCIENCE MANAGEMENT ENGINEERING UNIT 5 INPUT/OUTPUT UNIT JOSÉ GARCÍA RODRÍGUEZ JOSÉ ANTONIO SERRA PÉREZ

COMPUTERS ORGANIZATION 2ND YEAR COMPUTE SCIENCE MANAGEMENT ENGINEERING UNIT 5 INPUT/OUTPUT UNIT JOSÉ GARCÍA RODRÍGUEZ JOSÉ ANTONIO SERRA PÉREZ COMPUTERS ORGANIZATION 2ND YEAR COMPUTE SCIENCE MANAGEMENT ENGINEERING UNIT 5 INPUT/OUTPUT UNIT JOSÉ GARCÍA RODRÍGUEZ JOSÉ ANTONIO SERRA PÉREZ Tema 5. Unidad de E/S 1 I/O Unit Index Introduction. I/O Problem

More information

Section 29. Real-Time Clock and Calendar (RTCC)

Section 29. Real-Time Clock and Calendar (RTCC) Section 29. Real-Time Clock and Calendar (RTCC) HIGHLIGHTS This section of the manual contains the following topics: 29.1 Introduction... 29-2 29.2 Status and Control Registers... 29-3 29.3 Modes of Operation...

More information

Instruction Set Architecture

Instruction Set Architecture Instruction Set Architecture Consider x := y+z. (x, y, z are memory variables) 1-address instructions 2-address instructions LOAD y (r :=y) ADD y,z (y := y+z) ADD z (r:=r+z) MOVE x,y (x := y) STORE x (x:=r)

More information

PIC Programming in Assembly. (http://www.mstracey.btinternet.co.uk/index.htm)

PIC Programming in Assembly. (http://www.mstracey.btinternet.co.uk/index.htm) PIC Programming in Assembly (http://www.mstracey.btinternet.co.uk/index.htm) Tutorial 1 Good Programming Techniques. Before we get to the nitty gritty of programming the PIC, I think now is a good time

More information

Chapter 2 Basic Structure of Computers. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan

Chapter 2 Basic Structure of Computers. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan Chapter 2 Basic Structure of Computers Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan Outline Functional Units Basic Operational Concepts Bus Structures Software

More information

Lab Experiment 1: The LPC 2148 Education Board

Lab Experiment 1: The LPC 2148 Education Board Lab Experiment 1: The LPC 2148 Education Board 1 Introduction The aim of this course ECE 425L is to help you understand and utilize the functionalities of ARM7TDMI LPC2148 microcontroller. To do that,

More information

AN585. A Real-Time Operating System for PICmicro Microcontrollers INTRODUCTION. Why do I Need a Real-Time Kernel? What is Multitasking Anyway?

AN585. A Real-Time Operating System for PICmicro Microcontrollers INTRODUCTION. Why do I Need a Real-Time Kernel? What is Multitasking Anyway? A Real-Time Operating System for PICmicro Microcontrollers Author: INTRODUCTION Jerry Farmer Myriad Development Company Ever dream of having a Real-Time Kernel for the PIC16CXXX family of microcontrollers?

More information

LABORATORY MANUAL EE0310 MICROPROCESSOR & MICROCONTROLLER LAB

LABORATORY MANUAL EE0310 MICROPROCESSOR & MICROCONTROLLER LAB LABORATORY MANUAL EE0310 MICROPROCESSOR & MICROCONTROLLER LAB DEPARTMENT OF ELECTRICAL & ELECTRONICS ENGINEERING FACULTY OF ENGINEERING & TECHNOLOGY SRM UNIVERSITY, Kattankulathur 603 203 1 LIST OF EXEPRIMENTS

More information

Porting ecos to the Analog Devices BLACKfin DSP

Porting ecos to the Analog Devices BLACKfin DSP Faculty of Computer Science Real-Time Systems Group Diploma thesis Porting ecos to the Analog Devices BLACKfin DSP André Liesk Chemnitz, October 2 nd, 2006 student : André Liesk, 30562 born on November

More information

ARM Thumb Microcontrollers. Application Note. Software ISO 7816 I/O Line Implementation. Features. Introduction

ARM Thumb Microcontrollers. Application Note. Software ISO 7816 I/O Line Implementation. Features. Introduction Software ISO 7816 I/O Line Implementation Features ISO 7816-3 compliant (direct convention) Byte reception and transmission with parity check Retransmission on error detection Automatic reception at the

More information

Flash Microcontroller. Architectural Overview. Features. Block Diagram. Figure 1. Block Diagram of the AT89C core

Flash Microcontroller. Architectural Overview. Features. Block Diagram. Figure 1. Block Diagram of the AT89C core Features 8-Bit CPU Optimized for Control Applications Extensive Boolean Processing Capabilities (Single-Bit Logic) On-Chip Flash Program Memory On-Chip Data RAM Bidirectional and Individually Addressable

More information

PROGETTO DI SISTEMI ELETTRONICI DIGITALI. Digital Systems Design. Digital Circuits Advanced Topics

PROGETTO DI SISTEMI ELETTRONICI DIGITALI. Digital Systems Design. Digital Circuits Advanced Topics PROGETTO DI SISTEMI ELETTRONICI DIGITALI Digital Systems Design Digital Circuits Advanced Topics 1 Sequential circuit and metastability 2 Sequential circuit A Sequential circuit contains: Storage elements:

More information

REAL TIME OPERATING SYSTEMS. Lesson-10:

REAL TIME OPERATING SYSTEMS. Lesson-10: REAL TIME OPERATING SYSTEMS Lesson-10: Real Time Operating System 1 1. Real Time Operating System Definition 2 Real Time A real time is the time which continuously increments at regular intervals after

More information

ASSEMBLY PROGRAMMING ON A VIRTUAL COMPUTER

ASSEMBLY PROGRAMMING ON A VIRTUAL COMPUTER ASSEMBLY PROGRAMMING ON A VIRTUAL COMPUTER Pierre A. von Kaenel Mathematics and Computer Science Department Skidmore College Saratoga Springs, NY 12866 (518) 580-5292 pvonk@skidmore.edu ABSTRACT This paper

More information

2 ASCII TABLE (DOS) 3 ASCII TABLE (Window)

2 ASCII TABLE (DOS) 3 ASCII TABLE (Window) 1 ASCII TABLE 2 ASCII TABLE (DOS) 3 ASCII TABLE (Window) 4 Keyboard Codes The Diagram below shows the codes that are returned when a key is pressed. For example, pressing a would return 0x61. If it is

More information

Real-Time Clock. * Real-Time Computing, edited by Duncan A. Mellichamp, Van Nostrand Reinhold

Real-Time Clock. * Real-Time Computing, edited by Duncan A. Mellichamp, Van Nostrand Reinhold REAL-TIME CLOCK Real-Time Clock The device is not a clock! It does not tell time! It has nothing to do with actual or real-time! The Real-Time Clock is no more than an interval timer connected to the computer

More information

Computer Organization & Architecture Lecture #19

Computer Organization & Architecture Lecture #19 Computer Organization & Architecture Lecture #19 Input/Output The computer system s I/O architecture is its interface to the outside world. This architecture is designed to provide a systematic means of

More information