Holtek HT48R05A-1 Handbook

Cost-effective i/o type mcu
Table of Contents

Advertisement

HT48R05A-1, HT48R06A-1, HT48R07A-1,
HT48R08A-1, HT48R09A-1
Cost-Effective I/O Type MCU
Handbook
Second Edition
June 2006
Copyright Ó 2006 by HOLTEK SEMICONDUCTOR INC. All rights reserved. Printed in Taiwan. No part of this publication
may be reproduced, stored in a retrieval system, or transmitted in any form by any means, electronic, mechanical photo-
copying, recording, or otherwise without the prior written permission of HOLTEK SEMICONDUCTOR INC.

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the HT48R05A-1 and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for Holtek HT48R05A-1

  • Page 1 Second Edition June 2006 Copyright Ó 2006 by HOLTEK SEMICONDUCTOR INC. All rights reserved. Printed in Taiwan. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form by any means, electronic, mechanical photo-...
  • Page 2: Table Of Contents

    Contents Contents Part I Microcontroller Profile..............1 Chapter 1 Hardware Structure ...................3 Introduction ........................3 Features...........................4 Technology Features....................4 Kernel Features......................4 Peripheral Features....................4 Selection Table ........................5 Block Diagram .........................5 Pin Assignment........................6 Pin Description.........................6 Absolute Maximum Ratings .....................8 D.C. Characteristics......................9 A.C. Characteristics .......................10 System Architecture.......................11 Clocking and Pipelining ...................11 Program Counter.....................12 Stack ........................13...
  • Page 3 Cost-Effective I/O Type MCU Special Function Registers ....................19 Indirect Addressing Register - IAR .................19 Memory Pointer - MP....................19 Accumulator - ACC....................20 Program Counter Low Register - PCL ..............20 Look-up Table Registers - TBLP, TBLH ..............20 Watchdog Timer Register - WDTS .................20 Status Register - STATUS ..................21 Interrupt Control Register - INTC ................22 Timer/Event Counter Registers ................22...
  • Page 4 Contents Watchdog Timer......................41 Configuration Options ....................43 Application Circuits ......................44 Part II Programming Language ...............45 Chapter 2 Instruction Set Introduction ................47 Instruction Set........................47 Instruction Timing ....................47 Moving and Transferring Data.................47 Arithmetic Operations....................48 Logical and Rotate Operations................48 Branches and Control Transfer ................48 Bit Operations ......................48 Table Read Operations ...................49 Other Operations.....................49...
  • Page 5 Step 2 - Add Source Program Files to the Project ..........95 Step 3 - Build the Project..................95 Step 4 - Programming the OTP Device ..............95 Step 5 - Transmit Code to Holtek ................96 Appendix.....................97 Appendix A Device Characteristic Graphics ..............99...
  • Page 6 Part I. Information related to microcontroller programming such as device instruction set, instruction definition, and assembly language directives is found within Part II. Part III relates to the Holtek range of Development Tools where information can be found on their installation and use.
  • Page 7 Cost-Effective I/O Type MCU...
  • Page 8: Part I Microcontroller Profile

    Part I Microcontroller Profile P a r t I Microcontroller Profile...
  • Page 9 Cost-Effective I/O Type MCU...
  • Page 10: Chapter 1 Hardware Structure

    The HT48R05A-1, HT48R06A-1, HT48R07A-1, HT48R08A-1 and HT48R09A-1 are OTP devices offering the advantages of easy and effective program updates, using the Holtek range of develop- ment and programming tools. These devices provide the designer with the means for fast and cost effective product development cycles.
  • Page 11: Features

    · Temperature Range: Operating Temperature -40°C to 85°C (Industrial Grade) Storage Temperature -50°C to 125°C Kernel Features · Program Memory: 0.5K´14 OTP/Mask ROM (HT48R05A-1/HT48C05) 1K´14 OTP/Mask ROM (HT48R06A-1/HT48C06, HT48R07A-1/HT48C07) 2K´14 OTP/Mask ROM (HT48R08A-1/HT48C08, HT48R09A-1/HT48C09) · Data Memory: 32´8 RAM (HT48R05A-1/HT48C05) 64´8 RAM (HT48R06A-1/HT48C06, HT48R07A-1/HT48C07)
  • Page 12: Selection Table

    I/O count. To assist users in their selection of the most appropriate device for their application, the following table, which summarizes the main features of each device, is provided. Program Data Package Part No. Timer Int. Stack Memory Memory Types HT48R05A-1 16SSOP, Ö 2.2V~5.5V 0.5K´14 32´8 8-bit´1 HT48C05 18DIP/SOP HT48R06A-1 16SSOP, Ö 2.2V~5.5V 1K´14...
  • Page 13: Pin Assignment

    2 4 S K D I P - A / S O P - A / S S O P - A 1 8 D I P - A / S O P - A 1 6 S S O P - A Pin Description HT48R05A-1/HT48C05, HT48R06A-1/HT48C06 Pin Name I/O Options Description Bidirectional 8-bit input/output port.
  • Page 14 Chapter 1 Hardware Structure Note 1. Each pin on PA can be programmed through a configuration option to have a wake-up function. 2. Individual pins or ports cannot be selected to have pull-high resistors. If the pull-high configura- tion option is chosen, then all input pins of all ports will be connected to pull-high resistors. 3.
  • Page 15: Absolute Maximum Ratings

    Cost-Effective I/O Type MCU HT48R07A-1/HT48C07, HT48R09A-1/HT48C09 Pin Name I/O Options Description Bidirectional 8-bit input/output port. Each individual bit on this port can be configured as a wake-up input by a configuration option. Pull-high PA0~PA7 I/O Software instructions determine if the pin is a CMOS output or Wake-up Schmitt Trigger input.
  • Page 16: D.c. Characteristics

    Chapter 1 Hardware Structure D.C. Characteristics Ta=25°C Test Conditions Symbol Parameter Min. Typ. Max. Unit Conditions ¾ ¾ =4MHz Operating Voltage ¾ ¾ =8MHz ¾ No load, f =4MHz Operating Current (Crystal OSC) ¾ ¾ No load, f =4MHz Operating Current (RC OSC) ¾...
  • Page 17: Characteristics

    Cost-Effective I/O Type MCU A.C. Characteristics Ta=25°C Test Conditions Symbol Parameter Min. Typ. Max. Unit Conditions ¾ ¾ 2.2V~5.5V 4000 System Clock (Crystal OSC) SYS1 ¾ ¾ 3.3V~5.5V 8000 ¾ ¾ 2.2V~5.5V 4000 System Clock (RC OSC) SYS2 ¾ ¾ 3.3V~5.5V 8000 ¾...
  • Page 18: System Architecture

    Chapter 1 Hardware Structure System Architecture A key factor in the high-performance features of the Holtek range of Cost-Effective I/O Type microcontrollers is attributed to the internal system architecture. The range of devices take advan- tage of the usual features found within RISC microcontrollers providing increased speed of opera- tion and enhanced performance.
  • Page 19: Program Counter

    ²JMP² or ²CALL² that demand a jump to a non-consecutive Program Memory address. For the Cost-Effective I/O series, the Program Counter is 9 bits wide for the HT48R05A-1/HT48C05, 10 bits wide for HT48R06A-1/HT48C06 and HT48R07A-1/ HT48C07 devices and 11 bits wide for the HT48R08A-1/HT48C08 and HT48R09A-1/HT48C09 de- vices.
  • Page 20: Stack

    6. For the HT48R06A-1/HT48C06 and HT48R07A-1/HT48C07, since their Program Counter is 10 bits wide, the b10 column in the table is not applicable. 7. For the HT48R05A-1/HT48C05, since its Program Counter is 9 bits wide, the b9 and b10 columns in the table are not applicable.
  • Page 21: Arithmetic And Logic Unit - Alu

    Cost-Effective I/O Type MCU P r o g r a m C o u n t e r T o p o f S T A C K S t a c k L e v e l 1 S t a c k P r o g r a m M e m o r y P o i n t e r...
  • Page 22: Special Vectors

    Program Memory, however, this instruction is not valid for the HT48R05A-1/HT48C05 devices. When these instructions are executed, the lower or- der table byte from the Program Memory will be transferred to the user defined Data Memory regis- ter [m] as specified in the instruction.
  • Page 23 Cost-Effective I/O Type MCU The following diagram illustrates the addressing/data flow of the look-up table: Table Program Example The following example shows how the table pointer and table data is defined and retrieved from the HT48R06A-1/HT48C06 and HT48R07A-1/HT48C07 I/O microcontrollers. This example uses raw table data located in the last page which is stored there using the ORG statement.
  • Page 24: Data Memory

    1. PC10~PC8: Current Program Counter bits 2. @7~@0: Table Pointer TBLP bits 3. For the HT48R05A-1/HT48C05, the Table address location is 9 bits, i.e. from b8~b0. 4. For the HT48R06A-1/HT48C06 and HT48R07A-1/HT48C07, the Table address location is 10 bits, i.e. from b9~b0.
  • Page 25: General Purpose Data Memory

    Cost-Effective I/O Type MCU Note Most of the Data Memory bits can be directly manipulated using the ²SET [m].i² and ²CLR [m].i² with the exception of a few dedicated bits. The Data Memory can also be accessed through the Memory Pointer register MP. General Purpose Data Memory All microcontroller programs require an area of read/write memory where temporary data can be stored and retrieved for use later.
  • Page 26: Special Function Registers

    Chapter 1 Hardware Structure Special Function Registers To ensure successful operation of the microcontroller, certain internal registers are implemented in the Data Memory area. These registers ensure correct operation of internal functions such as timers, interrupts, Watchdog, etc., as well as external functions such as I/O data control. The loca- tion of these registers within the Data Memory begins at the address ²00H².
  • Page 27: Accumulator - Acc

    Cost-Effective I/O Type MCU Accumulator - ACC The Accumulator is central to the operation of any microcontroller and is closely related with opera- tions carried out by the ALU. The Accumulator is the place where all intermediate results from the ALU are stored.
  • Page 28: Status Register - Status

    Chapter 1 Hardware Structure Status Register - STATUS This 8-bit register (0AH) contains the zero flag (Z), carry flag (C), auxiliary carry flag (AC), overflow flag (OV), power down flag (PDF), and watchdog time-out flag (TO). It also records the status infor- mation and controls the operation sequence.
  • Page 29: Interrupt Control Register - Intc

    Cost-Effective I/O Type MCU Interrupt Control Register - INTC This 8-bit register, known as the INTC register, controls the operation of both external and internal interrupts. By setting various bits within this register using standard bit manipulation instructions, the enable/disable function of the external interrupt and each of the internal interrupts can be inde- pendently controlled.
  • Page 30: Input/Output Ports

    Chapter 1 Hardware Structure Input/Output Ports Holtek microcontrollers offer considerable flexibility on their I/O ports. With the input or output des- ignation of every pin fully under user program control, pull-high option for all pins and wake-up op- tions on certain pins, the user is provided with the I/O structures to meet the needs of a wide range of application possibilities.
  • Page 31: Pin-Shared Functions

    Cost-Effective I/O Type MCU Pin-shared Functions The flexibility of the microcontroller range is greatly enhanced by the use of pins that have more than one function. Limited numbers of pins can force serious design constraints on designers but by supplying pins with multi-functions, many of these difficulties can be overcome. For some pins, the chosen function of the multi-function I/O pins is set by configuration options while for others the function is set by application program control.
  • Page 32 Chapter 1 Hardware Structure C o n t r o l B i t P u l l - H i g h O p t i o n W e a k D a t a B u s P u l l - u p W r i t e C o n t r o l R e g i s t e r C h i p R e s e t...
  • Page 33: Programming Considerations

    Cost-Effective I/O Type MCU Programming Considerations Within the user program, one of the first things to consider is port initialization. After a reset, all of the I/O data and port control registers will be set high. This means that all I/O pins will default to an input state, the level of which depends on the other connected circuitry and whether pull-high op- tions have been selected.
  • Page 34: Timer Register - Tmr

    Timer Control Register - TMRC The flexible features of the Holtek microcontroller Timer/Event Counters enable them to operate in three different modes, the options of which are determined by the contents of the timer control register TMRC.
  • Page 35: Configuring The Timer Mode

    Cost-Effective I/O Type MCU T M R C R e g i s t e r f o r 8 - b i t T i m e r / E v e n t C o u n t e r Configuring the Timer Mode In this mode, the timer can be utilized to measure fixed time intervals, providing an internal inter- rupt signal each time the counter overflows.
  • Page 36: Configuring The Event Counter Mode

    Chapter 1 Hardware Structure Configuring the Event Counter Mode In this mode, a number of externally changing logic events, occurring on external pin PC1/TMR, can be recorded by the internal timer. For the timer to operate in the event counting mode, bits TM1 and TM0 of the TMRC register must be set to 0 and 1 respectively.
  • Page 37: Programmable Frequency Divider (Pfd) And Buzzer Application

    Cost-Effective I/O Type MCU Pulse Width Measure Mode Timing Chart Programmable Frequency Divider (PFD) and Buzzer Application Operating similar to a programmable frequency divider, the buzzer function within the microcontroller provides a means of producing a variable frequency output suitable for applica- tions such as piezo-buzzer driving or other interfaces requiring a precise frequency generator.
  • Page 38: Prescaler

    Chapter 1 Hardware Structure PFD Output Control Using this method of frequency generation, and if a crystal oscillator is used for the system clock, very precise values of frequency can be generated. Prescaler Bits 0~2 of the TMRC can be used to define the pre-scaling stages of the internal clock sources of the Timer/Event Counter.
  • Page 39: Interrupts

    Cost-Effective I/O Type MCU Interrupts The device provides both external interrupt and internal Timer/Event Counter interrupt functions. The Interrupt Control Register (INTC;0BH) contains the interrupt control bits to set the enable/dis- able and the interrupt request flags. Interrupt Register I N T C R e g i s t e r Once an interrupt subroutine is serviced, all the other interrupts will be blocked (by clearing the EMI bit).
  • Page 40: Interrupt Priority

    Chapter 1 Hardware Structure Interrupt Priority Interrupts, occurring in the interval between the rising edges of two consecutive T2 pulses, will be serviced on the latter of the two T2 pulses, if the corresponding interrupts are enabled. In case of simultaneous requests, the following table shows the priority that is applied.
  • Page 41: Reset And Initialization

    Cost-Effective I/O Type MCU Reset and Initialization A reset function is a fundamental part of any microcontroller ensuring that the device can be set to some predetermined condition irrespective of outside parameters. The most important reset condi- tion is after power is first applied to the microcontroller. In this case, internal circuitry will ensure that the microcontroller, after a short delay, will be in a well defined state and ready to execute the first program instruction.
  • Page 42 Chapter 1 Hardware Structure RES Pin Reset This type of reset occurs when the microcontroller is already running and the RES pin is forcefully pulled low by external hardware such as an external switch. In this case as in the case of other re- set, the Program Counter will reset to zero and program execution initiated from this point.
  • Page 43 Cost-Effective I/O Type MCU Watchdog Time-out Reset during HALT The Watchdog time-out reset during HALT is a little different from other kinds of reset. Most of the conditions remain unchanged except that the Program Counter and the Stack Pointer will be cleared to 0 and the TO flag will be set to 1.
  • Page 44 Chapter 1 Hardware Structure The different kinds of reset all affect the internal registers of the microcontroller in different ways. To ensure reliable continuation of normal program execution after a reset occurs, it is important to know what condition the microcontroller is in after a particular reset occurs. The following table de- scribes how each type of reset affects each of the microcontroller internal registers.
  • Page 45: Oscillator

    Cost-Effective I/O Type MCU Oscillator Various oscillator options offer the user a wide range of functions according to their various applica- tion requirements. Two types of system clocks can be selected while various clock source options for the Watchdog Timer are provided for maximum flexibility. All oscillator options are selected through the configuration options.
  • Page 46: System Rc Oscillator

    Power Down Mode and Wake-up Power Down Mode All of the Holtek microcontrollers have the ability to enter a Power Down Mode, also known as the HALT Mode or Sleep Mode. When the device enters this mode, the normal operating current, will be reduced to an extremely low standby current level.
  • Page 47: Standby Current Considerations

    Cost-Effective I/O Type MCU · The WDT will be cleared and resume counting if the WDT clock source is selected to come from the WDT oscillator. The WDT will stop if its clock source originates from the system clock. · The I/O ports will maintain their present condition. ·...
  • Page 48: Watchdog Timer

    Chapter 1 Hardware Structure Watchdog Timer The Watchdog Timer is provided to prevent program malfunctions or sequences from jumping to unknown locations, due to certain uncontrollable external events such as electrical noise. It oper- ates by providing a ²chip reset² when the WDT counter overflows. The WDT clock is supplied by one of two sources selected by configuration option: its own self-contained dedicated internal WDT oscillator, or the instruction clock (system clock divided by 4).
  • Page 49 Cost-Effective I/O Type MCU ¸ Watchdog Timer Under normal program operation, the WDT time-out will initialize a ²chip reset² and set the status bit ²TO². However, if the system is in the Power Down Mode, only a WDT time-out reset from ²HALT²...
  • Page 50: Configuration Options

    HT48R05A-1/HT48C05, HT48R06A-1/HT48C06 Options WDT clock source: WDT OSC or f WDT function: enable or disable...
  • Page 51: Application Circuits

    Cost-Effective I/O Type MCU Application Circuits S e e b e l o w H T 4 8 R 0 7 A - 1 / H T 4 8 C 0 7 H T 4 8 R 0 9 A - 1 / H T 4 8 C 0 9 R C S y s t e m O s c i l l a t o r C r y s t a l S y s t e m...
  • Page 52: Part Ii Programming Language

    Part II Programming Language P a r t I I Programming Language...
  • Page 53 Cost-Effective I/O Type MCU...
  • Page 54: Chapter 2 Instruction Set Introduction

    In the case of Holtek microcontrollers, a comprehensive and flexible set of over 60 instructions is provided to en- able programmers to implement their application with the minimum of programming overheads.
  • Page 55: Arithmetic Operations

    The standard logical operations such as AND, OR, XOR and CPL all have their own instruction within the Holtek microcontroller instruction set. As with the case of most instructions involving data manipulation, data must pass through the Accumulator which may involve additional pro- gramming steps.
  • Page 56: Other Operations

    To overcome this problem, Holtek microcontrollers allow an area of Program Memory to be setup as a table where data can be directly stored. A set of easy to use instructions provides the means by which this fixed data can be referenced and retrieved from the Program Memory.
  • Page 57 Cost-Effective I/O Type MCU Mnemonic Description Cycles Flag Affected Logic Operation AND A,[m] Logical AND Data Memory to ACC OR A,[m] Logical OR Data Memory to ACC XOR A,[m] Logical XOR Data Memory to ACC Note ANDM A,[m] Logical AND ACC to Data Memory Note ORM A,[m] Logical OR ACC to Data Memory...
  • Page 58 Read table (current page) to TBLH and Data Memory None Note TABRDL [m] Read table (last page) to TBLH and Data Memory None (This instruction is not valid for HT48R05A-1/HT48C05.) Miscellaneous No operation None Note CLR [m] Clear Data Memory...
  • Page 59 Cost-Effective I/O Type MCU...
  • Page 60: Chapter 3 Instruction Definition

    Chapter 3 Instruction Definition C h a p t e r 3 Instruction Definition ADC A,[m] Add Data Memory to ACC with Carry Description The contents of the specified Data Memory, Accumulator and the carry flag are added. The result is stored in the Accumulator. ACC ¬...
  • Page 61 Cost-Effective I/O Type MCU AND A,[m] Logical AND Data Memory to ACC Description Data in the Accumulator and the specified Data Memory perform a bitwise logical AND op- eration. The result is stored in the Accumulator. ACC ¬ ACC ²AND² [m] Operation Affected flag(s) AND A,x...
  • Page 62 Chapter 3 Instruction Definition CLR WDT Clear Watchdog Timer Description The TO, PDF flags and the WDT are all cleared. Operation WDT cleared TO ¬ 0 PDF ¬ 0 Affected flag(s) TO, PDF CLR WDT1 Pre-clear Watchdog Timer Description The TO, PDF flags and the WDT are all cleared. Note that this instruction works in conjunc- tion with CLR WDT2 and must be executed alternately with CLR WDT2 to have effect.
  • Page 63: Decimal Adjust Acc For Addition With Result In Data Memory

    Cost-Effective I/O Type MCU DAA [m] Decimal-Adjust ACC for addition with result in Data Memory Description Convert the contents of the Accumulator value to a BCD ( Binary Coded Decimal) value re- sulting from the previous addition of two BCD variables. If the low nibble is greater than 9 or if AC flag is set, then a value of 6 will be added to the low nibble.
  • Page 64 Chapter 3 Instruction Definition INCA [m] Increment Data Memory with result in ACC Description Data in the specified Data Memory is incremented by 1. The result is stored in the Accumu- lator. The contents of the Data Memory remain unchanged. ACC ¬...
  • Page 65 Cost-Effective I/O Type MCU OR A,x Logical OR immediate data to ACC Description Data in the Accumulator and the specified immediate data perform a bitwise logical OR op- eration. The result is stored in the Accumulator. ACC ¬ ACC ²OR² x Operation Affected flag(s) ORM A,[m]...
  • Page 66 Chapter 3 Instruction Definition RLA [m] Rotate Data Memory left with result in ACC Description The contents of the specified Data Memory are rotated left by 1 bit with bit 7 rotated into bit 0. The rotated result is stored in the Accumulator and the contents of the Data Memory re- main unchanged.
  • Page 67 Cost-Effective I/O Type MCU RRC [m] Rotate Data Memory right through Carry Description The contents of the specified Data Memory and the carry flag are rotated right by 1 bit. Bit 0 replaces the carry bit and the original carry flag is rotated into bit 7. [m].i ¬...
  • Page 68 Chapter 3 Instruction Definition SDZA [m] Skip if decrement Data Memory is zero with result in ACC Description The contents of the specified Data Memory are first decremented by 1. If the result is 0, the following instruction is skipped. The result is stored in the Accumulator but the specified Data Memory contents remain unchanged.
  • Page 69 Cost-Effective I/O Type MCU SNZ [m].i Skip if bit i of Data Memory is not 0 Description If bit i of the specified Data Memory is not 0, the following instruction is skipped. As this re- quires the insertion of a dummy instruction while the next instruction is fetched, it is a two cycle instruction.
  • Page 70 The low byte of the program code (last page) addressed by the table pointer (TBLP) is moved to the specified Data Memory and the high byte moved to TBLH. Note that this in- struction is not valid for HT48R05A-1/HT48C05. [m] ¬ program code (low byte) Operation TBLH ¬...
  • Page 71 Cost-Effective I/O Type MCU XOR A,[m] Logical XOR Data Memory to ACC Description Data in the Accumulator and the specified Data Memory perform a bitwise logical XOR op- eration. The result is stored in the Accumulator. ACC ¬ ACC ²XOR² [m] Operation Affected flag(s) XORM A,[m]...
  • Page 72: Chapter 4 Assembly Language And Cross Assembler

    Cross Assembler Assembly-Language programs are written as source files. They can be assembled into object files by the Holtek Cross Assembler. Object files are combined by the Cross Linker to generate a task file. A source program is made up of statements and look up tables, giving directions to the Cross As- sembler at assembly time or to the processor at run time.
  • Page 73: Statement Syntax

    Cost-Effective I/O Type MCU Example of convention Description of convention Three dots following an item signify that more items with the same form may be entered. For example, the directive PUB- LIC has the following form: Repeating elements... PUBLIC name1 [,name2 [,...]] In the above form, the three dots following name2 indicate that many names can be entered as long as each is pre- ceded by a comma.
  • Page 74: Comment

    Chapter 4 Assembly Language and Cross Assembler Comment Comments are the descriptions of codes. They are used for documentation only and are ignored by the Cross Assembler. Any text following a semicolon is considered a comment. Assembly Directives Directives give direction to the Cross Assembler, specifying the manner in which the Cross Assem- bler generates object code at assembly time.
  • Page 75: File Control Directives

    Cost-Effective I/O Type MCU File Control Directives Syntax INCLUDE file-name INCLUDE ²file-name² · Description This directive inserts source codes from the source file given by file-name into the current source file during assembly. Cross Assembler supports at most 7 nesting levels. ·...
  • Page 76: Program Directives

    Chapter 4 Assembly Language and Cross Assembler Syntax .LISTINCLUDE .NOLISTINCLUDE · Description The directive .LISTINCLUDE inserts the contents of all included files into the program listing. The directive .NOLISTINCLUDE suppresses the addition of included files. The default is .NOLISTINCLUDE. Syntax MESSAGE ¢text-string¢...
  • Page 77 Cost-Effective I/O Type MCU For DATA sections, the byte address is in one byte units (8 bits/byte). BYTE aligns the section at any byte address, WORD aligns the section at any even address, PARA aligns the section at any address which is a multiple of 16, and PAGE aligns the section at any address which is a multiple of 256.
  • Page 78 Chapter 4 Assembly Language and Cross Assembler Syntax ORG expression · Description This directive sets the location counter to expression. The subsequent code and data offsets begin at the new offset specified by expression. The code or data offset is relative to the be- ginning of the section where the directive ORG is defined.
  • Page 79: Data Definition Directives

    Cost-Effective I/O Type MCU Syntax PROC name ENDP name · Description The PROC and ENDP directives mark a block of code which can be called or jumped to from other modules. The PROC creates a label name which stands for the address of the first instruction of a procedure.
  • Page 80 Chapter 4 Assembly Language and Cross Assembler Syntax [name] DB value1 [,value2 [, ...]] [name] DW value1 [,value2 [, ...]] [name] DBIT [name] DB repeated-count DUP(?) [name] DW repeated-count DUP(?) · Description These directives reserve the number of bytes/words specified by the repeated-count or reserve bytes/words only.
  • Page 81: Macro Directives

    Cost-Effective I/O Type MCU Macro Directives Macro directives enable a block of source statements to be named, and then that name to be re-used in the source file to represent the statements. During assembly, the Cross Assembler auto- matically replaces each occurrence of the macro name with the statements in the macro definition. A macro can be defined at any place in the source file as long as the definition precedes the first source line that calls this macro.
  • Page 82 Chapter 4 Assembly Language and Cross Assembler The following source program refers to the macro Delay ... T . A S M S a m p l e p r o g r a m f o r M A C R O . .
  • Page 83: Assembly Instructions

    Cost-Effective I/O Type MCU Assembly Instructions The syntax of an instruction has the following form: [name:] mnemonic [operand1[,operand2]] [;comment] where ® label name name: ® instruction name (keywords) mnemonic ® registers operand1 memory address ® registers operand2 memory address immediate value Name A name is made up of letters, digits, and special characters, and is used as a label.
  • Page 84 Chapter 4 Assembly Language and Cross Assembler The values of these shift bit operators are all constant values. The expression is shifted right SHR or left SHL by the number of bits specified by count. If bits are shifted out of position, the corresponding bits that are shifted in are zero-filled.
  • Page 85: Miscellaneous

    Cost-Effective I/O Type MCU Example 2: mov A, BANK var mov BP,A mov A, OFFSET var mov MP1,A mov A,IAR1 · Operator precedence Precedence Operators 1 (Highest) ( ), [ ] +, - (unary), LOW, MID, HIGH, OFFSET, BANK *, /, %, SHL, SHR +, - (binary) >...
  • Page 86: Reserved Assembly Language Words

    Chapter 4 Assembly Language and Cross Assembler Reserved Assembly Language Words The following tables list all reserved words used by the assembly language. · Reserved Names (directives, operators) INCLUDE LABEL OFFSET ELSE .LIST .LISTINCLUDE ENDIF .LISTMACRO PAGE ENDM LOCAL PARA ENDP PROC MACRO...
  • Page 87: Cross Assembler Options

    Cost-Effective I/O Type MCU Cross Assembler Options The Cross Assembler options can be set via the Options menu Project command in HT-IDE3000. The Cross Assembler Options is located on the center part of the Project Option dialog box. The symbols could be defined in the Define Symbol edit box. Syntax symbol1[=value1] [, symbol2[=value2] [, ...]] ·...
  • Page 88: Summary Of Assembly

    Chapter 4 Assembly Language and Cross Assembler · Summary l l l l ® line number (4 digits, right alignment) oooo ® offset of code (4 digits) hhhh ® two 4-digits for opcode E ® external reference C ® statement from included file R ®...
  • Page 89 Cost-Effective I/O Type MCU Example of Assembly Listing File F i l e : S A M P L E . A S M H o l t e k C r o s s - A s s e m b l e r V e r s i o n 2 .
  • Page 90: Part Iii Development Tools

    Part III Development Tools P a r t I I I Development Tools...
  • Page 91 Cost-Effective I/O Type MCU...
  • Page 92: Chapter 5 Mcu Programming Tools

    To ease the process of application development, the importance and availability of supporting tools for microcontrollers cannot be underestimated. To support its range of MCUs, Holtek is fully committed to the development and release of easy to use and fully functional tools for its full range of devices.
  • Page 93: Holtek In-Circuit Emulator - Ht-Ice

    Central to the system is the in-circuit hardware emulator, capable of emulating all of Holtek¢s 8-bit devices in real-time, while also providing a range of powerful debugging and trace fa- cilities. Regarding software functions, the system incorporates a user-friendly Windows based workbench which integrates together functions such as program editor, Cross Assembler, Cross Linker and library manager.
  • Page 94: Otp Programmer

    The Holtek OTP programmers are supplied with a standard Textool chip socket. The OTP Adapter Card is used to connect the Holtek OTP programmers to the various sizes of available OTP chip packages that are unable to use this supplied socket.
  • Page 95: Ht-Ice Interface Card Settings

    The J1 connector provides the I/O port connections as well as other pins. The DIP switch, SW1, should be set according to which device is selected and in accordance with the following table: Part No. Package Socket HT48R05A-1/HT48C05 16SSOP HT48R06A-1/HT48C06 18DIP/SOP HT48R08A-1/HT48C08 ¾...
  • Page 96: Installation

    Exercise care when using the power adapter. Do not use a power adapter whose output voltage is not 16V, otherwise the HT-ICE may be damaged. It is strongly recommended that only the power adapter supplied by Holtek be used. First plug the power adapter to the power connector of the HT-ICE.
  • Page 97 Cost-Effective I/O Type MCU Click <HT-IDE3000> button and the following dialog will be shown. Click <HT-IDE3000> or <Service Pack> as you want. Here¢s an Example of installing HT-IDE3000 Click <HT-IDE3000> button. · Step 2 Press the <Next> button to continue setup or press <Cancel> button to abort.
  • Page 98 Chapter 5 MCU Programming Tools · Step 3 The following dialog will be shown to ask the user to enter a directory name.
  • Page 99 Cost-Effective I/O Type MCU · Step 4 Specify the path you want to install the HT-IDE3000 and click <Next> button. · Step 5 Setup will copy all files to the specified directory.
  • Page 100 (EXE), dynamic link libraries (DLL) and configuration files (CFG, FMT) for all supported MCU. The INCLUDE subdirectory contains all the include files (.H, .INC) provided by Holtek. The LIB subdirectory contains the library files (.LIB) provided by Holtek. The SAMPLE subdirectory con- tains some sample programs.
  • Page 101 Cost-Effective I/O Type MCU...
  • Page 102: Chapter 6 Quick Start

    Chapter 6 Quick Start C h a p t e r 6 Quick Start This chapter gives a brief description of using HT-IDE3000 to develop an application project. Step 1 - Create a New Project · Click on Project menu and select New command ·...
  • Page 103: Step 5 - Transmit Code To Holtek

    Step 5 - Transmit Code to Holtek · Click on Project menu and select Print Option Table command · Send the .COD file and the Option Approval Sheet to Holtek The Programming and data flow is illustrated by the following diagram: .
  • Page 104: Appendix

    Appendix Appendix...
  • Page 105 Cost-Effective I/O Type MCU...
  • Page 106: Appendix A Device Characteristic Graphics

    Appendix A Device Characteristic Graphics A p p e n d i x A Device Characteristic Graphics The following characteristic graphics depicts typical device behavior. The data presented here is a statistical summary of data gathered on units from different lots over a period of time. This is for in- formation only and the figures were not tested during manufacturing.
  • Page 107 Cost-Effective I/O Type MCU Typical RC OSC vs. Temperature ° Typical RC Oscillator Frequency vs. V...
  • Page 108 Appendix A Device Characteristic Graphics vs. V ° ° ° ° vs. V ° ° ° °...
  • Page 109 Cost-Effective I/O Type MCU vs. V ° ° ° ° vs. V ° ° ° °...
  • Page 110 Appendix A Device Characteristic Graphics Typical R vs. V ° ° ° ° Typical V vs. V in -40°C to +85°C...
  • Page 111 Cost-Effective I/O Type MCU Typical I vs. V Watchdog Enable ° ° ° ° Typical t vs. V WDTOSC ° ° ° °...
  • Page 112 Appendix A Device Characteristic Graphics Typical I vs. Frequency (External Clock, Ta=-40°C) Typical I vs. Frequency (External Clock, Ta=0°C)
  • Page 113 Cost-Effective I/O Type MCU Typical I vs. Frequency (External Clock, Ta=+25°C) Typical I vs. Frequency (External Clock, Ta=+85°C)
  • Page 114 Appendix A Device Characteristic Graphics Typical V vs. Temperature °...
  • Page 115 Cost-Effective I/O Type MCU...
  • Page 116: Appendix B Package Information

    Appendix B Package Information A p p e n d i x B Package Information...
  • Page 117 Cost-Effective I/O Type MCU 16-pin SSOP (150mil) Outline Dimensions Dimensions in mil Symbol Min. Nom. Max. ¾ ¾ ¾ ¾ C¢ ¾ ¾ ¾ ¾ ¾ ¾ ¾ 0° 8°...
  • Page 118 Appendix B Package Information 18-pin DIP (300mil) Outline Dimensions Dimensions in mil Symbol Min. Nom. Max. ¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾ 0° 15°...
  • Page 119 Cost-Effective I/O Type MCU 18-pin SOP (300mil) Outline Dimensions Dimensions in mil Symbol Min. Nom. Max. ¾ ¾ ¾ ¾ C¢ ¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾ 0° 10°...
  • Page 120 Appendix B Package Information 24-pin SKDIP (300mil) Outline Dimensions Dimensions in mil Symbol Min. Nom. Max. ¾ 1235 1265 ¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾ 0° 15°...
  • Page 121 Cost-Effective I/O Type MCU 24-pin SOP (300mil) Outline Dimensions Dimensions in mil Symbol Min. Nom. Max. ¾ ¾ ¾ ¾ C¢ ¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾ 0° 10°...
  • Page 122 Appendix B Package Information 24-pin SSOP (150mil) Outline Dimensions Dimensions in mil Symbol Min. Nom. Max. ¾ ¾ ¾ ¾ C¢ ¾ ¾ ¾ ¾ ¾ ¾ ¾ 0° 8°...
  • Page 123 Cost-Effective I/O Type MCU...
  • Page 124 Copyright Ó 2006 by HOLTEK SEMICONDUCTOR INC. The information appearing in this Handbook is believed to be accurate at the time of publication. However, Holtek assumes no responsibility arising from the use of the specifications described. The applications mentioned herein are used solely for...
  • Page 125 Amendments...

This manual is also suitable for:

Ht48r06a-1Ht48r07a-1Ht48r08a-1Ht48r09a-1

Table of Contents