background image

jmp

receive

;no. test again                  

mov

a,9

;yes. start receiving            

mov

count,a

;load bit counter                

mov

a,b1

;load delay counter              

mov

delay,a

;(+1 for timing adjustment)      

rxdelay:

;                               

sdz

delay

;delay to fit baudrate           

jmp

rxdelay

;                               

mov

a,b1

;reload delay counter            

mov

delay,a 

;(+1 for timing adjustment)      

sdz

count

;if receive over?                

jmp

rxbit 

;no. receive next bit            

mov

a,rcreg 

;yes. put received data to Acc      

ret

;                               

rxbit:

;                               

set

c

;c=1                            

snz

rx

;if received ’1’?                

clr

c

;no. c=0                        

rrc

rcreg

;shift left through carry flag    

jmp

rxdelay

;repeat from rxdelay             

receive endp

;                               

end                                                       

Program description

The most important element here is the baudrate parameter because the
transmiting and receiving of data have to be coordinated with the baudrate
speed. For this reason a formula as well as a table is provided to define this
constant. Because in this example the baudrate is not defined by using the
timer/counter some small discrepencies may exist, however according to
our tests using an 8051 the values given in the table are error free. The
higher the baudrate parameter the lower the error rate so by adjusting the
value of baudrate and system frequency the baudrate parameter value can
be raised.

Chapter 15   Input/Output Applications

207

Содержание HT-IDE

Страница 1: ...C 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 photocopying recording or otherwise without the prior written permission of HOLTEK SEMICONDUCTOR INC ...

Страница 2: ...d The applications mentioned herein are used solely for the purpose of illustration and HOLTEK makes no warranty or representation that such applications will be suitable without further modification nor recommends the use of its products for application that may present a risk to human life due to malfunction or otherwise HOLTEK reserves the right to alter its products without prior notification ...

Страница 3: ...irement 7 Hardware installation 7 Software installation 8 Chapter 2 Quick Start 11 Chapter 3 HT IDE Menu File Edit View Tools Options 15 Start the HT IDE System 15 File Menu 17 Edit Menu 18 View Menu 19 Tools Menu 20 Mask option 20 Diagnose 21 OTP programmer 22 Library manager 22 VROM editor 23 Download voice 24 LCD simulator 24 Options Menu 24 Contents i ...

Страница 4: ...ble Command 36 Chapter 5 HT IDE Menu Debug 37 Reset the HT IDE System 38 To reset from the HT IDE commands 39 To reset from the target board 39 Emulation of Application Programs 40 To emulate the application program 40 To stop emulating the application program 40 To run the application program to a line 40 To directly jump to a line of an application program 41 Single Step 41 Breakpoints 42 Breakp...

Страница 5: ... Programmer Stand Alone Mode 73 Power on or system reset state 74 Primary functions 74 Gang Programmer 81 Part II Development Language and Tools 83 Chapter 9 Holtek C Language 85 Introduction 85 C Program Structure 86 Statements 86 Comments 86 Identifiers 87 Reserved words 87 Data types and sizes 87 Declaration 88 Constants 89 Integer constants 89 Character constants 89 String constants 89 Enumera...

Страница 6: ...cessor Directives 102 Predefined names 108 Holtek C Compiler Specifics 108 Using multiple souce files 108 Input Output ports system calls 109 Reset and interrupts 110 Difference between Holtek C and ANSI C 111 Keywords 111 Variables 111 Constants 111 Functions 111 Arrays 111 Constant variables 111 Initial value 112 Multiply Divide Modulus 112 Stack 112 Holtek C Compiler 113 Command arguments 113 A...

Страница 7: ...File Format 132 Chapter 11 Cross Linker 135 What the Cross Linker Does 135 Cross Linker Options 135 Libraries 135 Section address 136 Generate map file 136 Map File 136 HLINK Task File and Debug File 137 Chapter 12 Library Manager 139 What the Library Manager Does 139 To Set Up the Library Files 139 Create a new library file 141 Add a program module into a library file 142 Delete a program module ...

Страница 8: ... the HT Binary Editor 170 Creating a new file 171 Opening a file 171 Editing 171 Saving 173 Other commands 174 Chapter 14 LCD Simulator 175 Introduction 175 LCD Panel File 175 Relationship between the panel file and the current project 176 Entry situations of the HT LCDS 176 Set up the LCD Panel File 177 Set the panel configurations 177 Select the patterns and their positions 178 Add a new pattern...

Страница 9: ...192 Program description 195 LCM 196 Circuit design 196 Program 197 Program description 202 Using an I O Port as a Serial Application 203 Program 204 Program description 207 Chapter 16 Interrupt and Timer Counter Applications 209 Electronic Piano 209 Circuit design 210 Program 210 Program description 212 Clock 212 Circuit design 213 Program 213 Program description 218 Chapter 17 Parallel Port 219 R...

Страница 10: ...27 Instruction Sets 227 Appendix B Cross Assembler Error Message 231 Appendix C Cross Linker Error Messages 235 Appendix D Cross Library Error Messages 241 Appendix E Holtek Cross C Compiler Error Messages 243 Error Code 243 Warning Code 246 Fatal Code 248 HT IDE User s Guide viii ...

Страница 11: ...P a r t I Integrated Development Environment Part I Integrated Development Environment 1 ...

Страница 12: ...HT IDE User s Guide 2 ...

Страница 13: ...CE or In Circuit Emulator capable of emulating the Holtek 8 bit µC in real time in addition to providing powerful debugging and trace features As for the software the HT IDE provides a friendly workbench to ease the process of application program development by integrating all of the software tools such as editor macro assembler linker library and symbolic debugger into a user friendly windows bas...

Страница 14: ...re Windows based software utilities Source program level debugger symbolic debugger Workbench for multiple source program files more than one source progam file in one application project All tools are included for the development debug evaluation and genera tion of the final application program code mask ROM file Library for the setting up of common procedures which can be linked at a later date ...

Страница 15: ...ing hardware components The HT ICE box contains 2 PCBs printed circuit board with 1 printer port connector for connecting to the host machine I O signal connector and one LED Fig 1 2 I O interface card for connecting the target board to the HT ICE box Power adaptor output 9V 25 pin D type printer cable OTP programmer gang programmer optional Fig 1 2 Chapter 1 Overview and Installation 5 ...

Страница 16: ... with VR1 Fig 1 3 Refer to the Tools Mask Option Menu for the choice of the clock source and system frequency Fig 1 3 The 4 external signal trace inputs marked as ET0 to ET3 at jumper location JP3 exist to help the user trace and digitize signals and analyse their behavior Refer to the chapters on Breakpoint and Trace the Applica tion Program for more information The µC pin assignments in location...

Страница 17: ...E should be installed under Windows 95 Hardware installation Step 1 Plug the power adapter into the power connector of the HT ICE Step 2 Connect the target board to the HT ICE by using the I O interface card or flat cable Step 3 Connect the HT ICE to the host machine using the printer cable The LED on the HT ICE should now be lit if not there is an error and your dealer should be contacted Caution...

Страница 18: ...ss the Exit button to exit from the setup procedure A dialog box will request confirmation that an Exit command is the correct one Press the Help button to get user help Fig 1 4 Step 4 Type in the destination directory name for the HT IDE files The setup program will copy all files into this destination directory Fig 1 5 Press the Continue button to go to step 5 Press the Back button to go to step...

Страница 19: ...l process All execution files and description files used by the HT IDE are copied into the subdirectory BIN The included source files in the INCLUDE subdi rectory provided by Holtek may also contain the user s source program files while assembling The files in subdirectory LIB are library files provided by Holtek and they may be used when HLINK links all object files into a task file The SAMPLE su...

Страница 20: ...Fig 1 6 Fig 1 7 HT IDE User s Guide 10 ...

Страница 21: ...he dialog box Simulator is connected is displayed For windows 95 Click Start button select Programs select Holtek HT IDE Click the HT IDE icon Press the OK button when the dialog box Simulator is connected is displayed Step 2 Create Modify the source program files for the application Select the File menu New command to create a new source file or Select the File menu Open command to modify an exis...

Страница 22: ...ect the source files from the list Example Change the Directory to C HT IDE SAMPLE highlight the T1 ASM from the left window and press the Add button The filename C HT IDE SAMPLE T1 ASM is displayed in the Files in project window Repeat to add T2 ASM to the project SAMPLE Press the OK button after all source files have been added to the project Step 5 Change the HT IDE working mode The HT IDE is n...

Страница 23: ...nd the project rebuilt again The HT IDE enters the debugging mode after the download process is completed Step 7 Debugging and modifying the source program files Finally a correct ROM file with extension name cod is generated which is sent to Holtek for IC production The µC mask option data can also be printed out Note If the ROM file cod is required please check if the item has been selected To d...

Страница 24: ...HT IDE User s Guide 14 ...

Страница 25: ...ribed in the Project Debug and Window chapters Start the HT IDE System For windows 3 1 After running Windows 3 1 double click the Holtek HT IDE icon from within the Holtek group Fig 3 1 Fig 3 1 For windows 95 Click Start Button select Programs and select Holtek HT IDE Click the HT IDE icon 3 Chapter 3 HT IDE Menu File Edit View Tools Options 15 ...

Страница 26: ...een the HT ICE and the host machine has been made then Fig 3 3 is displayed the HT IDE enters the emulation mode and the HT ICE begins to function Fig 3 3 If this is the first time to enter the HT IDE i e no recorded projects or if the last project to exit from the HT IDE was in simulation mode then Fig 3 4 is displayed for confirmation The HT IDE will then enter the simulation mode Fig 3 4 The HT...

Страница 27: ...e icon will cause the command to be executed A status bar in the bottom line Fig 3 5 displays the emulation or simulation present status and the result status of commands Fig 3 5 File Menu The File menu provides file processing commands the details behind which are shown in the following list along with the corresponding toolbar icons New Create a new file Open Open an existing file Close Close th...

Страница 28: ...T IDE and return to Windows Edit Menu Undo Cancel the previous editing operation Redo Cancel the previous Undo operation Cut Remove the selected lines from the file and place onto the clipboard Copy Place a copy of the selected lines onto the clipboard Paste Paste the clipboard information to the present insertion point Delete Delete the selected information Find Search the specified word from the...

Страница 29: ...ndow The toolbar contains 8 groups of buttons whose function is the same as that of the command in each corresponding menu item When the mouse cursor is placed on a toolbar button the corresponding function name will be displayed next to the button If the mouse is clicked the command will be executed Refer to the corresponding chapter for the functionality of each button The Toggle Breakpoint butt...

Страница 30: ...ions The HT ICE provides two clock sources namely internal and external If an external clock source is chosen the jumper JP1 must be placed in the correct position For crystal mode add a crystal to location X1 and short positions 1 and 2 of jumper JP1 on the I O interface card For RC mode adjust the system frequency with VR1 and short positions 2 and 3 of jumper JP1 on the I O interface card Inter...

Страница 31: ...box and pressing the Test button or press the Test All button to diagnose all items These items are listed below µC resource option space Diagnose the uC options space of the HT ICE Code space Diagnose the program code memory of the HT ICE Trace space Diagnose the trace buffer memory of the HT ICE Data space Diagnose the program data memory of the HT ICE System space Diagnose the system data memor...

Страница 32: ...ommand in Fig 3 9 supports the library functions Program codes used frequently can be compiled into library files and then included in the application program by using the Project command in the Options menu Refer to Linker options item in Options menu Project command The functions of Library Manager are Create a new library file or modify a library file Add Delete a program module into from a lib...

Страница 33: ...or µC voice Select the voice resource files of format WAV or PCM Modify voice resource files Compress voice resource files to a VOC file to reduce the needed voice ROM size Modify the binary code if the VROM contains a voice program Refer to the chapter 13 for more details Fig 3 10 Chapter 3 HT IDE Menu File Edit View Tools Options 23 ...

Страница 34: ...D simulator HT LCDS provides a mechanism to simulate the output of the LCD driver According to the designed patterns and the control programs the HT LCDS displays the patterns on the screen in real time Chapter 14 gives more details on the LCD simulator Options Menu The Options menu Fig 3 12 provides the following commands which can set the working parameters for other menus and commands Project c...

Страница 35: ...Note Before issuing the Build command ensure that the project options are set correctly Fig 3 12 Fig 3 13 Chapter 3 HT IDE Menu File Edit View Tools Options 25 ...

Страница 36: ... the stand alone code If the stand alone code is generated the user can emulate the application program in the off line mode after loading to the HT ICE Generate COD file Check this box to generate the COD file This file will be sent to Holtek for manufacturing the masked ROM ICs after the program emulation and debugging tasks are completed The OTP programmer also needs this file Generate OTP file...

Страница 37: ...100 datasec 40 The check box of the Generate map file is used to check if the map file of HLINK is generated Debug command This command sets the options used by the Debug menu Chapter 5 HT IDE menu Debug The dialog box Fig 3 14 lists all the Debug options with check boxes By selecting the options and pressing the OK button the Debug menu can then obtain these options during the debugging process F...

Страница 38: ... is a read operation only and it is Write data if the execution is a write only or read and write operation The external signal status has no effect if the simulation mode is selected Stepping command Selects the automatic call procedure step option namely Step Into or Step Over Only one option can be selected Connection port Selects the PC connection port for the HT ICE One PC parallel port LPT1 ...

Страница 39: ...s Library files path The search path referred to by the HLINK to search for the library files Output files path The directory for saving the output files of the HASM obj lst and HLINK tsk map dbg Editor command This command sets the editor options such as tab size and Undo command count The Save Before Assemble option will save the file before assembly The Maximum Undo Count is the maximum allowab...

Страница 40: ...line From the available options Fig 3 17 Text Selection is used for the Edit menu Current line Breakpoint Line Trace Line and Stack Line are for the Debug menu and Error line is for the HASM output Fig 3 17 Font command This command will change the displayed fonts HT IDE User s Guide 30 ...

Страница 41: ...standpoint of the HT IDE system a working unit is a project with each user application described by a unique project When developing an HT IDE application for the first time the development steps as described earlier are recommended Note When setting the project s options during development it is recommended to select the Debug Mode which is the default mode Fig 4 1 4 Chapter 4 HT IDE Menu Project...

Страница 42: ... is to be worked upon the project should first be opened by using the Open command of the Project menu Fig 4 1 Then insert the project name directly or browse the directories and select a project name Use the Close command to close the project Note When opening a project the current project is closed automatically Within the development period i e during editing setting options and debugging etc e...

Страница 43: ...og box of the Project menu s Edit command Fig 4 3 To add a source file to the project Type the source file name into the text box of the File Name in the Edit dialog box or Choose the source file type and browse the List Files Choose the drive and directory where the source files are located using the browse Drives and Directories items Choose a source file name from the list box below the File Na...

Страница 44: ...oject source files have been added The µC options have been set refer to the Tools menu chapter There are two commands related to the building of a project file the Build command and the Rebuild All command The Project menu s Build command performs the following operations Assemble or compile all the source files of the current project by calling the Cross Assembler or C compiler depends on the fi...

Страница 45: ...t files The result message of executing a Build or Rebuild All command are displayed on the active window If an error occurs in the processing proce dure the actions following it are skipped and no task file is generated and no download is performed To build a project task file Click the Open command of the Project menu to open the project Click either the Build command of the Project menu or the ...

Страница 46: ...he output window one of the following com mands can be used to move the cursor to the error line Double click the left button of the mouse or Select the error message line on the output window and press the Enter key Print Option Table Command This command will print the current active option file to the specified printer A printer may be selected where the options file is to be printed out It is ...

Страница 47: ...uded are functions such as single stepping symbolic breakpoints automatic single stepping trace trigger conditions etc After the application program has been successfully constructed in the debug mode refer to the chapter on Build a project s task files the first execution line of the source program is displayed and highlighted in the active window Fig 5 1 The HT IDE is now ready to accept and exe...

Страница 48: ...tem Power on reset POR by plugging in the power adapter or pressing the reset button on the HT ICE Reset from the target board Software reset command in the HT IDE Debug menu Fig 5 2 Software power on reset command in the HT IDE Debug menu Fig 5 2 Fig 5 2 HT IDE User s Guide 38 ...

Страница 49: ...tion program otherwise the PC value is 0 and the emulation stops If the reset is from the target board the µC will start emulating the application after the reset is completed PC program counter PD power down flag TO time out flag To reset from the HT IDE commands Either choose the Reset command from Debug menu or click the Reset button on the toolbar to exectute a software reset Either choose the...

Страница 50: ...application program The Stop button on the toolbar is illuminated with a red color while the HT ICE is in emulation Pressing this button will stop the emulation process To stop emulating the application program There are three methods to stop the emulation shown as follows Set the breakpoints before starting the emulation Choose the Stop command of the Debug menu or press the hot key Alt F5 Press ...

Страница 51: ... emulation stop command is issued using the Stop command of the Debug menu In the automatic mode all user specified breakpoints are discarded and the step rate can be set from FAST 0 5 1 2 3 4 to 5 seconds There are 3 step commands namely Step Into Step Over and Step Out in each mode The Step Into command executes exactly one instruction at a time however upon encountering a CALL procedure will en...

Страница 52: ...press the hot key F10 or press the Step Over button on the toolbar To start Step Out Choose the Step Out command of the Debug menu or press the hot key Shift F7 or press the Step Out button on the toolbar Breakpoints The HT IDE provides a powerful breakpoint mechanism which accepts various forms of conditioning including program address source line num ber and symbolic breakpoint etc Breakpoint fe...

Страница 53: ... Space The location of the breakpoint either Program Code space or Data space Location The actual location of the breakpoint The next paragraph will give the location format Content The data content of breakpoint This item is effective only when the Space is assigned to the Data space The Read and Write check box are used for executing conditions of the breakpoint Externals External signal breakpo...

Страница 54: ... the breakpoint at the 48th line of the current active file Program symbol with or without the source file name The format is source_file_name symbol_name All are the same as the line number location format except that the line_number is replaced with symbol_name The following progam sym bols are acceptable Label name Section name Procedure name Dynamic data symbols defined in data section Format ...

Страница 55: ...rm respectively How to set breakpoints There are two methods to set enable a breakpoint one is by using the Breakpoint command from the Debug menu the other is by using the Toggle Breakpoint button on the toolbar The rules of the breakpoint mechanism are as follows If the breakpoint to be set is not in the breakpoint list box Fig 5 3 then the descriptive items must be designated first then added t...

Страница 56: ...ote If the total count of the effective breakpoints is less than 3 the newly added one will take effect automatically after it has been added If the breakpoints list box is full with 20 breakpoints the Add button is disabled and no more breakpoints can be added Fig 5 3 To delete a breakpoint Choose the Breakpoint command from the Debug menu or press the hot key Ctrl B A breakpoint dialog box is di...

Страница 57: ...execution processes and all relative information when the HT IDE is emu lating the application program The trace mechanism provides qualifiers to filter specified instructions and trigger conditions in order to stop the trace recording It also provides a method to record a specified count of the trace records before or after a trigger point Note When the HT IDE starts emulating refer to the sectio...

Страница 58: ... the conditions of trace recording both the Trigger Mode and Forward Rate specify the conditions to stop the trace recording The Trigger Mode specifies the kind of trigger point and is a standard used to determine the location of the stop trace point The Forward Rate specifies the trace scope between the trigger point and the stop trace point The available Trigger Modes are No Trigger No stopping ...

Страница 59: ... the trace recording will be stopped A Qualify list box records and displays all qualifiers used by the Trace Mode Up to 20 qualifiers can be added into the list box and and up to 6 qualifiers can be effective A Qualifier can be disabled or deleted from the list box The format of each qualifier in the Qualify list box has the same format as the breakpoint in the breakpoint list box refer to the se...

Страница 60: ... displayed as in Fig 5 4 Use the Forward Rate scroll bar to specify the desired rate Press the OK button To setup the condition A condition B Choose the Trace command of the Debug Menu A Trace dialog box is displayed as Fig 5 4 Press Condition A Condition B radio button Press the Set button A Set dialog box is displayed as in Fig 5 5 Enter the conditional information Press the OK button to close t...

Страница 61: ... below Press the OK button to close the Trace dialog box To delete a trace qualify condition Choose the Trace command from the Debug Menu A Trace dialog box is displayed as in Fig 5 4 Choose the qualify line to be deleted from the Qualify list box Press the Delete button Press the OK button to confirm To delete all qualify conditions Choose the Trace command from the Debug Menu A Trace dialog box ...

Страница 62: ...those instructions which satisfy the qualify conditions will be recorded in the trace buffer The Trace List command of the Window menu provides the functions to view and check the trace record information used for debug ging the program The trace record fields may not all be displayed on the screen except for the sequence number These fields are dependent upon the settings in the Debug sub menu fr...

Страница 63: ...g 5 7 Program count PC The program count of the instruction in this trace record Machine code CODE The machine code of this instruction Disassembled instruction INSTRUCTION The disassembled mnemonic instruction is disassembled using an HT IDE utility Execution data DAT The data content to be executed read write External signal status 3 The external signal 0 3 denotes the external signal ET0 ET3 re...

Страница 64: ... List command of the Window menu Clear the trace buffer The trace buffer can be cleared by issuing the Reset Trace command Hereafter the trace information will be saved from the beginning of the trace buffer Note that both the Reset command and the Power On Reset command also clear the trace buffer HT IDE User s Guide 54 ...

Страница 65: ...put messages of some utilities within the HT IDE In addition to the view function some commands such as Register Watch and RAM can also directly modify their contents Two commands namely Sim PAD and Sim Result provide a software interface to give direct control over I O signals and to view the corresponding outputs refer to chapter 7 Simulation of An Application Program Fig 6 1 shows the window wh...

Страница 66: ...in the RAM space The format for the symbols are source_file_name symbol_name The contents of the registers can also be displayed by typing the symbol name or register name and pressing the key The memory address and contents of the specified symbol or register are displayed to the right of the symbol The address and data are displayed in the following format address data contents Note that both ad...

Страница 67: ...te the correct contents at the end of the emulation process Fig 6 3 ROM This command displays the contents of the code memory space ROM The memory address is from 0 to the last address which is dependent upon the current project µC By using the scroll arrow the contents of the entire code memory can be viewed The contents of this memory however cannot be modified All contents are displayed in hexa...

Страница 68: ...nstruction the return address in the top stack will be popped and the line above is highlighted as the new top stack line If there is no line above the popped line then no line will be highlighted The format of each stack line is stack_level program_counter source_file_name line_number where the stack_level is the level number of the stack program_counter is the hex return address of the calling p...

Страница 69: ...put the result of an input instruction for this port e g MOV A PA will remain at the same value until the input level of this port is changed by this command Sim Result This command is enabled only when the current project is in the simula tion mode It displays the input output levels of all ports for the current project Output This command displays the results of executed tasks Cross Assembler Cr...

Страница 70: ...HT IDE User s Guide 60 ...

Страница 71: ...ICE before manufacture of the masked IC Start the Simulation Upon entering the HT IDE two situations may occur One is that a project has already been opened and the other is that no project has been opened In the first case the working mode of the HT IDE depends upon the working mode of this project In the latter case the working mode is in simulation Even if the working mode of a project is in em...

Страница 72: ...mulation how to obtain the input port signals and how to display the port output signals Fig 7 2 shows the simulation option dialog box Fig 7 2 In the Input Source box of Fig 7 2 the option buttons namely From PAD window and From file provide the port input methods The Monitor Port box provides the method to select which port information is to be displayed on the window HT IDE User s Guide 62 ...

Страница 73: ...indow Fig 7 3 shows the Sim PAD box in the Window menu Moving the cursor to the bit position of a port and then double clicking the mouse left button will toggle the input signal of the port By typing 0 or 1 into the port position the signal can be directly changed In the simulator 0 denotes logic low 1 denotes logic high and X denotes an output configuration These input signal levels are valid fo...

Страница 74: ...e Signal_Sequence is a sequence of 0 and 1s Blanks horizontal tabs and line feeds are also allowed in the sequence but are ignored by the simulator and are inserted to improve readability only Multiple Signal_Se quence lines are allowed The names of all ports can be referred to from the Monitor port box in the Simulation Options dialog box Fig 7 2 For I O ports the bit number should be appended to...

Страница 75: ...s number 1023 and so on Therefore the latest record number remains at 1023 even if more than 1024 records exist The PC field is the program count of an instruction This record contains the input output signals of the specified ports due to the execution of this instruction Pin_of_Port fields are the input output signals of all specified ports Only the Pins_of_ports specified in the Monitor Port bo...

Страница 76: ...HT IDE User s Guide 66 ...

Страница 77: ... is necessary for control of the OTP programmer In the stand alone mode the OTP programmer is controlled through push buttons on the OTP program mer without assistance from the PC host Components of the programmer The programmer consists of the following components An 8031 single chip A 32 pin DIP TEXTOOL a 20 pin DIP TEXTOOL and a 16 pin DIP TEXTOOL or only a 40 pin DIP TEXTOOL A 16 1 LCM for dis...

Страница 78: ... PRGW48 software utility contained within the HT IDE to control the OTP programmer Installation of the OTP Programmer Connect one side of the 25 pin D type cable to the OTP programmer and the other side of the cable to the COM1 or COM2 port of the PC host Plug the power adaptor to the the power connector J1 of the OTP programmer or attach power by clipping an alligator clip to the power pin termin...

Страница 79: ...mand in the Tool menu refer to chapter 3 3 5 or Double click the Prgw48 icon in the HT IDE group Note When using the OTP programmer command in the Tool menu the HT IDE will verify whether the COD file generated by the Build command in the Project menu of the current active project is newer than the task and option file of the current project If the COD file is found to be not the most recent one t...

Страница 80: ...hksum The Connect Port is the PC host serial port number e g COM2 which is connected to the OTP programmer The OTP Chip is the OTP chip name e g HT48R30 of the current COD file or OTP file The Chksum is the checksum of all codes in the COD or OTP file Fig 8 2 Note The Connect Port field is not displayed if the connection between the PC host and the OTP programmer fails The OTP Chip and Chksum fiel...

Страница 81: ...Binary Code and the Disassembled Instruction Area Downloads the file contents to the OTP programmer buffer A message dialog box and the LCM on the OTP programmer displays the download message Save As Save the contents of the buffer to an OTP file The contents of the buffer may be read from the OTP chip or loaded from the COD file using a Read command Exit Exit from the OTP utility and return to th...

Страница 82: ...is command Auto with Fuse This command performs the Auto command first if there is no error then the Fuse command is performed Blank Check Check if the OTP chip on the OTP Textool is blank The message Blank Checking is displayed while this command is executing and a result message displayed when this command has been completed Program Program the contents of the programmer buffer into the OTP chip...

Страница 83: ...ys information regarding the OTP utility Programmer Stand Alone Mode When an OTP IC has been verified and a batch of the same ICs are required the stand alone mode may be the most efficient method for OTP IC duplication To do this place the verified IC in the TEXTOOL socket and use Read to read the data from the verified IC Then place an empty OTP IC in the TEXTOOL socket and use Program to write ...

Страница 84: ... the Primary function state Primary functions There are four Primary functions Program Read Verify and Blank Check The Program function PRO writes the contents of the programmer buffer into the OTP chip and then verifies that the data in the OTP chip is the same as that in the programmer buffer The Read function RD reads the data from the OTP chip and saves it in the programmer buffer The Verify f...

Страница 85: ...PRO PLACE DEVICE Valid keys a ESC return to the previous state Primary function state b ENT start the program function if the OTP chip has been placed in the TEXTOOL Description The message PRO PLACE DEVICE prompts for the unwritten OTP chip to be placed in the TEXTOOL if not already there When programming of the OTP chip begins the following status may be displayed Status 1 LCM display PRG XX Val...

Страница 86: ...EAD function has not been previously exe cuted Return to the Primary function state to read the source code Status 4 LCM display CHIP IS LOCKED Valid keys ESC return to the Primary function state ENT program the next OTP chip Description This message warns that the OTP chip on the TEXTOOL has already been protected Another OTP chip may be placed on the TEXTOOL and the ENT key pressed to program ag...

Страница 87: ...iption This message RD PLACE DEVICE prompts for the unwritten OTP chip to be placed in the TEXTOOL if not already there When the programmer starts to read the OTP chip the following status may be displayed Status 1 LCM display RD aa SUM XXXX Valid keys ESC return to the Primary function state Description The flashing number aa represents the current address of the source code and the number XXXX i...

Страница 88: ...ool and press the ENT key to read again Primary function Verify Subfunction LCM display VER PLACE DEVICE Valid keys a ESC return to the previous state Primary function state b ENT start the VERIFY function if the OTP chip has been placed in the TEXTOOL Description This message is warning to place the OTP chip in the TEXTOOL if not already there When the programmer begins to verify the OTP chip the...

Страница 89: ...tion has not been previously exe cuted Return to the Primary function state to first read the source code Status 4 LCM display CHIP IS LOCKED Valid keys ESC return to the Primary function state ENT verify the next OTP chip Description This message warns that the OTP chip in the textool has already been protected Another OTP chip may be placed in the TEXTOOL and the ENT key pressed to verify again ...

Страница 90: ...e OTP chip in the TEXTOOL if not already there When the programmer starts to check the OTP chip the following status may be displayed Status 1 LCM display BCK aa Valid keys ESC return to the Primary function state Description The programmer is checking the OTP chip aa is the current address of the OTP chip ROM The number changes in the checking procedure and the following status may be displayed S...

Страница 91: ...er is from the PC file using the HT IDE or PRGW48 utility In the latter method the Exit command in the File menu must be executed after the PC source file has been read Program the OTP chips in stand alone mode Use the arrow key on the OTP programmer to move the cursor to the 8 on the LCM Place the OTP chips in the textools of the gang programmer The LEDs below the TEXTOOLs should turn off Start t...

Страница 92: ...HT IDE User s Guide 82 ...

Страница 93: ...P a r t I I Development Language and Tools Part II Development Language and Tools 83 ...

Страница 94: ...HT IDE User s Guide 84 ...

Страница 95: ...set of ANSI C is supported This chapter describes the C programming language supported by the Holtek C compiler This chapter covers the following topics C program structure Variables Constants Operators Program control flow Functions Pointers and arrays Structures and unions Preprocessor directives Holtek C specifics 9 Chapter 9 Holtek C Language 85 ...

Страница 96: ...de The main function is defined within the user application source code There may be more than one source file for an application but only one source file can contain the main function Comments Comments are used to document the meaning and operation of the source statements and can be placed anywhere in a program except for the middle of a C keyword function name or variable name The C compiler ig...

Страница 97: ...ult do else enum extern for goto if int long return short signed static struct switch typedef union unsigned void volatile while The reserved words double float register and sizeof are not supported by the Holtek C compiler Data types and sizes Only three basic data types are supported by the Holtek C compiler char a single byte holding one character int an integer occupying one byte void an empty...

Страница 98: ... this function is called and are non valid when exiting from the function If the variable is declared outside of all functions then it is global to all functions The qualifier const can be applied to a declaration of any variable to specify that the value of the variable will not be changed The variables declared with const are placed within the ROM space The const qualifier can be used in array v...

Страница 99: ...eceding the number by 0 zero Hexadecimal constant preceding the number by 0x or 0X Others not included above are decimal Character constants A character constant is an integer which is denoted by a single character enclosed by single quotes The value of a character constant is the numeric value of the character in the machine s character set ANSI C escape sequences are treated as a single characte...

Страница 100: ...checking and as a result is a better method than define Escape Character Description Hex Value a b f n r r v alert bell character backspace sharacter form feed character new line character carriage return character horizontal tab character vertical tab character backslash question mark character single quote apostrophe double quote character 07 08 0C 0A 0D 09 0B 5C 3F 27 22 Operators An expression...

Страница 101: ...r equal to Equality operators The equality operators are exactly analogous to the relational operators equal to not equal to Logical operators The logical operators support the logical operations AND OR and NOT They create a TRUE or FALSE value Expressions connected by and are evaluated from left to right The evaluation stops as soon as the result is known The numeric value of a relational or logi...

Страница 102: ...f var expr add the value of expr to var var expr subtract the value of expr from var var expr multiply var by the value of expr var expr divide var by the value of expr var expr modulus remainder when var is divided by expr var expr bitwise AND var with the value of expr var expr bitwise OR var with the value of expr var expr bitwise XOR var with the value of expr var expr right shift var by expr ...

Страница 103: ...he result are the type and value of the right operand For example f a t 3 t 2 c has three arguments the second of which has the value 5 Precedence and associativity of operators The following table lists the precedence and associativity of operators The precedence is from the highest to the lowest Each box holds operators with the same precedence Unary and assignment operators are right associa ti...

Страница 104: ...d assign subtract and assign left shift and assign right shift and assign bitwise AND and assign bitwise OR and assign bitwise XOR and assign right to left comma left to right Type conversions The general rule for type conversion is to convert a narrower operand into a wider one without losing information such as converting an integer into a long integer The conversion from char to long is sign ex...

Страница 105: ...nt and its block of statements may not exist as it is optional Example if word_count 128 word_count 1 line else word_count for statement Syntax for initial expression condition expression update expression statement The initial expression is executed first and only once It is used to assign an initial value to a loop counter variable This loop counter variable must be declared before the for loop ...

Страница 106: ...xample i 0 while b i 0 a i b i i do while statement Syntax do statement while condition expression Description The do while statement is another kind of while loop The statement is always executed before the condition expression is evaluated Hence the statement executes at least once then checks the condition expression Example i 0 do a i b i i while i 10 break and continue statement Syntax break ...

Страница 107: ...b i 0 break if b i 0 20 continue a j b i goto statement and label Syntax See the Syntax for switch statement Description A label has the same form as a variable name but followed by a colon It can be attached to any statement in the same function as the goto statement The scope of a label is the entire function Example See the switch statement example switch statement Syntax switch variable case c...

Страница 108: ...that evaluates if an expression matches one of many alternatives and branches accord ingly It is equivalent to multiple if else statements The switch statement s limitation is that the switch variable must be an integral data type and can only be compared against constant values Example for i j 0 i 10 i switch b i case 0 goto outloop case 0 20 break default a j b i j break outloop Functions In the...

Страница 109: ...tements modern form return type function name var type arg1 var type arg2 statements Passing arguments to functions There are two methods for passing arguments to functions Pass by value This method copies the argument values to the correspond ing formal parameters of the function Any changes to the formal parame ters will not affect the original values of the corresponding variables in the callin...

Страница 110: ...ss pointed to by the variable In addition to and there are four operators that can be applied to the pointer variables Only integer quantities may be added or subtracted from pointer variables An important point to remember when performing pointer arithmetic is that the value of the pointer is adjusted according to the size of the data type it is pointing to Arrays An array is a list of variables ...

Страница 111: ...id data types Members within the structure may have different data types The variable list declares variables of the type struct name Each item in the structure is refered to as a member After defining a structure other variables of the same type are declared with the following syntax struct struct name variable list To access a member of a structure specify the name of the variable and the name o...

Страница 112: ...ommon_area char name 3 int id long date cdata Preprocessor Directives The preprocessor directives give general instructions on how to compile the source code It is a simple macro processor that conceptually processes the source codes of a C program before the compiler properly parses the source program In general the Preprocessor directives do not translate directly into executable code It removes...

Страница 113: ...gnostic message mes sage string Example if TOTAL_COUNT 100 error Too many count endif Conditional inclusion if else endif Syntax if expression source codes else source codes endif Description The if and endif directives pairs are used for conditionally compiling code depending upon the evaluation of the expression The else which is optional provides an alternative compilation method If the express...

Страница 114: ...se the source code that follows the else statement if it exists will be compiled Example ifdef DEBUG_MODE define TOTLA_COUNT 100 endif Conditional inclusion ifndef Syntax ifndef symbol source codes else source codes endif Description The ifndef directive is similar to the ifdef directive The else which is optional provides alternative compilation If the symbol has not been defined then the source ...

Страница 115: ...to see if it is nonzero If so then the source codes that follows the elif statement will be compiled Otherwise the source code that follows the else statement if it exists will be compiled Example if MODE 1 define DISP_MODE1 elif MODE 2 define DISP_MODE7 endif Conditional inclusion defined Syntax if defined symbol source codes else source codes endif Description The unary operator defined can be u...

Страница 116: ...ame or include file name Description include inserts the entire text from another file at this point in the source file When file name is used the compiler looks for the file in the directory specified by the environment variable INCLUDE If the INCLUDE is not defined the C compiler looks for the file in the path When file name is used the C compiler looks for the file as specified If no directory ...

Страница 117: ...nsidered to be the given constant which must be a decimal number If the filename is given __FILE__ is set to the file named If filename is absent the remembered file name is not changed Example line 20 ht48c10 asm Machine dependence pragma Syntax pragma Token String pragma vector Symbol Address Description The pragma directive causes machine dependent behavior when the Token String is of a form re...

Страница 118: ...the time of compilation in the form hh mm ss __STDC__ The constant 1 It is intended that this symbol be defined to be 1 only in standard conforming implementation Holtek C Compiler Specifics This section describes some fundamental requirements of the Holtek C compiler language The topics are Using multiple source files Input Output ports system calls Reset and Interrupts Using multiple souce files...

Страница 119: ...r 0 00 to the port C Read Write control registers unsigned char peekPXC Read data from port X control register X A B C D E F G Example unsigned char i i peekPEC read an input value from the control register of port E saved in i void pokePXC unsigned char write data to port X control register X A B C D E F G Example pokePBC 0 20 write a value of 0x20 to the control register of port B Set Clear bits...

Страница 120: ... clrPCC4 clear bit 4 of port C control register Reset and interrupts The Holtek C language provides a means for implementing reset and interrupts vectors through the preprocessor directive pragma The direc tive pragma vector is used to declare the name and address of the reset and other interrupt vectors A function with the same name as the reset vector becomes the reset routine which is executed ...

Страница 121: ...0 25 declare the flag in the offset 0x25 of RAM Constants Holtek C supports binary constants Any string that begins with 0b or 0B will be treadted as a binary constant For example 0b101 5 0b1110 14 Functions Avoid using reentrant and recursive code Arrays Holtek C allows one dimensional arrays only An array should be located in a contiguous block of memory and must not have more than 256 elements ...

Страница 122: ...h lib library if these arith metical operators are used To include a library select options in the main menu select project put the library name in the libraries field Stack Because the Holtek HT48CX0 microcontrollers have from 2 to 8 stacks the programmer needs to consider the function call depth to avoid stack over flow The multiply divide and modulus of the Holtek C language are implemented by ...

Страница 123: ...e log_file_name nologo This argument disables the compiler to output the compiler version information ASM calls C functions Instead of using the stack the Holtek C compiler uses RAM to pass arguments to functions To call C functions in an assembly file you need to declare the names of function and arrguments as external The names of C functions are translated into the name preceeding with an under...

Страница 124: ...all _maxmin Example 2 long foo int a int b int c _foo the function name foo0 the name of a argument foo1 the name of b argument foo2 the name of c argument Assume we want to call foo 1 2 3 in the assembly file and put the return value in retval variable dw retval extern _foo near extern foo0 byte extern foo1 byte extern foo2 byte extern LH byte mov a 1 mov foo0 a mov a 2 mov foo1 a mov a 3 mov foo...

Страница 125: ... comments Notational Conventions The following list describes the notations used by this document Example of convention Description of convention optional items Syntax elements that are enclosed by a pair of brackets are optional For example the syntax of the command line is as follows HASM options filename In the above command line options and are both optional but filename is required except for...

Страница 126: ...as long as each is preceded by a comma Statement Syntax The construction of each statement is as follows name operation operands comment All fields are optional Each field except the comment field must be separated from other fields by at least one space or one tab character Fields are not case sensitive i e lower case characters are changed to upper case characters before processing Name Statemen...

Страница 127: ...ns of codes They are used for documentation only and are ignored by the assembler Any text following a semicolon is considered a comment Assembly Directives Directives give direction to the assembler specifying the manner in which the assembler generates object code at assembly time Directives can be further classified according to their behavior as described below Conditional Assembly directives ...

Страница 128: ...e name has not yet been defined The conditional assembly directives support a nesting structure with a maximum nesting level of 7 Example IFDEF buf_flag buffer DB 20 dup ENDIF In this example the buffer is allocated only if the buf_flag has been previously defined by the directive EQU or the option D of the command line File control directives Syntax INCLUDE file name Description This directive in...

Страница 129: ...nes to the program listing file The default is LIST Example NOLIST mov a 1 mov b1 a LIST In this example the two instructions in the block enclosed by NOLIST and LIST are suppressed from copying to the source listing file Syntax LISTMACRO NOLISTMACRO Description The directive LISTMACRO causes the assembler to list all the source statements including comments in a macro The directive NOLIST MACRO s...

Страница 130: ...e while assembling this directive has to be used within the source file otherwise an error will occur Note This directive must be located before the first instruction statement Syntax name SECTION align combine class Description The SECTION directive marks the beginning of a program section A program section is a collection of instructions and or data whose ad dresses are relative to the section b...

Страница 131: ... the resulting area is the length of the longest section AT address Causes all label and variable addresses defined in a section to be relative to the given address The address can be any valid expression except a forward reference It is an absolute address in a specified ROM RAM bank and must be within the ROM RAM range If no combine type is given the section is combinative i e this section can b...

Страница 132: ...o any included file should be avoided 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 beginning of the section where the directive ORG is defined The attribute of a section determines the actual value of offset absolute or relative...

Страница 133: ...bel name which stands for the address of the first instruction of a procedure The assembler will set the value of the label to the current value of the location counter Example toggle PROC mov tmpbuf a mov a 1 xorm a flag mov a tmpbuf ret toggle ENDP Syntax label DC expression1 expression2 Description The DC directive stores the value of expression1 expression2 etc in consecutive memory locations ...

Страница 134: ...n be used with each radix Radix Type Digits B Binary 01 O Octal 01234567 D Decimal 0123456789 H Hexadecimal 0123456789ABCDEF Table 9 1 Digits Used With Each Radix 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...

Страница 135: ...ample the variable accreg is equal to 5 and bmove is equal to the instruction mov 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 assembler automatically replaces each occurrence of the macro name with the statements in the macro definition A macro can be defined at...

Страница 136: ... and are replaced by actual parameters when calling this macro label1 and label2 are both declared LOCAL and are replaced by 0000 and 0001 respectively at the first reference if no other macro is referred If no LOCAL declaration takes place label1 and label2 will be referred to labels similar to the declaration in the source program At the second reference of this macro a multiple define error mes...

Страница 137: ...000 Sample program for MACRO 3 0000 ListMacro 4 0000 Delay MACRO tmp1 tmp2 5 0000 LOCAL label1 label2 6 0000 mov a 70h 7 0000 mov tmp1 a 8 0000 label1 9 0000 mov tmp2 a 10 0000 label2 11 0000 clr wdt1 12 0000 clr wdt2 13 0000 sdz tmp2 14 0000 jmp label2 15 0000 sdz tmp1 16 0000 jmp label1 17 0000 ENDM 18 0000 19 0000 data section data 20 0000 00 BCnt db 21 0001 00 SCnt db 22 0002 23 0000 code sect...

Страница 138: ...e program The microcontroller type needs to be specified prior to the first instruction statement in the source program by using the directive CHIP Operand operator and expression Operands source or destination are the argument defining values that are to be acted on by instructions They can be constants variables registers expressions or keywords When using the instruction statements care must be...

Страница 139: ...mber of bits specified by count If bits are shifted out of position the corresponding bits that are shifted in are zero filled The following are such examples mov A 01110111b SHR 3 result ACC 00001110b mov A 01110111b SHL 4 result ACC 01110000b Bitwise operators NOT AND OR XOR NOT is a bitwise complement AND is a bitwise AND OR is a bitwise inclusive OR XOR is a bitwise exclusive OR OFFSET operato...

Страница 140: ...e forward referenced Local labels A local label is a label with a fixed form such as digit The digit can be 0 1 to 9 The function of a local label is the same as a label except that the local label can be used repeatedly The local label should be used between any two consecutive labels and the same local label name may used between other two consecutive labels The assembler will transfer every loc...

Страница 141: ...STMACRO PAGE ENDP LOCAL PROC EQU LOW PUBLIC EXTERN MACRO ROMBANK AND HIGH MOD SHL CHIP IF NOLIST SHR DB IFDEF NOLISTINCLUDE XOR Reserved Names instruction mnemonics ADC HALT RLCA SUB ADCM INC RR SUBM ADD INCA RRA SWAP ADDM JMP RRC SWAPA AND MOV RRCA SZ ANDM NOP SBC SZA CALL OR SBCM TABRDC CLR ORM SDZ TABRDL CPL RET SDZA XOR CPLA RETI SET XORM DAA RL SIZ DEC RLA SIZA DECA RLC SNZ Reserved Names reg...

Страница 142: ...de company name the HASM version number source file name date time of assembly and page number Source program listing Each line in the source program has the following syntax line number offset code statement Line number is the number of the line starting from the first statement in the assembly listing file 4 digits A line number is generated only if a cross reference file is required The 2nd fie...

Страница 143: ...ment R n l l l l line number 4 digits right alignment oooo offset of code 4 digits hhhh two 4 digits for opcode C statement from included file n Macro expansion line E external reference R relocatable name Summary of assembly The total warning number and total error number is the information provided at the end of the assembler listing file Miscellaneous If any errors occur during assembly each er...

Страница 144: ...dbit 17 0003 18 0000 code section code 19 0000 0F55 mov a 055h 20 0001 0080 R mov b1 a 21 0002 0FAA mov a 0aah 22 0003 0080 R mov b2 a 23 0004 0F00 mov a 0 24 0005 0093 mov pac a 25 0006 0095 mov pbc a 26 0007 0097 mov pcc a 27 0008 0700 R mov a b1 28 0009 0092 mov pa a 29 000A 0700 R mov a b2 30 000B 0094 mov pb a 31 000C end 0 Errors HT IDE User s Guide 134 ...

Страница 145: ...tegrated Development Environment into the Holtek HT ICE In Circuit Emulator for debugging The libraries included by HLINK were generated by the HLIB library manager Cross Linker Options The options specify and control the tasks performed by HLINK In chapter 3 Option Menu Project command provides a dialog box Linker Options to specify these options to the HLINK These options are Libraries Syntax li...

Страница 146: ...t the end of the map file The map file also lists the names and loads addresses of all public symbols The names and file name of the external symbols or procedures are recorded in the map file if no corresponding public symbol or procedure can be found The contents of the map file are as follows Holtek R Cross Linker Version 3 20 Copyright C HOLTEK Microelectronics INC 1997 1998 All rights reserve...

Страница 147: ... other HLINK output file is the debug file which contains all information referred to by the HT IDE debugging program This information includes source file names symbol names and line num ber as defined in the source files The HT IDE will refer to the symbolic debugging function information This file should not be deleted unless the debugging procedure is completed otherwise the HT IDE will be una...

Страница 148: ...HT IDE User s Guide 138 ...

Страница 149: ...ter on ASSEMBLY LAN GUAGE The HASM generates the output object file OBJ while HLIBW adds this object file into the specified library file When HLINK has found unresolved names in a program during the linking process it will search the library files for these unresolved names and extracts a copy of the module containing that name If an unresolved name has been found in this library module the modul...

Страница 150: ...Fig 12 1 Fig 12 2 HT IDE User s Guide 140 ...

Страница 151: ...displayed Type in a new library file name and press the OK button Fig 12 4 is displayed for confirmation If the Yes button is chosen a new library file will be created but will not contain any program modules Fig 12 3 Fig 12 4 Chapter 12 Library Manager 141 ...

Страница 152: ...ox Object module information Press the Open button Fig 12 3 is displayed Select a library file from the box below the File name box press OK button From Fig 12 2 all the object modules of the selected library file are listed in the Object in Library box The following information about each object module is also listed in the Objects Information box Maximum ROM size The maximum size used by this ob...

Страница 153: ...tation Working carefully through the examples simultaneously looking at both the code and the explanation should give a good introduction to some useful microcontroller programming techniques Although specific microcontrol lers are chosen for the application in question the same general program ming techniques apply to other controllers Part III Utilities 143 ...

Страница 154: ...HT IDE User s Guide 144 ...

Страница 155: ...e detail Quick Start for µC Voice Microcontrollers The purpose of this section is to quickly obtain familiarisation with the µC Voice Development System If this is the first time that the system is used we strongly recommend that you read this section first and follow the step by step guide In this section a step by step guide is first introduced followed by the resources supported by the system a...

Страница 156: ...ct SAMPLE will be created and a Mask Option window Mask Option for HT82770 is displayed Change the option selection according to the application project Press the SAVE button to save the mask options Step 3 Add the voice sources Invoke the voice ROM editor HTVDS827 EXE by selecting the Tools menu then the VROM Editor command The Body Type box located on the left bottom side will display HT82770 wh...

Страница 157: ...on the volume jmp 12 end 13 This program is used to play the first track which is edited by the VROM Editor Step 6 Add the source files to the project Add the above example T ASM into this new project Select the Project menu Edit command Double click the file t asm created on the previous step Step 7 Change the HT IDE working mode The HT IDE shall be working in emulation mode Select the Options me...

Страница 158: ...he voice inc contains the compression method used to compress tracks According to this file the development system can link to some corresponding decompressing algo rithms There are other functions or control flags defined in this file With these decompressing algorithms short and simple program can easily be written to control track playing This file must be included in the program if these decom...

Страница 159: ...compressing algorithms the ISR could be invoked once when the sampling rate counter overflows and the stack is not full In the ISR the value of the accumulator and the status registers are preserved but the value of the following registers might be changed TBLP 07H TBLH 08H DAL 20H DAH 21H ROMC 2CH Important Since the registers TBLP and TBLH might be changed in the ISR it is important to disable t...

Страница 160: ...e address 8 Since there is no other function called in the ISR it is not necessary to be concerned about the status of the stack If there are other functions that have to be performed when the sampling rate counter overflows they can be joined together by jumping first to application specific functions and at the end of that function jump to AdpcmISR For example example asm code section at 0 code ...

Страница 161: ...me sound tracks always remember to rebuild the project again This is because the include file voice inc may have been changed If everything has been prepared as mentioned above the playing sound can be controlled in the program Here one macro and three flags are provided the speech macro the standby flag the pause flag and the stop flag The following gives a more detailed explanations The AdpcmQui...

Страница 162: ...errupt will be enabled two level stacks will be used the flag tempo 7 is set setting this flag is to enable the D A output sampling rate counter and counter ROM and the value of the following registers may be changed Accumulator 05H Status 0AH ROMC 2CH If the TrackNumber is left empty the speech will not initialise the track number register which is used by the decompression algorithms Because the...

Страница 163: ...e standby flag The standby flag is a one bit read only flag which indicates the playing status It will be set if the decompression algorithm is on standby and is waiting for some tracks to be played For example to demonstrate usage of this flag if there are five tracks recorded in the voice ROM and all have to be played one by one the following short program can be used Z equ 0AH 2 include voice i...

Страница 164: ...p begin org 8 jmp AdpcmISR begin set 22H again speech 0 12H 1 waiting sz standby jmp again sz pa 0 jmp waiting clr acc Loop sdz acc jmp Loop sz pa 0 jmp waiting sz pause toggle pause jmp ps1 set pause jmp Pa0Release ps1 clr pause Pa0Release wait until pa 0 release snz pa 0 jmp Pa0Release jmp waiting end The stop flag The stop flag is a one bit flag used to terminate the playing If it is set the pe...

Страница 165: ...0 jmp begin org 8 jmp AdpcmISR begin set 22H again speech 0 12H 1 waiting sz standby jmp again sz pa 0 jmp waiting clr acc Loop sdz acc jmp Loop sz pa 0 jmp waiting set stop stop jmp end Quick reference AdpcmQuickMode Used to turn on quick mode for either 3 bit ADPCM or 4 bit ADPCM Define before voice inc is included Usage define AdpcmQuickMode For example define AdpcmQuickMode include voice inc C...

Страница 166: ...e sound tracks Usage speech TrackNo SamplingRate VoiceDown For example to play the first track 8kHz assuming the system fre quency is 4MHz then speech 0 12H 1 Standby A one bit read only flag indicates the status of playing If it is set a sound track has been playing Usage sz standby or snz standby For example to set port A high when the microcontroller is on standby waiting snz standby jmp waitin...

Страница 167: ...top playing when bit 0 of port A is low Waiting sz pa 0 jmp waiting set stop Using the VROM Editor This chapter outlines the file types that the HT VDS827 creates then briefly describes the menu commands and how to construct a VPJ file Fig 13 1 Main screen of HT VDS827 Chapter 13 µC VROM Editor HT VDS827 157 ...

Страница 168: ...hod used This file can be used for error checking Creating a new VPJ file Step 1 In the main screen of the HT VDS827 choose the New command from the File menu to create a new project Step 2 From the Body Type Selection Box select a body to meet the desired requirement Each body has its corresponding voice ROM space as shown below Body Voice Rom Space Byte HT82700 128K HT827A0 128K HT82720 96K HT82...

Страница 169: ...g box as shown below Step 3 Select the appropriate model to compress the source voice file The voice quality must be sacrificed in order to save the voice ROM space There is a trade off between compression model and sound quality Four compression models are available 3 bit ADPCM 4 bit ADPCM 6 bit PCM 8 bit PCM Chapter 13 µC VROM Editor HT VDS827 159 ...

Страница 170: ...erent compression results Changing the length of silence and the silence toler ance changes the compressed file length and the free ROM size because silence has a concise compression format Four lengths of silence and thirteen silence tolerances are available HT IDE User s Guide 160 ...

Страница 171: ...s all files together The compressed files are listed in the Sound List Box The sound list box displays the file name compressed file size and the compression model used in their processing order The files with All files List files of type item selected will not be compressed by any kind of compression model Step 7 The order of the compressed files can be changed by dragging the file with the right...

Страница 172: ...refer to the following sections Step 10 To save the current edited project select the Save As command from the File menu The Save As command creates three files VPJ VOC and NUM Selecting the Print command prints a table which shows the compressed file name the starting address of the file in the voice ROM and the compression model used No File Name Starting Address Compression 0 7v2d wav 00000015 ...

Страница 173: ...s required to listen to the original sound of the source file double click the source file in the Files list box with the right mouse This function allows the sound before and after compression to be compared and the best choice made File menu The File pop up menu consists of New Open Save as and Print com mands New Create a new project Open Open an existing project VOC file must exist in the same...

Страница 174: ...ose All commands Tile Tile all opened files on the screen Cascade Cascade all opened files on the screen Close All Close all the opened project files Arrange Icons Arrange all icons Using the HT Voice Editor The main screen of HT Voice Editor is shown below This chapter explains how to edit a wave file and describes all the files and the menu commands HT IDE User s Guide 164 ...

Страница 175: ...cord Function Dialog screen appears Fill out the dialog box File Name Sample Rate and other options Press the Begin button to start recording Step 3 The default longest record time is 25 sec if the option is 8 bits per sample and Mono If more time is needed select the Memory command in the Option menu The Memory Setting Dialog box is shown as follows Press the End button to stop recording Chapter ...

Страница 176: ...peatedly select the number of times to play from the following combo box Step 3 The Sample Rate can be adjusted to differentiate between the sounds produced You can also adjust the Sampling Rate and then you can differentiate between the sounds produced This command will not change the voice data but the sampling rate when playing Different sampling rate will come with difference sound in frequenc...

Страница 177: ... copying the Paste command in Edit menu or the button will be enabled This command can be selected or button pressed to paste the range in the clipboard to the current position Step 3 Delete Mark a range first and then select the Delete command in the Edit menu Step 4 Re sample Sample rate of the file can be changed by selecting the ReSample com mand in the Edit menu The ReSample Dialog is shown b...

Страница 178: ...ers are taken Sampling rate 8000Hz 1 default setting Sampling rate 8000Hz 1 Channel 8 Bits Per Sample So we can set the correct setting by using ChangeFormat command Step 6 Change Code Before changing the code a range must first be marked or defined in the Change Code Dialog box as shown below The Code can be changed by selecting the Change Code command in the Edit menu To replace the data marked ...

Страница 179: ... and type in the desired offset value If the offset value is negtive voice data will down offset that means if the offset value is positive voice data will up offset Save command Voice type Save To save a file select the Save command in the File menu or press the button If the file name is not specified the system will show a Save As dialogue box Save As To save the current file under another name...

Страница 180: ...le it is called Arrange in short menu all opened files on the screen Cascade Window Cascade all opened files on the screen Arrange Icons Window Arrange all icons on the screen Close All Window Close all opened files Using the HT Binary Editor The main screen of the HT Binary Editor is shown below This is a simple binary editor used to communicate with the HT VDS827 This chapter explains how to edi...

Страница 181: ...The following Open File dialogue box appears Type in the full path or press the Browse button to select a file and input the starting address from where the file is loaded in the Start Address edit box Editing Go To To go to a specific position select the Go To command from the Edit menu or press the button A Go To dialogue box appears Type in the position you want to go to in Hex and press the OK...

Страница 182: ...n the Start Address End Address and data in Hex and then press the Ok button Move To copy data from a specified range to a target address select the Move command in the Edit menu or press the button A Move dialogue box appears Type in the Start Address End Address and Target Address and then press the Ok button HT IDE User s Guide 172 ...

Страница 183: ...art Address and End Address to be saved and then press the Ok button Save As To save the current file under another name select the Save As command in the File menu A Save As dialogue box appears Type in the full path in the File Name edit box or press the Browse button to select a file Input the Start Address and End Address to be saved and then press the Ok button Chapter 13 µC VROM Editor HT VD...

Страница 184: ...y Editor File Show information about the system Tile or Arrange Window Tile called Arrange in short menu all opened files on the screen Cascade Window Cascade all opened files on the screen Arrange Icons Window Arrange all icons on the screen Close All Window Close all opened files on the screen 28 HT IDE User s Guide 174 ...

Страница 185: ... that if the micro controller of the current project does not support LCD functions these commands are disabled LCD Panel File Before starting the LCD simulation an LCD panel file must first be set up otherwise the HT LCDS cannot simulate the LCD action If the micro controller of the current project has an LCD driver then a corresponding panel file should be setup for simulation The LCD simulator ...

Страница 186: ... com mand is used to activate a panel file whether for the same project name or not If the HT LCDS was in simulation mode while exiting the previous time from the HT IDE the HT LCDS will be automatically invoked in simula tion mode the next time the HT IDE is used In this situation the HT LCDS refers to the panel file with the same name as the project name Entry situations of the HT LCDS When sele...

Страница 187: ...e selection Select the patterns and their positions This will setup the relationship between the patterns and the COM SEG positions Set the panel configurations The only way to set the panel configuration is to create a new panel file by selecting the File menu New command The Panel Configuration dialog box in Fig 14 4 will be displayed along with the corresponding panel file name Set the correct ...

Страница 188: ...the project s Dot Matrix Mode To simulate the dot matrix type of LCD panel or not The dot matrix screen is similar to Fig 14 5 Fig 14 5 Note Do not set different COM or SEG number from the actual corresponding numbers which are set for the microcontroller LCD otherwise the results will be unpredictable Select the patterns and their positions When Fig 14 2 appears during the panel file creation pro...

Страница 189: ...Select a pattern i e a bitmap file from the pattern list box or click the Browse button to change to another directory and select a pattern from it The HT LCDS uses 2 color bitmap files as the image source of patterns The Preview window zooms in the selected pattern Set the X Y positions of the selected pattern in the panel screen Press the OK button which returns the screen to Fig 14 2 then click...

Страница 190: ... been created or modified Simulate the LCD Before starting the LCD simulation ensure that the correrct panel file is referred to by the HT LCDS It is dependent upon the following two situations Still in LCD simulation mode when exiting from HT IDE If the HT LCDS was in simulation mode the last time the HT IDE was exited it will return to this mode the next time HT IDE is run The HT LCDS will refer...

Страница 191: ...ins simulation Fig 14 7 is displayed and the most recent LCD datum displayed on the panel screen Stop the simulating Click the X box on Fig 14 7 to stop the HT LCDS simulation and exit Fig 14 7 Chapter 14 LCD Simulator 181 ...

Страница 192: ...HT IDE User s Guide 182 ...

Страница 193: ...tation Working carefully through the examples simultaneously looking at both the code and the explanation should give a good introduction to some useful microcontroller programming techniques Although specific microcontrol lers are chosen for the application in question the same general program ming techniques apply to other controllers Part IV Programs and Application Circuits 183 ...

Страница 194: ...HT IDE User s Guide 184 ...

Страница 195: ...n the main program section however this is not recommended unless the circuit design calls for special double function I O port operation Scanning Light This example gives a functional emulation of a scanning LED array Here a row of LEDs will light in turn one after the other The circuit uses the PA port PA0 PA7 each bit of which is connected via a 240Ω series resistor to an LED Circuit design The...

Страница 196: ... subroutine reti for guarantee org 0ch timer event 1 interrupt subroutine reti for guarantee start clr intc initialize registers clr tmrc to guarantee performance clr tmr interrupts set pac ports set pbc input mode set pcc main mov a 0 1 mov pac a set port A to output port mov pa a zero port A all lamp on mov a 0feh 2 1111 1110 1 OFF 0 ON mov lamp a set initial lamp state llamp shift lamp left loo...

Страница 197: ...irst setting up the ports as either output or input as shown in section 1 Here as all ports are to be set as outputs the control register for PA known as PAC should only contain zeros In section 2 bit 0 of Port A is set low which illuminates the first LED Section 3 is a time delay to allow the LED illumination to be visible In section 4 the RLC or rotate left instruction is used to move the illumi...

Страница 198: ...hing time can be programmed Circuit design The circuit uses the two port sections PA0 PA2 and PA4 PA6 with each one representing a set of traffic lights on each road at a crossroad intersection The operation of the circuit will be self explanatory from the contents of the program See the circuit diagram for more details of the hardware Program include ht48c10 inc data section data data section cou...

Страница 199: ...e to port A mov pa a call delayl 4 delay for a long while inc tblp 5 mov a 7 load flash counter mov flash a flash1 flash1 loop tabrdl rglight load light state mov a rglight mov pa a output light state to port A call delays 6 delay for a little while inc tblp sdz flash if flash light over jmp flash1 no flash again tabrdl rglight yes go ahead load light state mov a rglight output light state to port...

Страница 200: ... load counters mov count1 a mov count2 a mov count3 a d1 sdz count3 count down count3 jmp d1 sdz count2 count down count2 jmp d1 sdz count1 count down count1 jmp d1 ret delayl endp delaym proc medium delay subroutine mov a 07h load counters mov count1 a mov a 0ffh mov count2 a mov count3 a d2 sdz count3 count down count3 jmp d2 sdz count2 count down count2 jmp d2 sdz count1 count down count1 jmp d...

Страница 201: ... of port control register PAC is set to 0 as all bits in this port are used as outputs As the illuminated condition of the red yellow and green lights is fixed a table read instruction can be used to determine their values as shown in section 2 however the values must first be setup Because the last page TABRDL instruction is used the table data is setup from address 300h The highest address is 3F...

Страница 202: ...d displayed By using this method 8 logic lines can control up to 16 switches with required values assigned to each key Circuit design PA0 PA3 are assigned as outputs and PA4 PA7 assigned as inputs to gether forming a 4 4 matrix Note that during creation of the project PA4 PA7 should have the pull high option selected from the mask option The program detects which key was pressed while a look up ta...

Страница 203: ...B to output mode clr pa zero port A latch 0 set pb off LEDs keyloop mov a 0feh 2 scan first row of keys mov matrix a hold scan code mov pac a pa 0 output 0 latch mov a pa read input state cpl acc complement input state and a 0f0h sz acc if any input jmp get_key yes get input info mov a 0fdh 2 no scan second row mov matrix a hold scan code mov pac a pa 1 output 0 latch mov a pa read input state cpl...

Страница 204: ...sp output data to port B mov pb a 11 jmp keyloop repeat keyloop key_in proc get key number mov a pa hold port A state mov temp a 4 get_release wait for the key to be released mov a pa test port A state cpl acc and a 0f0h sz acc 6 if release jmp get_release no keep up waiting mov a 0fh yes calculate key number andm a matrix 7 mask low nibble of scan code mov a 0 keep table index at register A get_r...

Страница 205: ...t determine the exact key which has been pressed For example in section 2 the first line is scanned to see if key 0 3 has been pressed If so this code then jumps out of this scanning loop to a subsection 3 to determine which key connected to this line has been pressed If not the code moves on to look at the line containing keys 4 7 and so on After entering this code subsection the code first store...

Страница 206: ...onsidered to produce the correct microcontroller signals For more detailed timing and instruction information the LCM manufacturer s data should be consulted first LCMs can operate in either 4 bit or 8 bit mode Using a 4 bit mode of operation transmitting a character or an instruction to the module re quires two transmission events to complete the operation With an 8 bit mode of operation only one...

Страница 207: ... EQU pbc LCM_CTRL EQU pc define port C eaual LCM control port LCM_CTRL_CTRL EQU pcc LCM Display Commands and control Signal name E EQU 0 signal pin number RW EQU 1 RS EQU 2 main asm define HEADER_HT48C30 include ht48c30 inc include lcm inc define four_bit define four_bit for 4 bit mode extern busy_chk near import external module extern delay near extern write_char near extern snd_cmd near data sec...

Страница 208: ...SPLAY_INIT ifdef four_bit mov a 20h 4 bit mode else mov a 30h 8 bit mode endif mov LCM_DATA a set LCM_CTRL E write instruction code to clr LCM_CTRL E initalize LCM LCM_DELAY delay for LCM setup timing mov a 0ffh need about 4 5ms mov counter1 a mov counter0 a lp0 sdz counter1 jmp lp0 sdz counter0 jmp lp0 CMD_SEQ ifdef four_bit mov a 28h 4 bit mode and 2 lines 2 pass byte else 28h for 2 lines and 20...

Страница 209: ...k busy flag mov a CURSOR_HOME cursor home call snd_cmd call busy_chk check busy flag clr tblp load table pointer 0 start show HOLTEK 8 bit µC agn tabrdl msg load message data mov a msg mov tmp a mov a 24h line end 24h xorm a msg sz msg if line end jmp agn1 no show next char jmp secn_line yes show next line agn1 call busy_chk check busy flag mov a tmp call write_char write char to LCM inc tblp next...

Страница 210: ... 700h code table at last page htk_tbl dc 0048h 004fh 004ch 0054h 0045h 004bh 0020h 0038h 0024h dc 0020h 0062h 0069h 0074h 0020h 0075h 0043h 0024h end module LCM asm include lcm inc define four_bit define this for 4 bit mode public busy_chk public delay public write_char public snd_cmd dataLCM section data dtmp db dtmp2 db codeLCM section code snd_cmd snd_cmd write instruction code ifdef four_bit 4...

Страница 211: ...a set LCM_CTRL E pulse high swapa LCM_DATA a 3 a 0 7 m 4 a 7 a 4 3 m 0 clr LCM_CTRL E pulse low and a 0fh 4 bit mode low nibble 2nd pass or a dtmp combine 2 pass endif sz acc 7 is busy jmp busy_chk yes check again clr LCM_CTRL RW no go ahead clr LCM_DATA_CTRL set LCM_DATA to output port ret write_char write_char write data to LCM ifdef four_bit 4 bit mode 2 pass mov dtmp a and a 0f0h filter high n...

Страница 212: ...for the HD44780 there needs to be at least 4 5 ms delay between each program This is the function of the LCM_DELAY code section Before the LCM initialization has been carried out it is not possible to check the status of BUSY To issue instructions to the LCM refer to the HD44780 instruction definitions The code section LCM INC contains several often used instructions Before the LCM writes instruct...

Страница 213: ...ram uses 4 RAM locations 2 I O pins and 49 program memory locations The TXPIN must be defined as an output and RXPIN defined as an input Before Call or Receive the RXPINs stop bit condition must be checked Calling these two subroutines will change the condition of the carry flag When using Routines the program must first declare them as follows EXTERN TRANSMIT NEAR EXTERN RECEIVE NEAR Below the ma...

Страница 214: ...eive mode extern transmit near external functions extern receive near data section data data section transmit_data db receive_data db counter db code section at 0 code program section org 00H jmp start org 04h external interrupt subroutine reti for safeguard org 08h timer event 0 interrupt subroutine reti for safeguard org 0ch timer event 1 interrupt subroutine reti for safeguard start clr intc in...

Страница 215: ...v a 32 load counter mov counter a again call receive receive 1 byte mov r0 a put received data to buffer inc mp0 buffer index 1 sdz counter receive over jmp again no continue receiving jmp yes stop program endif test section at 1f00h code test_table data fo transmitting 32 bytes dc 012h 034h 056h 078h 09ah 0bch 0deh 0f0h 011h 022h 033h 044h 055h 066h 077h 088h dc 099h 0aah 0bbh 0cch 0ddh 0eeh 0ffh...

Страница 216: ...t counter mov count a txdelay sdz delay delay to fit baudrate jmp txdelay mov a baudrate reload delay counter mov delay a sdz count if transmit over jmp sendbit no send next bit jmp endtx yes go ahead sendbit rrc txreg shift right through carry flag snz c is 1 jmp lobit no goto lobit set tx yes send 1 jmp txdelay repeat from txdelay lobit clr tx send 0 jmp txdelay repeat from txdelay endtx nop del...

Страница 217: ...at from rxdelay receive endp end Program description The most important element here is the baudrate parameter because the transmiting and receiving of data have to be coordinated with the baudrate speed For this reason a formula as well as a table is provided to define this constant Because in this example the baudrate is not defined by using the timer counter some small discrepencies may exist h...

Страница 218: ...HT IDE User s Guide 208 ...

Страница 219: ...e 16 or 8 bit value loaded into the timer counter Additionally the timer counters can be divided up into three types event counter timer or pulse width measurement type The event counter type receives generated signals from outside while the timer type uses the internal system clock as its base timing Electronic Piano This unit describes how to implement a scanning keyboard and then from the press...

Страница 220: ...setup as inputs with each line connected to a pull up resistor Pressing a key will bring the corresponding line low PB0 is setup as an output and is the line where the required frequency appears By changing this line from hi to lo and vice versa the required frequency can be generated Program include ht48c50 inc data section data data section temp db hold temporary data sound db hold freq code sec...

Страница 221: ...find out which key jmp keyloop no repeat from keyloop whichkey proc 3 find out which key mov temp a hold Acc content mov a 0 zero table index mov tblp a clr c c 0 check each bit key by carry flag keynext rrc temp shift right through carry flag sz status 0 if carry some key was pressed jmp timerset yes output sound inc tblp 4 no table index point to next inc tblp 2 bytes key jmp keynext check next ...

Страница 222: ... the table This is done by incrementing the table pointer until the correct location is reached The value is divided into a high byte and low byte these two values have to be placed in the correct high low byte position of the timer counter 5 After the value is placed and counted an interrupt is generated by the timer counter and the interrupt routine is run and the correct output 6 placed on Port...

Страница 223: ...ated every 0 5 seconds so by counting two interrupts a means of obtaining the basic timing unit of 1 second is obtained The application shown uses 4 seven segment displays to display a clock in 24 hour format displaying both hours and minutes Two keys are provided to provide for adjustment of hours and minutes Circuit design PA0 PA7 are setup as outputs with PA0 PA3 setup as the display data PA4 P...

Страница 224: ...then off 0 5s reti end ISR org 0ch timer event 1 interrupt subroutine reti for safeguard start clr intc initialize registers clr tmr0c to guarantee performance clr tmr0h interrupts clr tmr0l clr tmr1c clr tmr1 set pac ports set pbc input mode set pcc set pdc main clr pac 1 set port A to output port mov a 7fh set port B to input port mov pbc a exclude pb 7 clr pb 2 zero variables clr pa clr minl cl...

Страница 225: ...c tblp mov a hourh load displaying data mov disp a high hour call show_clock show displaying up 1st 7 segment jmp loop repeat from loop cal_number proc inc minl minl 1 mov a minl sub a 0ah sz acc if over 10 minutes ret no return clr minl yes minl 0 inc minh minh 1 mov a minh sub a 06h sz acc if over 60 minutes ret no return clr minh yes minh 0 mov a hourh sub a 02h sz acc if over 20 hours jmp h_20...

Страница 226: ...d no check sceond overflow clr c sub a 78h 6 78h 120 unit 0 5 second sz acc if overflow jmp scan_next no continue scanning clr second yes secon 0 call cal_number 7 calculate clock digits ret scan_next sdz count1 if count over counter 1 jmp d1 no scan keys again ret yes return min_inc call delays delay for key releasing snz pb 0 if key was released jmp min_inc no test again call inc_min yes minute ...

Страница 227: ...unter mov count1 a d2 sdz count1 count down count1 jmp d2 ret delays endp inc_hour proc mov a hourh sub a 02h sz acc if over 20 hours jmp h_201 no goto h_201 inc hourl yes hourl 1 mov a hourl sub a 04h sz acc if over 24 hours ret no return clr hourl yes hourl 0 clr hourh hourh 0 ret return h_201 inc hourl hourl 1 mov a hourl sub a 0ah sz acc if over 10 hours ret no return clr hourl yes hourl 0 inc...

Страница 228: ...e has reached 59 the next value will be set to 00 but the hour value will not be increased Similarly if the hour value has reached 23 the next value will be 00 but the minute value will not be changed If no key has been pressed the program remains in the program loop to display the time Because the program has been setup to provide an interrupt every 0 5 seconds a 1 minute time interval is generat...

Страница 229: ...well suited for the HT48x00 series of controllers ROM Emulator During the first stages of system development it is normally impractical to burn the required ROM The usual procedure is to use a suitable EPROM to replace the ROM during the stages of program and system development In this way by using an ultra violet light source the internal EPROM programmed data can be erased and the device reused ...

Страница 230: ...t A is defined as the low order bits while Port B is defined as the high order bits Port C is for the control lines To use in a practical application it is necessary to connect both the address and data lines of the SRAM to the ROM socket of the application HT IDE User s Guide 220 ...

Страница 231: ...r addrh db high byte address register timer_ov db timer overflow register PC0 WR PC1 OE PC2 ACK PC3 BUSY code section at 0 code program section org 00h ISR address setup jmp start org 04h external INT ISR jmp int_sub org 08h timer ISR jmp timer_sub org 0Ch int_sub mov a 00000011b move acc 00000011 BUSY 0 ACK 0 OE 1 WR 1 mov pc a 5 output acc to port c reti return from external ISR timer_sub inc ti...

Страница 232: ...r mov a 00001001b move acc 00001001 BUSY 1 ACK 0 OE 0 WR 1 mov pc a 3 output acc to port C clr acc store store snz acc 0 4 check acc 0 0 if external INT interrupt will change acc 0 1 jmp store if acc 0 0 jump store clr pac 5 if acc 0 1 set port A as output port clr pbc set port B as output port next next mov a addrl 6 mov pa a output low byte address register to port A mov a addrh mov pb a output ...

Страница 233: ...trol reg start counting mov a 00001011b move acc 00001011 BUSY 1 ACK 0 OE 1 WR 1 mov pc a 11 output acc to port C clr acc clear acc store1 store1 snz acc 0 4 check if acc 0 0 if external INT interrupt will change acc 0 1 jmp store1 if 0 jump storel clr tmrc 4 set timer control reg stop counting snz acc 3 12 check acc 3 1 acc 3 1 timer time out acc 3 0 external INT jmp next if not 1 jump next jmp t...

Страница 234: ...o write the data into the SRAM and after a time delay 8 will return to its original inactive value After this the ACK line is activated 9 to confirm the data transfer and again after a short time delay it returns to its original inactive state At this point the write cycle is complete The BUSY signal is now returned to its inactive state 11 permitting further data to be written When the STROBE sig...

Страница 235: ...P a r t V Appendix Part V Appendix 225 ...

Страница 236: ...HT IDE User s Guide 226 ...

Страница 237: ...lator and carry to the data memory ADD A m add the data memory to the accumulator ADD A x add immediate data to the accumulator ADDM A m add the accumulator to the data memory AND A m logical AND the accumulator with the data memory AND A x logical AND immediate data to accumulator ANDM A m logical AND the data memory with the accumulator CALL addr subroutine call CLR m clear the data memory CLR m...

Страница 238: ...mulator JMP addr direct jump MOV A m move the data memory to the accumulator MOV A x move an immediate data to the accumulator MOV m A move the accumulator to the data memory NOP no operation OR A m logical OR the accumulator with the data memory OR A x logical OR immediate data to the accumulator ORM A m logical OR the data memory with the accumulator RET return from the subroutine RET A x return...

Страница 239: ... m increment te data memory place the result in the accumulator and skip if zero SNZ m i skip if bit i of the data memory is not zero SUB A m subtract the data memory contents from the accumulator SUB A x subtract immediate data from the accumulator SUBM A m subtract the data memory contents from the accumulator and save the result to the data memory SWAP m swap nibbles within the data memory exce...

Страница 240: ...XOR A m logical XOR the accumulator with the data memory XOR A x logical XOR immediate data to the accumulator XORM A m logical XOR the accumulator with the data memory HT IDE User s Guide 230 ...

Страница 241: ...orward references A0013 Expression syntax error Syntax error in expression A0014 HASM internal stack overflow This error is due to HASM processes the expression analysis A0016 Duplicated MACRO argument Two formal arguments in the MACRO definition line with the same name A0017 Syntax error in MACRO parameters Syntax error in MACRO formal parameters expression A0018 Wrong number of parameters The to...

Страница 242: ...INCLUDE file nesting levels The maximum number of INCLUDE nesting levels is 7 include other files recursively A0027 IF too deep Too many IF ENDIF pair nesting levels The maximum nesting level is 7 A0028 ELSE without IF No directive IF before the directive ELSE IF ELSE ENDIF pair is unbalanced A0029 ELSE after ELSE No directive ENDIF or IF after the directive ELSE IF ELSE ENDIF pair is unbalanced A...

Страница 243: ...ock nesting of directive PROC ENDP is illegal A0042 expected The single quote is missing A0043 Non digit in number The number token contains a non digit character A0044 EXTERN needs an identifier There is no identifier specified in the EXTERN directive A0045 Data type expected The data type of the identifier should be declared A0046 Unknown data type The data type is unknown A0047 expected The is ...

Страница 244: ...urce file name in the command line A4004 Incorrect command line syntax The command line syntax is illegal A4005 Could not find file The specified file is not found A4006 No CHIP directive No directive CHIP in the source file A4007 Bad instruction format file The instruction description file is incorrect A4008 HASM internal fatal error HASM failure please contact dealer A4009 Out of memory Not enou...

Страница 245: ... system free memory L1004 Illegal section address dddd The section address specified in the command line option ADDR is illegal The address dddd should be in hex Refer to chapter 10 section 10 2 L1005 Illegal command option option The specified option option in the command line is illegal Refer to chapter 10 section 10 2 for legal options L1006 Batch file lbatch bat is not found The specified batc...

Страница 246: ...the same uC configuration during assembling L1013 Library file libname lib does not exist The specified library file libname lib does not exist or the library file has not been generated by Holtek s Cross Library HLIB Check if the library file libname lib is in the working directory L1014 Cannot close the library file filename lib HLINK has failed to close the specified file Contact dealer 1015 Li...

Страница 247: ... mapname map HLINK fails to create the map file mapname map Check the PC file system and working directory or contact dealer L1025 Program code too large The total size of program code is larger than the uC ROM size Check and Modify the program code in CODE sections L1026 Program data is too large The total size of the program data sections is larger than the µC RAM size Check and Modify the DATA ...

Страница 248: ...heck if the address and the length of the section sec name of the input file filename obj are outwith the ROM or RAM range Modify the program or specify a correct starting address for this section L1037 Two sections are overlapping Section sec name1 in the file filename1 obj Section sec name2 in the file filename2 obj The ROM or RAM space allocated for the section sec name1 in the file filename1 o...

Страница 249: ...e mismatch Public symbol symbol1 in module mod name1 External symbol symbol1 in module mod name2 HLINK found that an external symbol and a public symbol have the same name but have a different symbol type Check the symbol type of this external symbol modify the source file re assemble the file and re link L3001 Specified section sec name does not exist The specified section sec name in the command...

Страница 250: ...HT IDE User s Guide 240 ...

Страница 251: ...9 Can t open the list file U0010 Can t insert a new module to library U0011 Can t open the object file U0012 Delete operation fails U0013 Replace operation fails U0014 A module with the same name exists in library already In any library file there cannot exist two modules with the same name HLIB will check this situation when processing ADD operation U0015 The module doesn t exist in library The s...

Страница 252: ...bol needs to be public refer to chapter 8 8 2 3 program directive for PUBLIC directive and re assemble the source file then use HLIB to replace the new object file with the old module U0019 Illegal operation U0020 Fail to close a file U0021 Check sum is incorrect HLIB internal error U0022 Fail to out record to the library file HLIB internal error U0023 Out checksum error HLIB internal error U0024 ...

Страница 253: ... no if C1012 defined token is not a name C1013 defined token token cannot be redefined C1014 Incorrect syntax for defined C1015 Bad syntax for control line C1016 Preprocessor control control not yet implemented C1017 Duplicate macro argument C1018 Syntax error in macro parameters C1019 Macro redefinition of macro name C1020 Disagreement in number of macro arguments C1021 EOF in macro argument list...

Страница 254: ...r identifier C2014 undefined size for type identifier C2015 extraneous identifier identifier C2016 size is an illegal array size C2017 illegal formal parameter types C2018 missing parameter type C2019 expecting an identifier C2020 extraneous old style parameter list C2021 illegal initialization for parameter identifier C2022 invalid operator field declarations C2023 missing operator tag C2024 type...

Страница 255: ...invalid operand of unary identifier is declared register C2054 invalid type argument type to sizeof C2055 sizeof applied to a bit field C2056 cast from type1 to type2 is illegal C2057 found type expected a function C2058 left operand of has incompatible type type C2059 field name expected C2060 left operand of has incompatible type type C2061 illegal use of type name type C2062 illegal use of argu...

Страница 256: ...el in goto C2093 unrecognized statement C2094 illegal statement termination C2095 redefinition of label identifier previously defined at life_line_no C2096 illegal type type in switch expression C2097 duplicate case label value C2098 illegal return type found type1 expected type2 C2099 type error pointer expected C2100 illegal type array of type C2101 missing array size C2102 type error array expe...

Страница 257: ...er C4012 old style function definition for identifier C4013 compatibility of type1 and type2 is compiler dependent C4014 identifier is a non ANSI definition C4015 missing return value C4016 static type identifier is not referenced C4017 parameter type identifier is not referenced C4018 local type identifier is not referenced C4019 register declaration ignored for type identifier C4020 more than 12...

Страница 258: ... C4048 more than 257 cases in a switch C4049 switch generates a huge table C4050 pointer to a parameter local identifier is an illegal return value C4051 source code specifies an infinite loop C4052 more than 127 identifiers declared in a block C4053 reference to type elided C4054 reference to volatile type elided C4055 declaring type array of type is undefined C4056 qualified function type ignore...

Отзывы: