Home

87AD SERIES - FreeBSD developer home pages

image

Contents

1. lv Jeung s 0 U9UM 51 9161 WIN 40 3vH 94 ueuw uo ueg 93oN 0 02134 J9junoo 0002 92d 1ue e 1eUul L o 9 82d 2 olL CLNI E2d OMOS COd 1 jeues 18 GENERAL DESCRIPTION CHAPTER 1 ies CMOS Products 1 5 Functional Comparison of 87AD Ser 70128 1128 jo 2 pue Hod 10 uondo Aq penunuoo eg o1 vL X vL 440 211580 uid p9 e onsejd uld gg e 14651214S dino onseid 9 e dIND 9nsejd uid p9 e Oz X v1 nsed uid p9 e 082 dIa 34446 onsejd Uld 7g e ued 510151591 dn jnd 0 uoneJjodjoou e3o0N 89 e dIND 9nsejd uid p9 e 02 X v1 440 211580 uid p9 e 087 did xuuus uid p9 e vv 29 pexoojo xejdnp inj LYVN sjauueyo g x 8 1 110 9 7 119 8 Je1unoo 1euut 8 jeu1e1u eu91X3 sidnueiu 510 8 X 946 IVY diuo uo
2. 61 4 3 Port A Specifled as Output ter eodd eg 62 4 4 Port A Specified as 62 4 5 Mode Register nen nennt rende 65 4 6 Mode Control Register ted eode th orie st e dede leer d duis 66 4 7 Mode G Register Format uoce teretes eres rea EXE READ RI UR ru 67 4 8 Port C Specified as Control Signal Output 2 42 4 422098290 68 4 9 Port C Specified as Control Signal 1 68 4 10 Model REGISTER FORM at 71 5 1 Timer Diagra Mi m 76 5 2 Timer Mode Register TMM 000022 0 nem 78 6 1 Timer Event Counter Block e bees bus 81 6 2 Timer Event Counter Mode Register Format 2 22 022 2020 000000 87 6 3 Output Control Circuit Block Diagram Output 2 2 2 3 22 5 3 9 88 6 4 Timer Event Counter Output Mode Register Format 89 6 5 Timer Event Counter Setting Procedure 4202022222220 90 6 6 Timer Event Counter Mode Register Setting Interval Timer Mode
3. 4loooo o Slo 2Sloooooooo c c c c ooooo 4loooooooo c c c c SOloooo c l3lo0o0oooooooooooc c c c g E go ee lt gt lt 5 e gt EC Tz 5 jo o o oc B ui KC BEoo ooc c 23 5 gt gt e 23 N D T 5 gt o gt gt gt gt AadnaaatsSCHHNOGuUFSSSSSSPOEFFOCOCOON 9j monmu r gt gt 2 H a om 70 dlo o oc o djooooooo c c c oooocooo oococooc cloo ooc c diOoooooooooooooo ooooo lt _ 7 N rp gt GI N 2 2 _ E lt o gt aa Tw o o alo o ejo T e e gt E E q ay a 2 lo o o Alo 215 CHAPTER 14 INSTRUCTION SET 14 3 Instruction Address Addressing The instruction address is de
4. 91 6 7 Interval Timer Mode Operation 91 6 8 Timer Event Counter Mode Register Setting Event Counter Mode 92 6 9 Event Counter Mode Operation Em 92 6 10 Timer Event Counter Mode Register Setting Frequency Measurement Mode 93 6 11 Frequency Measurement Mode Operation 2 2 12 2 2 2022222 222001010112 93 6 12 Timer Event Counter Mode Register Setting Pulse Width Measurement Mode 94 6 13 Pulse Width Measurement Mode Operation 222 22 99555 95 6 14 Timer Event Counter Output Mode Register Setting 2 222 22 9 95 6 15 Timer Event Counter Mode Register Setting Programmable Rectangular Wave Output Mode n 96 6 16 Programmable Rectangular Wave Output Mode 96 6 17 Timer Event Counter Mode Register Setting Programmable Rectangular Wave Output ECNT Clear COO Output Reset 98 6 18 Port C Setting Programmable Rectangular Wave 98 6 19 Timer Event Counter Mode Register Setting Programmable Rectangular Wave Output EGNT Operation Setting 99 6 20 SINGIS PUSS Paese att te tendente qued ulster 100
5. 178 Hardware STOP Mode Release Timing RESET Signal Input 178 Hardware STOP Mode Release Timing STOP Signal Rising to RESET Signal Input 179 Relation between Von arid SB Flag n eet tee eats Mb c dade eg 179 Oscill tor Connection cus tre aei sequo cde Mead sess 182 Example of External Clock Input CIRCUIT cit recedit ere rre toe d pere teer 182 Examples of Poor Resonator Connection 2 2 1 020 21 212212221100 nes 183 viii LIST OF FIGURES 3 3 Figure No Title Page 11 1 External Expansion Modes Set by Memory Mapping Register 189 11 2 Memory Mapping Register Format uPD78C18 78C14 78C144 78C124 78C114 191 1 3 Example of Memory Expansion Reference 192 11 4 Memory Mapping Register Settings 2 2 2 2 2 2202 00000000 0 193 1 5 HPD71055 Connection Diagram Reference Diagram 195 11 6 Memory 078618 45 eaim aa ettet ea HR rede nae utes 196 11 7 Memory Map uPD78614 78G TAA us ter tna dan quet pda ERR RE 196 11 8 Mernorymap 4PD 786124 eet pn drea reete De dE adea bua rab
6. EN RAGA ENSS AI Corporation 1991 USER S MANUAL NEC 87AD SERIES uPD78C18 8 BIT SINGLE CHIP MICROCONTROLLER Document No U10199EJ5VOUMOO 5th edition Previous No IEU 1314 Date Published August 1995 P Printed in Japan NOTES FOR CMOS DEVICES 1 PRECAUTION AGAINST ESD FOR SEMICONDUCTORS Note Strong electric field when exposed to a MOS device can cause destruction of the gate oxide and ultimately degrade the device operation Steps must be taken to stop generation of static electricity as much as possible and quickly dissipate it once when it has occurred Environ mental control must be adequate When it is dry humidifier should be used It is recommended to avoid using insulators that easily build static electricity Semiconductor devices must be stored and transported in an anti static container static shielding bag or conductive material All test and measurement tools including work bench and floor should be grounded The operator should be grounded using wrist strap Semiconductor devices must not be touched with bare hands Similar precautions need to be taken for PW boards with semiconductor devices on it HANDLING OF UNUSED INPUT PINS FOR CMOS Note No connection for CMOS device inputs can be cause of malfunction If no connection is provided to the input pins it is possible that an internal input level may b
7. nz un Tv MA 0 PAn Output port 1 PAn Input port n 2 0 7 7 6 5 4 3 2 1 0 pa par Tee Ton To 61 CHAPTER 4 PORT FUNCTIONS 1 When specified as output port MAn 0 The output latch is effective enabling data exchange by a transfer instruction between the output latch and the accumulator Direct bit setting resetting of output latch contents is possible by an arithmetic or logical operation instruction without the use of an accumulator Once data is written to the output latch the data is held until a port A manipulation instruction is executed or the data Is reset Figure 4 3 Port A Specified as Output Port gt O PAn Internal bus 2 When specified as input port MAn 1 PA line contents can be loaded into an accumulator by a transfer instruction They can also be directly tested bit wise by an arithmetic or logical operation instruction without the use of an accumulator In this case too writing to the output latch is possible and data transferred from the accumulator by a transfer instruction is stored in the entire output latch without regard to the input output setting of the port However the output latch contents for bits specified as input port bits cannot be loaded into the accumulator and since the output buffer is high impedance the contents are not output to an external pin operating as an input pin Thus data stored in the output la
8. SUG 8 X JZE SHA 8 X JZE SSer NOH 4oeqABBid 8 X 291 8 X 191 diu uo uone1edo ZHW 91 57 80 euin uonnoexe uononasur 81d28 Gd 8128 691 1128 1928 1428 5 5 20 CHAPTER 1 GENERAL DESCRIPTION 1 6 Differences between 87AD Series CMOS and NMOS Products Process Product name uPD78C18 78C17 78C14 78C14A 78C12A 78 11 78 10 uPD7811 7810 Instructions 159 STOP instruction added Special registers 28 ZCM register added 27 Standby function 3 modes HALT mode software STOP mode hardware STOP mode On chip RAM data retained at low supply voltage 2 5 V in software hardware STOP mode 32 byte data of 256 byte on chip RAM retained at low supply voltage 3 2 V HLT instruction states 12 11 HALT mode CPU operation Stopped M3 T2 cycle repetition ALE Low level High level Self bias control of zero cross detector Self bias control possible by ZCM register specification Self bias control not possible NMI RESET noise elimination method By analog delay By clock sampling A D converter Operation stoppable Vaner pin manipulation Operation not stoppable RD WR ALE Operation during reset PD PF ROM less products High imped
9. 1 These are two 16 bit registers used to set the count value Cautions 1 When 0 15 set a match signal 1 is generated from the comparator every count of 65536 10000H 2 When 15 written to ETM0 ETM1 output of the comparator match outputs CP0 CP1 are disabled and therefore INTEO INTE1 are not generated 4 Comparator The comparator compares the contents of ECNT and ETMO ETM1 and if a match is detected outputs a coincidence signal CPO CP1 CHAPTER 6 TIMER EVENT COUNTER FUNCTIONS 5 6 Input control circuit This circuit controls input to ECNT The input to ECNT is determined as follows according to the specification of the timer event counter mode register i Internal clock 012 ii Internal clock while input is high iii Cl input iv Cl input while TO output is high To prevent errors due to noise signals in the Cl pin sampling is performed by a sampling pulse with cycle 250 ns at 12 MHz operation Thus an input signal of less than 1 state 250 ns at 12 MHz operation is eliminated and a high level or low level duration of 2 states 500 ns at 12 MHz operation or more is necessary for a signal to be acknowledged as a CI pin input signal Caution n CI pin edge detection noise elimination is performed by the internal sampling clock 03 Table 6 2 ECNT Inputs ECNT Input Internal clock 012 12 while Cl input is high C
10. 8 X 291 5141 8 X 18 s q 8 X 55 di u uo uone1edo ZHN GL 57 80 euin uonnoexe uononasui vlogzad 28 69 21284 VOLO8Zddt suoljonujsu auweN 1onpoJd 19 GENERAL DESCRIPTION CHAPTER 1 NJOM 91UJ8J92 Uld p9 e OGZ OpUIA dIa uuus uld p9 e 9nsejd 9 e 02 X v1 440 5 uid p9 e u 092 9 45 onsejd 10 09 e onsejd e OZ X 1 440 2186 4 uid y9 e 08 did 34146 onsejd uid p9 e dino yoeqAbBbid orueJe9 uld p9 e NJOM MOPUIM Id p9 e Id p9 e 092 xuuus IULI sejd 9nsejd 10 79 e 10 89 e Id p9 e 02 X v1 440 onsejd u 094 yuuus Id p9 e dla Id p9 e 81298 128 9 5 uod pue mod Jo uondo Aq eq ueo 5 016159 dn jnd jo uonejodjioou vv c vv 29 pexoojo xejdnp inj LYYN 1 Sjeuueuo 8 x 8 x Je3unoo 1ue e 1euin 110 9 z x 119 8 8 jeu1e1u sidnueiu Sud 8 X Jl 544 8 944 IVY 912 00
11. 294 14 6 8 Multiplication division 5 22 9 300 14 6 9 lIncrement decrement 4 1 1 seiner drinnen etn 301 14 6 10 Other operatiorn usce ctt dedo 304 12 6 14 5556 306 14 06 12 INSTRUCTIONS 313 VAG E EEG TER RR TTE 316 14 6 14 0 448010 319 14 6 15 5 5 ete i a e edd 321 14 6 16 CPU control InstruCtOTns 4 323 14 7 Stacked Instructions oon inei remit er RE 326 CHAPTER 15 OPERATING PRECAUTION GS 0 2 00000 4000 327 151 RAE Bit Setting corriere reco rs ei ac E RC ER REESE 327 152 DF UR EE Seu EE 328 15 3 Timer Timer Event Counter Compare Register Setting 328 15 4 Restrictions on Serial Interface and Asynchronous Modes 329 15 5 Serial Interface Start Bit 330 15 6 Se
12. If the STOP signal is input high low level during reset input RESET low level a transition is made from the reset state to the STOP mode The STOP pin must be driven high after powering on The reset will not function correctly if the STOP pin is left low The STOP pin can be driven low after oscillator operation has stabilized 177 CHAPTER 10 CONTROL FUNCTIONS 10 1 6 Hardware STOP mode release When the STOP signal changes from the low to high level in the hardware STOP mode the hardware STOP mode is released and simultaneously clock oscillation starts After the elapse of the wait time approximately 65 ms at 12 MHz which takes account of the oscillation stabilization time the CPU starts program execution at address 0 see Figure 10 7 Figure 10 7 Hardware STOP Mode Release Timing STOP Signal Input Execution of STOP Instruction Wait approx 65 ms 12 MHz address 0 execution 4 instruction CPU operation The hardware STOP mode is not released by a high to low transition of the RESET signal When the STOP signal changes from low to high while the RESET signal is low the hardware STOP mode is released and clock oscillation starts If the RESET signal returns from the low to high level the CPU starts program execution at address 0 without waiting for the elapse of the oscillation stabilization time see Figure 10 8 If the RESET signal changes from the high to low level
13. 197 1 9 Memory Map 78 11 2212 2 2020220000 000000000 197 11 10 MM R gister Format 4PD78C 17 78 C 10A etes trade rati qure sut tet V Ded rae dec gal 199 11 11 uPD78C17 Address citans tts Fen tip urb Dodo 199 11 12 HuPD79CT0A Address Space iiti emt eterne xen Rede dre dra SEHR TES 200 1 13 OP Code Fetch 202 11 14 External 202 1 15 External Device Write TIMING 202 2 Memory Mapping Register Format 78 18 204 12 2 Memory Mapping Register Format 78 14 205 13 1 PROM Wiite Verity te 209 3 2 210 5 Analog Inp t Circuit Block nero pne eher dex eere E 331 15 2 When Both NMI STOP Are tectae 332 5 3 Control Timing of NMI and STOP 1 2 2 40200 2 00 0 0 000000000000 333 15 4 When Both NMikand STOP Are cette desse tete etd eet toda 334 5 5 Control Timing f RESET and STOP crx t
14. lt mi 384 TO output PCO TxD lt Remark 24 fxx x dg 384 xx fxx Oscillator frequency MHz 107 CHAPTER 7 SERIAL INTERFACE FUNCTIONS 1 Transmission unit 2 3 a Serial register P 5 This register converts parallel data transferred from the transmit buffer register into serial data and transmits it from the TxD pin ransmit buffer register This register is used to write the parallel data to be transmitted when serial register data transmission ends the contents of the transmit buffer register are transferred to the serial register When the buffer register becomes empty an interrupt request INTST is generated Transmission control circuit This circuit performs all control required for serial data transmission and generates related internal signals Reception unit a Serial register S This register converts serial data input from the RxD pin into parallel data and transfers it to the receive buffer register Receive buffer register Parallel data converted by the serial register is transferred to this register When the receive buffer register becomes full an interrupt request INTSR is generated Reception control circuit This circuit performs all control required for serial data reception and also sets the ER flag if a serial error is generated The ER flag can be checked by an SKIT instruction Resetting the ER flag does
15. CP1 2e Mode registers 5 INTE1 EIN NTEIN Internal bus Edge detection Remark fxx Oscillator frequency 12 81 CHAPTER 6 TIMER EVENT COUNTER FUNCTIONS 82 1 Timer event counter upcounter ECNT ECNT is a 16 bit upcounter which counts input pulses and is cleared by the clear control circuit The OV flag is set if overflow occurs The OV flag can be tested by the SKIT instruction see 9 1 6 Test flag register 2 Timer event counter capture register ECPT he ECPT register is a 16 bit buffer register which holds the ECNT contents The timing for latching of the ECNT contents by the ECPT register is as follows according to the input to the ECNT he ECPT register latches the ECNT contents on the fall of the Cl input when the input to ECNT is 5 i Internal clock 012 or ii Internal clock while Cl input is high and on the fall of TO when the input to ECNT is iii input or iv Cl input while TO output is high Table 6 1 Timing for Latching in ECPT ECNT Input Internal clock 012 12 while Cl is high ECNT Latch Timing CI input falling edge CI inputNete 1 Cl input while TO is highNete 1 Notes 1 Falling edge input TO falling edgeNote 2 2 The TO signal cannot be used when timer F F input 5 used as internal clock see Figure 5 1 Timer Block Diagram 3 Timer event counter REGO 1
16. Input received data STAX H Store received data to memory SPP DCR Skip if buffer full c JR RECO 80 56 1 d ANI SMH 7 Receive disable e ORI MKH 02H INTSR disable lt f gt RECO EXX Recover register EXA Recover accumulator Enable interrupt RETI Return 135 MEMO 136 CHAPTER 8 ANALOG DIGITAL CONVERTER FUNCTIONS The uPD78C18 incorporates a high precision 8 bit A D converter with 8 analog inputs which uses the successive approximation method and four conversion result registers CRO to CR3 to hold the conversion results The provision of a scan mode and select mode for analog input selection minimizes the software overhead 8 1 Analog Digital Converter Configuration The A D converter consists of an input circuit series resistance string voltage comparator successive approximation logic and registers CRO to CR3 see Figure 8 1 The 8 analog inputs are multiplexed on the chip and are selected by the specification of the A D channel mode register ANM The selected analog input is sampled by the sampling amp hold circuit and becomes one of the voltage comparator inputs The voltage comparator amplifies the difference between the analog input and the voltage tap of the series resistance string The series resistance string is connected between the A D reference voltage pin Vaner and the A D ground AVss and consists of a total of 257 resistors
17. Match between ECN MO or fall of Cl input Match between ECNT and ETMO or match between ECNT and ETM1 Match between ECN Setting prohibited Match between ECN M1 or fall of Cl input Match between ECNT and ETMO or match between ECNT and ETM1 87 CHAPTER 6 TIMER EVENT COUNTER FUNCTIONS 6 2 2 Timer event counter output mode register EOM This is an 8 bit register which controls the operation of the timer event counter output control circuit First the configuration of the functions of the output control cycle will be described The block diagram of the COO output of the output control circuit is shown in Figure 6 3 The COO output is a master slave type output and the first stage level F F LVO holds the level to be output next The next stage output latch is used to output the LVO level off chip For the timing for inversion of the LVO level and output off chip from LVO the output timing specified by the timer event counter mode register is used The configuration of the CO1 output is the same as that of the COO output Figure 6 3 Output Control Circuit Block Diagram Output Level F F Output latch O PC6 COO CPO CP1 CI The timer event counter output mode register performs initialization and operation control for the output control circuit above its configuration is shown in Figure 6 4 1 LOO amp LO1 bits 0 amp 4 When LOO
18. IW ZLNI EDd 9S zod OXY LOd 339 APPENDIX A INTRODUCTION TO PIGGYBACK PRODUCT A 1 Pin Functions A 1 1 Lower pins uPD78C11A 78C12A 78C14 QUIP type compatible Pin Name PA7 to PAO Port A Input Output Function 8 bit input output port with input output specifiable bit wise PB7 to PBO Port B 8 bit input output port with input output specifiable bit wise PCO TxD O output PC1 RxD O input PC2 SCK PC3 INT2 T O input input O output O input 7 1 I O output Port C 8 bit input output port with input output specifiable bit wise Transmit data Serial data output pin Receive data Serial data input pin Serial clock Serial clock input output pin Output when internal clock is used input when external clock is used Interrupt request timer input Edge triggered falling edge maskable interrupt input pin or timer external clock input pin can also be used as AC input zero cross detection pin Timer output Square wave is output with timer count time or one internal clock cycle as one half cycle Counter input Input pin for external pulses to timer event counter Counter output 0 amp 1 Rectangular wave output programmable by timer event counter PD7 to PDO AD7 to ADO Port D 8 bit input output port
19. 2 2 9 9 179 10 2 180 10 3 Clock Generation Circuit CERE FR RRRER 182 CHAPTER 11 EXTERNAL DEVICE ACCESSES AND TIMINGS 187 11 1 uPD78C18 78C14 78C14A 78C12A 78C11A External Device Accesses 187 11 1 1 Memory mapping register 2 190 11 1 2 Example of memory expansiODt dro det E t Pa edi e Peto tae een gaa Tea d REY RR CRAS 192 11 1 3 Example of peripheral device connection 194 11 2 uPD78C17 78C10A External Device 1 04 21 198 112 1 MIMIegiSEer ioc teca 199 201 CHAPTER 12 PROM ACCESSES uPD78CP18 78CP14 203 CHAPTER 13 PROM WRITE AND VERIFY OPERATIONS uPD78CP18 78CP14 ONLY 207 13 1 PROM Programming Operating 002 0 nnn 208 13 2 PROM Writing Procedu re roten rene tienne Brea nno 209 13 3 PROM Reading Procedure etre renta 210 13 4 Erasure Procedure Ceramic Package Products 211 13 5 One Time PROM Products Screening eese eene nnne
20. El RET Y Interrupts disabled lt UOI HLT Halt 1 Operation code 10 1 0 0 1 0 0 0 2 Number of bytes 2 3 Number of states 12 8 4 Function Sets the HALT mode lt 5 gt Flags affected SK 0 L1 0 L0 0 324 CHAPTER 14 INSTRUCTION SET STOP Stop lt 1 gt Operation code lt 2 gt Number of bytes lt 3 gt Number of states lt 4 gt Function lt 5 gt Flags affected 12 8 Sets the software STOP mode SK lt 0 L1 lt 0 LO e 0 325 CHAPTER 14 INSTRUCTION SET 14 7 Stacked Instructions If instructions in the same group group A or group from among the 3 kinds of instructions shown below stacked in a program i e if located in two or more consecutive addresses the instruction located at the start point among the stacked instructions is executed and thereafter the number of states fundamentally required for execution of that instruction are expended without any operation being performed the same state as NOP Group A MVI A byte L1 flag Group B MVI L byte LXI H word 10 flag When a group A instruction is executed the L1 flag is set and when a group B instruction is executed the LO flag is set and a check is made of whether instructions in the same group are stacked Interrupts are not disabled during stacked instruction execution but since the L1 and LO flags are automatically saved when an interrupt is generated it
21. Upon RESET input PC7 to PCO are set as input port high impedance PC7 to PCO also become high impedance in the hardware STOP mode 24 CHAPTER 2 PIN FUNCTIONS 2 1 4 7 to PDO Port D 3 state input output 78 18 78 14 78 14 78 12 78 11 78 18 78 14 These are the 8 bit input output pins of port D 8 bit input output port with output latch but in addition to functioning as an input output port they also function as time division address output and data input output multiplexed address data bus pins for accessing externally expanded memory Pins PD7 to PDO can be specified as shown below by setting the memory mapping register 1 Port mode As port D input output pins PD7 to PDO can be specified as input or output as a byte 8 bit unit 2 Expansion mode When an external device program memory data memory or a peripheral device is added in addition to on chip memory PD7 to PDO are used as a multiplexed address data bus AD7 to ADO When an instruction which references an external device 15 executed the lower address information the external device is output in the first state of the external device reference machine cycle of that instruction and the pins become a bidirectional 8 bit data bus in the second and third states other times PD7 to PDO are high impedance Cautions 1 When pins PD7 to PDO are functioning as an address data bus the contents of the internal address
22. pin mode status as the basic timer of the timer event counter according to the specification of the timer event counter mode register or as the serial clock SCK according to the serial mode register specification The timer is also used for generation of the oscillator stabilization time when standby mode STOP is released see 10 1 Standby Functions for details 75 CHAPTER 5 TIMER FUNCTIONS Figure 5 1 Timer Block Diagram TIMERO TIMER1 To timer event counter o To serial interface Timer REG1 1 Timer mode register Internal bus Remark fxxx 1 3 bxx 1 12 384 1 384 Oscillator frequency MHz 76 CHAPTER 5 TIMER FUNCTIONS 5 2 Timer Mode Register TMM This is an 8 bit register which specifies the operating mode of the two interval timers TIMERO and TIMER1 and the timer F F Its configuration is shown in Figure 5 2 1 TFO amp TF1 bits 0 amp 1 These bits perform timer F F reset specification and input clock specification The internal clock is obtained by dividing the oscillator frequency by 3 2 amp bits 2 amp 3 These bits specify the TIMERO input clock Internal clocks 12 and are obtained by dividing the oscillator frequency by 12 and 384 respectively 3 TSO bit 4 TSO controls the operation of the TIMERO
23. PA7 to PAO PB7 to PBO PC7 to PCO PD7 to PDO PF7 to PFO NMI INT1 MODEO 1 Port A X1 X2 Port B AN7 to ANO Port C RD Port D WR Port ALE Non Maskable Interrupt RESET Interrupt Request VAREF ModeO 1 STOP Crystal Analog Input Read Strobe Write Strobe Address Latch Enable Reset Reference Voltage Stop Control Input 11 CHAPTER 1 GENERAL DESCRIPTION 12 2 EPROM mode uPD78CP18 78CP14 only Cautions lt 1 gt lt 2 gt lt 3 gt 1 A10 2 O VPP A20 3 O 07 4 06 4 5 O5 A5O 6 O 04 A60 7 O O3 8 02 9 01 10 00 11 lt 2 gt 12 O 14 lt 3 gt 13 OA13 14 12 15 11 16 10 17 lt 2 gt 8 O A8 O 9 O lt 2 gt 4 S 2 OJ O O O LO AIO MODE1 Se RESETO O MODEO O O 250 9 5 J Connect directly to Vss Pull down individually to Vss potential via a resistor 78 18 only In case of uPD78CP14 pull down to Vss potential via a resistor CHAPTER 1 GENERAL DESCRIPTION 1 3 2 1B 3BE WOFN 1 Normal operation mode PA6 PB1 0 PB2 0 PB3 PB4 PB5O PB6 PB7 O PCO TxD PC1 RxD PC2 SCK PC3 INT2 PC4 TO 6 0 PC7 CO1 NMI gt gt OMAN 0
24. 1 Operation code 10 1 0 0 1 000 1 1 0 0 0 0 0 Vo lt 2 gt Number of bytes 2 3 Number of states 14 8 4 Function EA 574 Transfers the contents of the special register 574 ECNT ECPT specified by Vo 0 1 to the extended accumulator lt 5 gt Flags affected SK 0 L1 0 10 0 SBCD word Store B amp C Direct lt 1 gt Operation code Low address High address o lo 11 o lo 2 Number of bytes 4 3 Number of states 20 14 4 Function word C word 1 B Stores the contents of the C register in the memory addressed by the 3rd byte lower address and 4th byte upper address and stores the contents of the B register in the next memory address 5 Flags affected SK 0 1160 10 0 lt 6 gt Example SBCD 4000H Store register contents in address 4000H and store register contents in address 4001H SDED word Store D amp E Direct lt 1 gt Operation code Low address High address lt 2 gt Number of bytes 4 3 Number of states 20 14 lt 4 gt Function word lt E word 1 lt D Stores the contents of the E register in the memory addressed by the 3rd byte lower address and 4th byte upper address and stores the contents of the D register in the next memory address lt 5 gt Flags affected SK 0 L1 0
25. Figure No Title Page 3 1 Register Configuration 39 3 2 PSW 42 3 3 Memory Map 8 Cr 46 3 4 MerrioryMap UuPDY79617 iso tei eoa at e e oc 47 3 b Memory Map 78 14 78 144 2 1 100000000000 48 3 6 Memory IMap UPD78CT2A tte 49 3 7 Memory 54540001 0 0 red tenebo se P dede EX 50 3 8 Memory uPD7SCTOA 51 3 9 Memory uPD78C18 Mode 2 42 1220 00000 000 53 3 10 Memory Map UPD 78 CI14MOde sh ctetu tonc sr tette tod cent Hes ates 54 3 11 Memory Map gPD7SC12A MOS eene et seg ierant pe 55 3 12 Memory Map uPD786114A Mode ier etate etai nere Er eue 56 3 13 DELS CLON Me C 58 3 14 Zero Cross Detection Signal i eei te eene ed 58 3 15 Zero Cross Mode Register oct nete Re pese Pop evene EUR 59 4 ois M 61 4 2 Mode A REGISTER
26. Working register vector register V V Program counter PC 0000H Stack pointer SP Undefined Ports ode registers MA MB MC MF FFH ode control register MMC M registers MMO 1 2 Port output latches Undefined Interrupts nterrupt enable 0 Request flags ask register Test flags except SB flag 0 Standby flag SB Power on reset 1 n standby mode Previous contents retained Reset input during normal operation Contents before RESET input retained Timer mode register TMM FFH Timer F F 0 Timer registers TMO TM1 Undefined Timer event counter Timer event counter mode register ETMM 00H Timer event counter output mode register EOM Timer event counter registers ETMO ETM1 Undefined Timer event counter capture register ECPT Timer event counter ECNT Serial interface Serial mode high register SMH Serial mode low register SML 180 CHAPTER 10 CONTROL FUNCTIONS Table 10 3 Hardware States after Reset 2 2 Hardware State after Reset A D channel mode register ANM OOH MM register RAE bit MM3 Undefined Zero cross mode register ZC 1 Table 10 4 Pin States after Reset State after Reset WR High impedance RD ALE All ports PA PB PC PD PF When the RESET input changes from low to high program execution starts at ad
27. 1 Operation code 10 1 1 1 0 1 0 0 1 0 0 1 0 1 Pi Po 2 Number of bytes 2 3 Number of states 11 8 4 Function EA lt EA rp3 Obtains the exclusive logical sum of the contents of the extended accumulator and the contents of the register pair rp3 BC DE HL specified by 1 to 3 and stores the result in the extended accumulator 5 Flags affected ZSK 0 L1 0 10 0 DGT EA rp3 Greater Than Register Pair 1 Operation code 10 1 1 1 0 1 0 0 2 Number of bytes 2 3 Number of states 11 8 4 Function EA rp3 1 Skip if no borrow Subtracts the contents of the register pair rp3 BC DE HL specified by 1 to 3 and 1 from the contents of the extended accumulator and skips if no borrow is generated as a result of the subtraction EA rp3 5 Flags affected Z SK HC L1 lt 0 LO lt 0 CY 6 Example DGT EA B EA BC 1 A skip is performed if EA is greater than BC 297 CHAPTER 14 INSTRUCTION SET DLT EA rp3 Less Than Register Pair 1 Operation code O 1 1 1 0 1 0 0 2 Number of bytes 2 3 Number of states 11 8 4 Function i EA rp3 Skip if borrow Subtracts the contents of the register pair rp3 BC DE HL specified by P Po 1 to 3 from the contents of the extended accumulator and skips if a borrow is generated as a result of the subtraction EA rp3 5 Flags affected Z SK HC L1 lt 0 LO lt 0
28. 211 CHAPTER 14 INSTRUCTION SET aues ERR y 213 14 1 Operand Notation and Description 2 24 2 411 2 213 14 2 Explanation of Operation Code 2 442 1 215 14 3 Instruction Address Addressing ccccceeceeeeeeeeeeeeeeeeeeeeeeeeeeeseeeeeeaseaeeeseeeeeeeeeeeeteees 216 14 37 Register 55 exei acp ee Reni Ene t Ex us ade 216 1433 2 Immediate addressitigi s i tirer aoc S ERR eu c Ra rn ea 217 T4 3 9 Direct addressiliguss c potere enne eater a ved ned cens 218 14234 R lative addressirigi sere rre E erret Ee et ra ERR E npe Gema ede 218 143 5 Extended relative GddreSSinG ie ctossteu ci tret eene ce peret boire ocaecat 219 14 4 Operand Address 220 TEAS Register Pod RR Rd 220 14 4 2 Register indirect addressing 222 1443 Auto increment addiesslirigiiu oae 223 14 4 4 Auto decrement addressirig uote tasse utter tado dede aee ae tau ga 224 14 4 5 Double auto increment 0 1 1 0 0 6 1 000000 110000000000 225 14 4 6 Base addressiFig uo
29. Accumulator indirect addressing is used when the TABLE instruction is executed Example 1 Assuming the accumulator contents to be 0 and the PC contents to be 100H the operation is as follows TABLE lt 103H lt 104H 14 4 10 Immediate addressing This addressing method has 1 byte operand data for manipulation in the operation code Immediate addressing is used when an instruction with the following operand format is executed Notation Description Method byte Label numeric value up to 8 bits Example 1 ADI A byte Operation code 0 1 0 0 0 1 1 0 If 79H is used as byte the instruction is written as shown below ADI A 79H lt 79H The corresponding operation code is shown below Operation code 0 1 0 0 0 1 1 O 229 CHAPTER 14 INSTRUCTION SET 14 4 11 Extended immediate addressing This addressing method has 2 byte operand data for manipulation in the operation code Extended immediate addressing is used when an instruction with the following operand format is executed Notation Description Method word Label numeric value up to 16 bits Example 1 LXI rp2 word Operation code 0 P2 Pi Po 0 1 0 High byte If HL is used as rp2 and 3F54H as word the instruction is written as shown below LXI 3F54H HL 3F54H The corresponding operation code is shown below Operation code 0 0 1 1 0 1 0 230 CHAPTER 14 INSTRUCTION SET 14 4 12 Direct addressing With this addressing method
30. uoisuedxe 91791 AZE A9 1 38 70 WOH 9149 00 pesn 1oN uoisuedxe ACEMIL AB M WOW diys uQ uoisuedxe 9144 9886 161 Buiddej A Aq 195 uoisuedx3 71 11 941614 89154 ZEMOL ISM WOY 914 00 189 CHAPTER 11 EXTERNAL DEVICE ACCESSES AND TIMINGS 11 1 1 Memory mapping register MM The memory mapping register is an 8 bit register which performs the following controls e Port expansion mode specification for PD7 to PDO and to PFO Enabling disabling of on chip RAM accesses e Specification of on chip EPROM access range uPD78CP18 78CP14 only See CHAPTER 12 PROM ACCESSES uPD78CP18 78CP14 ONLY The configuration of the memory mapping register is shown in Figure 11 2 1 2 190 Bits to MM2 These bits control the PD7 to PDO port expansion mode and input output specification and the PF7 to PFO address output specification As shown in Figure 11 2 there is a choice of four capacities for the connectable external memory e 256 bytes e AK bytes e 16K bytes 31K 48K 56K 60K bytes 31K bytes of external expansion memory can be connected to the uPD78C18 48K bytes to the uPD78C14 78C144A 56K bytes to the uPD78C12A and 60K bytes to the uPD78C11A Any of the pins PF7 to PFO not used as address outputs can be used as gen
31. 0082 Low address t 1 0083H High address Low address t 31 OOBFH High address User s area Note Can only be used when the RAE bit of the MM register is 1 343 APPENDIX INTRODUCTION PIGGYBACK PRODUCT Figure A 2 Memory Map uPD78C12A Mode 0000H Piggyback EPROM 8192 x 8 bits 1FFFH 2000H External memory 57088 x 8 bits FEFFH FFOOH On chip 256 x 8 bits FFFFH Standby area Call table 0000H 0004H 0008H 0010H 0018H 0020H 0028H 0060H 0080H 0081H 0082H 0083H OOBEH OOBFH 1FFFH Note Can only be used when the RAE bit of the MM register is 1 344 1 2 INTEO INTE1 INTEIN INTAD INTSR INTST SOFTI Low address High address Low address High address Low address 31 High address User s area APPENDIX INTRODUCTION TO PIGGYBACK PRODUCT Figure A 3 Memory Map uPD78C11A Mode 0000H 0009 or 4096 x 8 bits 0008H INTTO INTT1 OFFFH 1000H 0010H INT1 INT2 External memory 0018H INTEO INTE1 61184 x 8 bits 0020H INTEIN INTAD FEFFH FFOOH 2 On chip RAMNete 2 0028 INTSR INTST 56 x 8 bits 49 FFFFH 4 0060H
32. 2 and the A D conversion value of each input is stored in the order gt 1 gt 2 gt Similarly when the ANI2 bit of the A D channel mode register is set to 1 analog inputs are selected in the order 4 gt 5 gt 6 gt and the A D conversion value of each input is stored in the order gt 1 gt 2 gt When the conversion values have been stored in all four CR registers CRO to CR3 an INTAD internal interrupt is generated 142 CHAPTER 8 ANALOG DIGITAL CONVERTER FUNCTIONS The A D converter continues A D conversion again from ANO or AN4 irrespective of whether or not an interrupt request has been acknowledged and stores the A D conversion results in order starting with CRO This operation continues until the A D channel mode register is changed This mode allows A D conversion of four analog inputs with a minimum of software Internal interrupts are disabled by setting 1 the MKAD bit of the interrupt mask register MKH Figure 8 4 Outline of A D Converter Operation Timing in Scan Mode ANO or AN4 1 or AN2 ANS or AN7 ANO or AN4 conversion conversion conversion conversion operation operation operation operation eee Sy y Sampling Sampling Sampling Y ANM register Conversion Conversion Conversion Conversion write result write result write result write result write to CRO register to CR1 register to CR3 register to CRO register Y INT
33. 4K bytes LPD78C11A mode FFOOH to FFFFH 256 bytes Other than the above Setting prohibited CHAPTER 12 PROM ACCESSES uPD78CP18 78CP14 ONLY Figure 12 2 Memory Mapping Register Format uPD78CP14 6 5 4 3 2 1 0 ao pron Ton PD7 to PDO Input port PF7 to PFO Port mode Single chip Port mode PD7 to PDO Output port PF7 to PFO Port mode PD7 to PDO Expansion mode 256 bytes PF7 to PFO Port mode PD7 to PDO bytes PF3 to PFO PF7 to PF4 Port mode Expansion mode Expansion mode PD7 to PDO 16K bytes PF5 to PFO PF7 amp PF6 Port mode Expansion mode 48 56 PD7 to rpo Expansion mode 60K bytes Note to PFO Note Depending on setting of bits 7 amp MM6 On chip RAM access Disable Enable On chip EPROM access Access to on chip EPROM addresses 0000 to 3FFFH uPD78C14 mode Access to on chip EPROM addresses 0000H to 1FFFH uPD78C12A mode Access to on chip EPROM addresses 0000H to OFFFH uPD78C11A mode Setting prohibited 205 MEMO 206 CHAPTER 13 PROM WRITE AND VERIFY OPERATIONS uPD78CP18 78CP14 ONLY The uPD78CP18 and 78 14 incorporate 32768 8 bit and 16384 x 8 bit PROM respectively as program memory The pins shown in Table 13 1 are used for write verify operations on this PROM The uPD78CP18 78CP14 program timing is
34. 6 Type 5 A Output data Type 4 A O IN OUT Output disable Type 1 7 Type 7 P ch N ch Sampling 777 5 AVss Reference voltage From voltage tap of series 1 resistance string 33 CHAPTER 2 PIN FUNCTIONS 8 Type 8 Output data Output disable Type 5 O IN OUT N ch N ch Type 2 MCC 9 Type 8 A Output data Output disable Type 5 A IN OUT N ch N ch Type 2 MCC 10 Type 9 Self bias circuit enable INO Type 1 Data 34 CHAPTER 2 PIN FUNCTIONS 11 Type 10 Output data Output disable Type 5 O IN OUT Self bias circuit enable Type 9 A MCC 12 Type 10 A Output data Output disable 5 IN OUT ct N ch Self bias circuit enable Type 9 1 A MCC 35 CHAPTER 2 PIN FUNCTIONS 36 13 Type 11 O IN OUT Output data 1 7 2 Edge detector 14 Type 12 15 Type 13 INO 1 NEN STOP mode P ch 77 77 CHAPTER 2 PIN FUNCTIONS 2 4 Pin Mask Options uPD78C18 78C14A 78C12A 78C11A Only The following mask options are available for pins and these can be selected bit wise to suit the purpose PA7 to PAO lt 1 gt Pull up resistor incorporated PB7 to PBO lt 2 gt Pull up r
35. DE byte HL A HL B HL EA HL byte specified by AsA2A1Ao 1 to 7 B to F If auto increment auto decrement is specified the contents of the register pair DE or HL are automatically incremented or decremented by 1 after the accumulator contents have been stored If DE byte or HL byte is specified as rpa2 the memory is addressed by the result of adding the 2nd byte Data of the instruction to the contents of DE HL If HL A HL B or HL EA is specified the memory is addressed by the result of adding the contents of the register A B EA to the contents of HL 4 Flags affected SK lt 0 L1 lt 0 LO lt 0 lt 5 gt Example LXI D 4000H DE lt 4000H STAX D 4000H lt DE lt 4001H STAX D 10H 4011H A DE lt 4001H This example stores A in addresses 4000H and 4011H 239 CHAPTER 14 INSTRUCTION SET LDAX rpa2 Load A with Memory addressed by Register Pair 1 Operation code 0 1 0 1 Ao lt 2 gt Number of bytes states The number of bytes and number of states are as shown below depending on the rpa2 specification Le sip 1 Heb eth Number of bytes Number of states 3 Function 2 Loads the contents of the memory addressed by the register pair roa2 DE DE HL DE HL DE byte HL A HL B HL EA HL byte specified by AsA2A1Ao 1 to 7 to F into the accumulator If auto incr
36. Expansion mode PF7 amp PF6 Port mode 1 48 6 PD7 to PDO Note 60K bytes 7 to PFO mode Expansion Disable Enable Note 31K uPD78C18 48K uPD78C14 78C14A 56K 78 12 60K 78 11 191 CHAPTER 11 EXTERNAL DEVICE ACCESSES AND TIMINGS 11 1 2 Example of memory expansion Figure 11 3 shows an example of a configuration with 16K bytes of external expansion ROM and Figure 11 4 shows the data set in the memory mapping register for this configuration Figure 11 3 Example of Memory Expansion Reference Diagram 87AD series 7 CE Standby control OE 27 512 9 15 7 As 13 AD7 0 OE wPD74HC573 Note 27 512 uses only 16K bytes 192 CHAPTER 11 EXTERNAL DEVICE ACCESSES AND TIMINGS Figure 11 4 Memory Mapping Register Settings 7 6 5 4 3 2 1 0 ERERESESLENESEX PD7 to PDO Expansion mode PF5 to PFO Expansion mode PF7 amp PF6 Port mode On chip RAM access Disable Enable 193 CHAPTER 11 EXTERNAL DEVICE ACCESSES AND TIMINGS 11 1 3 Example of peripheral device connection In the uPD78C18 78C14 78C14A 78C12A 78C11A a uPD8085 type bus system is used in which the data bus and low order 8 bits of the address bus are multiplexed Therefore a large number of uPD8085 peripheral devices can be conn
37. Figure 6 13 Pulse Width Measurement Mode Operation Internal clock 012 Cl input Internal signal 1 ECNT input Internal signal 2 INTEIN Interrupt acknowledgment ECNT contents transferred to ECPT ECNT cleared 6 3 5 Programmable rectangular wave output mode In the programmable rectangular wave output mode programmable rectangular waves can be output to two independent outputs COO and 1 The same operations are performed for both COO Here programmable rectangular wave output for the COO output is described After first clearing ECNT the count value is set in and ETM1 Next the data shown in Figure 6 14 is set in the timer event counter output mode register EOM to initialize the output control circuit and specify the operation The data shown in Figure 6 15 is set in the timer event counter mode register and timer event counter operation Figure 6 14 Timer Event Counter Output Mode Register Setting 7 6 5 4 3 2 1 0 No operation LVO level inversion enabled LVO set 95 CHAPTER 6 TIMER EVENT COUNTER FUNCTIONS Figure 6 15 Timer Event Counter Mode Register Setting Programmable Rectangular Wave Output Mode 5 4 3 2 1 0 1 7 6 TS T IS Internal clock 012 count ECNT cleared by match of ECNT and ETM1 contents LVO level output by match of ECNT and ETMO contents or
38. 0 0 1 0 0 Rz Ri Ro 2 Number of bytes 2 3 Number of states 8 8 4 Function i Skip if no carry Adds the contents of the accumulator to the contents of the register r V A B C D E H L specified by R2R1Ro 0 to 7 and stores the result in the specified register Skips if no carry is generated as a result of the addition lt 5 gt Flags affected Z SK HC L1 lt 0 LO 0 lt 6 gt Example i Add A to the HL register pair ADDNC L A L lt L A SKIP IF NO CARRY ADI H l H e H 1 If no carry is generated a skip is performed and the addition ends if a carry is generated the carry is added to the upper byte and the addition ends SUB A r Subtract Register from A lt 1 gt Operation code O 1 1 0 0 0 0 0 1 1 1 0 0 R2 Ri Ro 2 Number of bytes 2 3 Number of states 8 8 4 Function lt Subtracts the contents of the register r V A B C D E H L specified R2R Ro 0 to 7 from the contents of the accumulator and stores the result in the accumulator 5 Flags affected Z SK lt 0 L1 0 LO lt 0 CY 6 Example SUB A B A lt A B 254 CHAPTER 14 INSTRUCTION SET SUB A Subtract A from Register 1 Operation code 10 1 1 0 0 0 0 2 Number of bytes 2 3 Number of states 8 8 lt 4 gt Function r lt r A Subtracts the contents of the accumulator from the contents of the register r V
39. 15 7 Input Voltage to Analog Input Pin e Target products Details 330 All products When analog input voltage Vian specified by the A D converter characteristics exceeds the specified value accuracy cannot be expected from the value obtained Then analog input circuit is as shown in Figure 15 1 It is connected to the sample hold capacitor via the protection register protection diode and analog switch There are one sample hold capacitor and one A D converter The analog input samples the input signal selected by the analog switch In this case if a voltage exceeding the specified analog voltage is applied to the analog input pin the analog switch conducts even if it is not selected This causes the sample hold capacitor to be charged When the analog input voltage Vian or discharged when the analog input voltage lt Vian making the selected analog input voltage change unreliable CHAPTER 15 OPERATING PRECAUTIONS Figure 15 1 Analog Input Circuit Block Diagram Analog switch configuration 262 Y AN7 Analog switch N ANN o LP 77 Lj ANn To A D converter al Sample hold capacitor e Remedy Limit the analog input voltage as described below 1 Limit the output voltage in the analog detecting circuit to the specified analog input voltage 2 Cramp the analog input pin using a Schottkey Barrier diode 78 18 3
40. 254 nm wavelength 12 mW cm intensity erasure takes approximately 15 to 20 minutes Cautions 1 Program contents may also be erased by extended exposure to direct sunlight or fluorescent light The contents should therefore be protected by masking the window in the top of the package with light shielding cover film 2 Erasure should normally be carried out at a distance of 2 5 cm or less from the UV lamp Remark The erasure time may be increased due to deterioration of the UV lamp or dirt on the package window 13 5 One Time PROM Products Screening One time PROM products uPD78CP18CW 78CP18GF 3BE 78CP18GO 36 78CP14CW 78CP14G 36 78CP14GF 3BE 78CP14L can not be completely examined for shipment in NEC according to their structure matters After needed data is written screening in which PROM verification is performed after high temperature storage based on the conditions below is recommended Storage Temperature Storage Time 125 C 24 hours NEC performs fee charged service named microcontroller for one time PROM writing marking and screening including verification For details contact our salesman 211 MEMO 212 CHAPTER 14 INSTRUCTION SET 14 1 Operand Notation and Description Method Operands are written in the operand field of an instruction in accordance with the description method for the operand notation for that instruction For details depends on assembler specifications When there ar
41. 5 6 Working register vector register V When a working area is set in the memory space the high order 8 bits of the memory address are selected using the V register and the low order 8 bits are addressed by the immediate data in the instruction Thus the memory area specified with the V register can be used as working registers with a 256 x 8 bit configuration Because a working register can be specified with a 1 byte address field program reduction is possible by using the working area for software flags parameters and counters The V register can be replaced with the ALT register paired with an accumulator by means of the EXA instruction General registers B C D E H L There two sets of general registers main C D E H L ALT B C D E H 1 They function as auxiliary registers for the accumulator and have a data pointer function as register pairs BC DE HL B C D E H L Four register pairs DE D E HL and H L in particular base register function When the two sets are used if an interrupt occurs in one set the register contents are saved into the other register set without saving them into the memory so that interrupt servicing can be carried out The other set of registers can also be used as a data pointer expansion registers Single step auto increment decrement modes and a two step auto increment addressing mode are available for the register pairs DE HL D E and H L so th
42. 6 21 Port C Setting Single Pulse 101 6 22 Interrupt Mask Register Setting Single Pulse Output INTEIN Mask Release 101 6 23 Timer Event Counter Mode Register Setting Single Pulse Output ECNT 18 16 16 814 1 102 Figure No LIST OF FIGURES 2 3 Title Page 6 24 6 25 7 1 7 2 7 3 7 4 7 5 7 6 7 7 7 8 7 9 7 7 7 7 7 7 7 OO 8 8 2 8 3 8 4 8 5 8 6 8 7 8 8 8 9 941 9 2 9 3 9 4 9 5 9 6 9 7 9 8 10 1 10 2 10 3 10 4 10 5 10 6 10 7 10 8 10 9 10 10 10 11 10 12 10 13 Timer Event Counter Mode Register Setting Single Pulse Output COO Output TMINA SEINO 103 Interrupt Mask Register MKL Setting Single Pulse Output INTE1 Mask Release 104 Serial Interface Configuration 107 Serial Mode High Register SMH Format 111 Serial Mode Low Register SML 113 Serial Mode Register Format in Asynchronous 115 Asynchronous Data 222 2 9995 9 118 Serial Mode Register Format Synchronous 121 Synchronous Mode TI
43. 7 6 5 4 3 2 1 0 XJENEXNEZESESESEHRX LVO level inversion enabled LVO set c Masking of interrupts INTE1 generated by a match between and 1 is released by setting the interrupt mask register MKL INTEO interrupts which have the same priority as INTE1 interrupts must be masked 103 CHAPTER 6 TIMER EVENT COUNTER FUNCTIONS Figure 6 25 Interrupt Mask Register MKL Setting Single Pulse Output INTE1 Mask Release The INTEIN interrupt service program is shown below JMP EINSV instruction must be stored in the INTEIN interrupt start address 0020H TIMER EVENT COUNTER SERVICE EINSV EXA EXX DMOV LXI DADD DMOV LXI DADD DMOV MVI MOV ORI ANI EXX EXA 0064 00 8 1 EA MKL OBFH Save accumulator Save register Low level 100 us at 12 MHz Set count value High level 200 us at 12 MHz Set count value Set level F F inversion enable INTEIN INTE1 enable Recover register Recover accumulator TEO masking TE1 masking released lt a gt b lt C gt After the interrupt service program by INTEIN an internal interrupt INTE1 is generated when the contents of ECNT ETM1 are the same The flowchart of this interrupt processing is shown below 104 CHAPTER 6 TIMER EVENT C
44. HL B The corresponding operation code is shown below Operation code 1 0 1 0 1 1 0 1 227 CHAPTER 14 INSTRUCTION SET 14 4 8 Working register addressing With this addressing method a working register in the memory area to be manipulated is selected with the working register vector register V as the high order 8 bits of the address and the 8 bit immediate data in the instruction as the low order 8 bits of the address This kind of addressing combines register indirect addressing by the V register and direct addressing by the immediate data wa Working register addressing is used when an instruction with the following operand format is executed Notation wa Example 1 228 Description Method Label numeric value up to 8 bits DCRW wa Operation code 0 0 1 1 0 0 0 If 77H is specified as wa the instruction is written as shown below DCRW 77H The corresponding operation code is shown below Operation code 0 0 1 1 0 0 0 O If the contents of the V register are assumed to be 20H the generated operand address will be 2077H and the contents of the working register in that address will be decremented by 1 CHAPTER 14 INSTRUCTION SET 14 4 9 Accumulator indirect addressing This is a special example of register indirect addressing in which the contents of the memory addressed by PC 3 Aare loaded into the C register and the contents of the memory addressed by 3 1 are loaded into the B register
45. L specified by R2R1Ro 0 to 7 and the contents of the accumulator and stores the result in the specified register 5 Flags affected 2 5 lt 0 11 lt 0 106 0 lt 6 gt Example lt XRA A r Exclusive Or Register with A 1 Operation code O 1 1 0 0 0 0 1 00 1 0 Rz Ri Ro lt 2 gt Number of bytes 2 3 Number of states 8 8 lt 4 gt Function i Avr Obtains the exclusive logical sum of the contents of the accumulator and the contents of the register r V A B C D E H L specified by R2R1Ro 0 to 7 and stores the result in the accumulator 5 Flags affected ZSK 0 L1 0 L0 0 6 Example XRA A A B r A Exclusive Or A with Register 1 Operation code 10 1 1 0 0 0 1 0 Ri Ro lt 2 gt Number of bytes 2 lt 3 gt Number of states 8 8 lt 4 gt Function i rA Obtains the exclusive logical sum of the contents of the register r V A B C D E H L specified by R2R Ro 0 to 7 and the contents of the accumulator and stores the result in the specified register 5 Flags affected Z 5 lt 0 116 0 10 0 lt 6 gt Example C A C lt 258 CHAPTER 14 INSTRUCTION SET GTA A r Greater Than Register 1 Operationcode 10 1 1 0 0 0 0 0 1 O 1 0 1 R2 Ri Ro 2 Number of bytes 2 3 Number of states 8 8 lt 4 gt Function A r 1 lt Skip if
46. Number of bytes 3 Number of states 4 Function Z SK HC L1 lt 0 LO 0 CY 11 8 EA lt EA r2 Subtracts the contents of the register r2 A B C specified by R1Ro 1 to 3 from the contents of the extended accumulator and stores the result in the extended accumulator 5 Flags affected Z SK 0 HC L1 0 LO 0 CY DSUB EA rp3 Subtract Register Pair from EA 1 Operation code 2 Number of bytes 3 Number of states 4 Function 1 1 1 0 1 0 0 1 1 0 1 Po 2 11 8 EA lt EA rp3 Subtracts the contents of the register pair rp3 BC DE HL specified by 1 1 to 3 from the contents of the extended accumulator and stores the result in the extended accumulator 5 Flags affected Z SK 0 HC L1 0 LO 0 CY 295 CHAPTER 14 INSTRUCTION SET DSBB EA rp3 Subtract Register Pair from EA with Borrow 1 Operation code 10 1 1 1 0 1 0 0 1 1 1 T 2 Pi 2 Number of bytes 2 3 Number of states 11 8 4 Function i EA lt EA rp3 CY Subtracts the contents of the register pair DE HL specified by 1 to 3 including the CY flag from the contents of the extended accumulator and stores the result in the extended accumulator lt 5 gt Flags affected Z SK e0 L1 0 LO lt 0 CY DSUBNB EA rp3 Subtract Register Pair from EA Skip if No Borrow 1 Operation code 1
47. When the timer F F input is 3 sck CK 5 where fxx is the oscillator frequency SCK is the serial clock and is the timer count value When the timer F F input is when the TO output is used as the internal clock the clock can only be used in asynchronous mode when the clock rate is 16 or 64 109 CHAPTER 7 SERIAL INTERFACE FUNCTIONS 2 3 4 5 6 110 TxE bit 2 This bit determines whether or not the operation is a transmit operation When the TxE bit is reset 0 the TxD pin is driven high and data transmission is not performed When the TxE bit is set 1 data transmission is enabled and if data has previously been written into the transmit buffer register that data is output Alternatively when data is written into the transmit buffer register serial data is transmitted from the TxD pin However when the TxE bit is changed from the set 1 status to the reset 0 status transmission is disabled after the data in the serial register has been transmitted Therefore when there is data in both the transmit buffer register and the serial register transmission is disabled after the serial register data has been transmitted and the transmit buffer register data is retained without being transmitted The data in the transmit buffer register is transmitted as serial data when transmission is next enabled TxE 1 Thus when transmission is to be disabled TxE 0 after all transmit data ha
48. a non maskable interrupt is acknowledged by means of the following procedure irrespective of the EI DI state see Figure 9 4 i Acheck is made to see if INTFNMI is set at the end of each instruction If INTFNMI is set a non maskable interrupt is acknowledged at is reset ii When the non maskable interrupt is acknowledged the IE F F is reset and all interrupts except for non maskable interrupts and the SOFTI instruction are placed in the disabled state DI state iii PSW PC high byte and PC low byte are saved into the stack memory in that order The program jumps to the interrupt address 0004 These interrupt operations are automatically carried out in 16 states Caution Operations when a non maskable interrupt is generated directly after a maskable interrupt 1 The PC value at the time of the interrupt is saved to the stack 2 The vector address of the maskable interrupt is stored in the PC and the corresponding interrupt request flag is reset 3 Non maskable interrupt servicing is executed before execution of the maskable interrupt routine 4 The non maskable interrupt routine is executed In this case the return destination from the non maskable interrupt routine is the maskable interrupt routine 160 CHAPTER 9 INTERRUPT CONTROL FUNCTIONS Figure 9 4 Interrupt Operation Procedure End of instruction Reset INTFNMI Other interrupt Pending priority Al
49. byte Or Immediate with Register 1 Operation code O 1 1 1 0 1 0 0 2 Number of bytes 3 3 Number of states 11 11 4 Function r lt rv byte Obtains the logical sum of the contents of the register r V A B C D E L specified by R2RiRo 0 to 7 and the immediate data in the 3rd byte and stores the result in the specified register 5 Flags affected ZSK 0 L1 0 L0 0 ORI sr2 byte Or Immediate with Special Register 1 Operation code O 1 1 0 1 0 0 2 Number of bytes 3 3 Number of states 20 11 4 Function Sr2 lt sr2 v byte Obtains the logical sum of the contents of the special register sr2 PA PB PC PD PF MKH MKL ANM SMH EOM TMM specified by 53525150 0 to 3 5 to 9 D and the immediate data in the 3rd byte and stores the result in the specified special register lt 5 gt Flags affected ZSK 0 L1 0 L0 0 lt 6 gt Example set bit 1 PC1 of port C ORI PC 02H PC lt PCv 00000010 277 CHAPTER 14 INSTRUCTION SET XRI A byte Exclusive Or Immediate with A 1 Operation code 10 0 0 1 0 1 1 0 2 Number of bytes 2 3 Number of states 7 7 lt 4 gt Function amp byte Obtains the exclusive logical sum of the contents of the accumulator and the contents of the immediate data in the 2nd byte and stores the result in the accumulator lt 5 gt Flags affected ZSK 0 L1
50. control circuit Table 6 4 INTEIN Interrupt Request Flag Setting ECNT Input Interrupt Request Flag Setting Internal clock 012 CI input falling edge 12 while Cl input is high CI inputNote 1 TO falling edgeNote 2 Cl input while TO is highNete 1 Notes 1 Falling edge input 2 The TO signal cannot be used when timer F F input is used as internal clock see Figure 5 1 Timer Block Diagram 84 CHAPTER 6 TIMER EVENT COUNTER FUNCTIONS 8 9 Output control circuit This circuit controls the two channel pulse outputs amp CO1 and operates as a timer event counter enabling the pulse width and cycle to be varied Pulse output is varied by the following signals i Match of ECNT and ETMO ii Match of ECNT ETM1 ii Cl input edge Mode registers These are two 8 bit registers which specify the operation of the timer event counter and output control circuit see 6 2 Mode Registers for details 6 2 Mode Registers The timer event counter has two mode registers The timer event counter mode register which specifies the operating mode and the timer event counter output mode register EOM which specifies the operation of the output control circuit 6 2 1 Timer event counter mode register ETMM This is an 8 bit register which controls the timer event counter its configuration is shown in Figure 6 2 1 2 3 ETO amp ET1 bits 0
51. high impedance When the RESET input or STOP input subsequently returns to the high level they are set as address bus or port according to the status of the MODE1 and MODEO pins 26 CHAPTER 2 PIN FUNCTIONS uPD78C17 78C10A These pins can be specified as an address bus AB15 to AB8 corresponding to the size of the externally installed device by means of the MODEO and pin settings and the remaining pins can be used as general purpose input output ports see Table 2 3 Table 2 3 Operation of PF7 to PFO uPD78C17 78C10A External Address Space AB11 AB10 4K bytes AB11 AB10 16K bytes Setting prohibit AB11 AB10 63K 64K bytesNote Note 63K uPD78C17 64K uPD78C10A In the reset state RESET input low or in the hardware STOP mode STOP input low pins PF7 to PFO become high impedance When the RESET input or STOP input subsequently returns to the high level they are set as address bus or port according to the status of the MODE1 and MODEO pins Caution Emulation cannot be performed by an emulator for a program which varies the port F operating mode dynamically Therefore once the mode has been set it should not be changed to different mode 2 1 6 WR Write strobe 3 state output The strobe signal output for a write operation to external memory This pin is driven high except in external memory data write machine cycles When the RESET signal
52. lt 0 LO lt 0 CY 6 Example To subtract immediate data from the HL register pair SUINB L IMM L c L IMM SKIP IF NO BORROW SUI H 1 SUINB sr2 byte Subtract Immediate from Special Register Skip if No Borrow 1 Operation code 10 1 1 0 1 0 0 S 0 1 1 52 51 So lt 2 gt Number of bytes lt 3 gt Number of states 20 11 lt 4 gt Function 572 lt sr2 byte Skip if no borrow Subtracts the immediate data in the 3rd byte from the contents of the special register sr2 PA PB PC PD PF MKH MKL ANM SMH EOM TMM specified by 53525150 0 to 3 5 to 9 D and stores the result in the specified special register Skips if no borrow is generated as a result of the subtraction lt 5 gt Flags affected Z SK HC L1 e 0 LO lt 0 CY lt 6 gt Example 0 EQU 10H SUINB PA GENSU PA lt 10 This example subtracts GENSU defined by EQU from the contents of port A and stores the result in port A 275 CHAPTER 14 INSTRUCTION SET ANI A byte Add Immediate with A 1 Operation code 0 0 0 1 1 1 lt 2 gt Number of bytes 2 3 Number of states 7 7 lt 4 gt Function ACA byte Obtains the logical product of the contents of the accumulator and the contents of the immediate data in the 2nd byte and stores the result in the accumulator 5 Flags affected ZSK 0 L1 0 L0 0 ANI r byte And Immediate with Register 1
53. lt DE 1 This example subtracts the contents of the memory addressed by the DE register pair including the CY flag from A and stores the result in A and then decrements DE SUBNBX rpa Subtract Memory addressed by Register Pair from A Skip if No Borrow 1 Operation code 10 1 1 1 0 0 O 0 1 0 1 1 0 Ai Ao 2 Number of bytes 2 3 Number of states 11 8 4 Function A lt A rpa Skip if no borrow Subtracts the contents of the memory addressed by the register pair roa BC DE HL DE HL DE HL specified by A2A Ao 1 to 7 from the contents of the accumulator and stores the result in the accumulator Skips if no borrow is generated as a result of the subtraction 5 Flags affected Z SK HC L1 lt 0 LO 0 CY 6 Example SUBNBX B A A skip is performed if no borrow is generated as a result of the subtraction 265 CHAPTER 14 INSTRUCTION SET ANAX rpa And Memory addressed by Register Pair with A 1 Operation code 10 1 1 1 0 0 0 0 2 Number of bytes 2 3 Number of states 11 8 4 Function lt rpa Obtains the logical product of the contents of the accumulator and the contents of the memory addressed by the register pair roa BC DE HL DE HL DE HL specified by 1 1 to 7 and stores the result in the accumulator 5 Flags affected ZSK 0 L1 0 L0 0 6 Example H A lt AA HL HL l
54. mode e uPD78C11A mode Note Only the uPD78CP18 can operate in this mode In addition the on chip ROM address range can be specified to allow efficient mapping of external memory excluding PROM The vector area and call table area are the same in all modes Setting the hardware software STOP mode or HALT mode allows on chip RAM data to be retained with a low consumption current The memory map for each mode is shown in Figures 3 9 to 3 12 52 CHAPTER 3 INTERNAL BLOCK FUNCTIONS Figure 3 9 Memory Map uPD78C18 Mode 0000H 0000H On chip EPROM 0004H 32768 x 8 bit 0008H 7FFFH 8000H 0010H External memory 31744 x 8 bit 0018H 0020H FBFFH FCOOH On chip 1024 x 8 bit 0028H Standby area FFFFH 0060H 0080H 0081H 0082H 0083H Call table OOBEH OOBFH 7FFFH Note Can only be used when the RAE bit of the MM register is 1 INTTO INTT1 INT1 INT2 INTEO INTE1 INTEIN INTAD INTSR INTST SOFTI LOW ADRS HIGH ADRS LOW ADRS HIGH ADRS LOW ADRS HIGH ADRS User s area t 31 53 CHAPTER 3 INTERNAL BLOCK FUNCTIOS 54 Figure 3 10 Memory Map uPD78C14 Mode 0000H 0000H On chip EPROM 0004H 16384 x 8 bit 0008H INTTO INTT1 4000H 0010H INT1 INT2 External mem
55. the memory to be manipulated is addressed using the immediate data in the instruction as the operand address Direct addressing is used when an instruction with the following operand format is executed Notation Description Method word Label numeric value up to 16 bits Example 1 MOV r word Operation code O 1 1 1 0 0 0 0 R2 Ri Ro Low address High address c ES If the register is used as r and EEFFH as word the instruction is written as shown below MOV B OEEFFH The corresponding operation code is shown below Operation code 0 231 CHAPTER 14 INSTRUCTION SET Example 2 SDED word Operation code O 1 1 1 0 0 0 0 If the label DST is used as word the instruction is written as shown below SDED DST If DST is assumed to be 4000H the corresponding operation code is as follows Operation code 0 1 1 1 0 0 O O 14 5 Number of States Required for Skipping The number in parentheses indicated in lt 3 gt Number of states in the instruction set descriptions is the number of idle states consumed without any operation when that instruction is skipped The number of idle states when the instruction is skipped is 4 in the case of the OP code and 3 in the case of immediate data Example MVI sr2 byte instruction 3 byte instruction Ss 0 0 0 52 51 As the 1st 2nd bytes are the OP code the number of idle states is 4 and as the 3rd byte is immediate data the number of idle st
56. uPD78CG14 16K x 8 bits external 256 x 8 bits Up to 48K bytes On chip pull up resistor specifiable PROM product Piggy back product PD78C17 uPD78C17 A None 1K x 8 bits Up to 63K bytes ROM less product PD78C18 PD78C18 A PD78CP18 uPD78CP18 A 32K x 8 bits 1K x 8 bits Up to 31K bytes On chip pull up resistor specifiable PROM product CHAPTER 1 GENERAL DESCRIPTION In the uPD78CP18 78CP14 the on chip mask ROM of the uPD78C18 78C14 is replaced with one time PROM or EPROM One time PROM products can be programmed once only and are useful for short run and multiple device set production and early start up EPROM products can be programmed and reprogrammed and are ideally suited to system evaluation The relationship between Standard quality grade products and Special quality grade products Standard Quality Grade Products Quality Grade Products 78 10 78 8 1 78 78 12 uPD78C uPD78C14 uPD78C uPD78CP14 uPD78CP14 A uPD78C17 uPD78C uPD78C18 uPD78C PD78CP18 PD78CP18 A Applications The Standard Products Stationary machine and OA equipment PPC Plain paper copier printer electronic typewriter ECR Electronic cash register FAX bar code reader etc e Automobile Automobile air conditioner cellular pho
57. 0 L0 0 6 Example XRI A 8BH lt A 8BH XRI r byte Exclusive Or Immediate with Register 1 Operation code 10 1 1 1 0 1 0 2 Number of bytes 3 3 Number of states 11 11 4 Function r lt rx byte Obtains the exclusive logical sum of the contents of the register V A B C D E H L specified by R2R 1Ro 0 to 7 and the immediate data in the 3rd byte and stores the result in the specified register 5 Flags affected 12 5 lt 0 1160 10 0 sr2 byte Exclusive Or Immediate with Special Register 1 Operation code O 1 1 0 1 0 0 S 0 0 1 0 52 Si So lt 2 gt Number of bytes 3 3 Number of states 20 11 lt 4 gt Function sr2 lt sr24 byte Obtains the exclusive logical sum of the contents of the special register sr2 PA PB PC PD PF MKH MKL ANM SMH EOM TMM specified by 53525150 0 to 3 5 to 9 B D and the immediate data in the 3rd byte and stores the result in the specified special register 5 Flags affected ZSK 0 L1 0 L0 0 6 Example To invert bit 2 2 of port A PA 04H PA lt 200000100 278 CHAPTER 14 INSTRUCTION SET GTI A byte Greater Than Immediate 1 Operation code 10 0 1 0 1 1 1 2 Number of bytes 2 3 Number of states 7 7 4 Function A byte 1 Skip if no borrow Subtracts the immediate data in the 2nd byte and 1 from the contents of the ac
58. 0000H On chip ROM 16384 x 8 bit 4000H External memory 48896 x 8 bit FEFFH FFOOH On chip 256 x 8 bit Standby area FFFFH Note Can only be used when the RAE bit of the MM register is 1 Call table 0000H 0004H 0008H 0010H 0018H 0020H 0028H 0060H 0080H 0081H 0082H 0083H OOBEH OOBFH INTTO INTT1 2 INTEO INTE1 INTEIN INTAD INTSR INTST SOFTI LOW ADRS HIGH ADRS LOW ADRS HIGH ADRS LOW ADRS HIGH ADRS User s area t 31 CHAPTER 3 INTERNAL BLOCK FUNCTIONS Figure 3 6 Memory Map uPD78C12A 0000H On chip ROM 0004H 8192 x 8 bit 0008H INTTO INTT1 1FFFH 2000H 0010H INT1 INT2 External memory 57088 x 8 bit 0018H INTEO INTE1 0020H INTEIN INTAD FEFFH FFOOH ise 5 Note MM B 0028H INTSR INTST FFFFH 0060H SOFT 0080H LOW ADRS 0081H HIGH ADRS 7 0082H LOW ADRS 2 1 1 S 0083H HIGH ADRS 75 LOW ADRS HIGH ADRS User s area 1FFFH Note Can only be used when the RAE bit of the MM register is 1 49 CHAPTER 3 INTERNAL BLOCK FUNCTIOS 50 Figure 3 7 Memory Map uPD78C11A 0000H 0000H On chip ROM 0004H 4096 x
59. 1 high level 2 2 6 RESET Reset Input Should be set 0 low level 2 2 7 The high voltage application pin for an EPROM wvrite verify operation Inputs 1 high level in EPROM read 2 2 8 The power supply application pin 2 2 9 Vss The GND potential pin 30 CHAPTER 2 PIN FUNCTIONS 2 3 Pin Input Output Circuits The input output circuits for the pins are shown in partially simplified format in Table 2 5 and Figures 1 to 15 Table 2 5 Pin Type No Type No Pin Name 78 17 78 14 78 10 uPD78C18 78C14A 78C12A 78C11A PAO to PA7 PBO to PB7 PCO PC1 PC2 SCK PC3 INT2 PC4 to PC7 PDO to PD7 PFO to PF7 NMI INT1 RESET RD WR ALE STOP MODEO MODE1 ANO to AN3 AN4 to AN7 NIBRILATAR TN LOIN ala m N w 31 CHAPTER 2 PIN FUNCTIONS 32 1 Type 1 P ch IN O 4 t N ch 2 2 IN 3 Type 4 Output data ZN 1 OOUT Output disable J N ch CHAPTER 2 PIN FUNCTIONS 4 Type 4 A tput dati Output data E P ch Mask option OUT Output disable 2 N ch 5 Type 5 Output data Type 4 O IN OUT Output disable Type 1
60. 3 through 8 up to final address Figure 13 1 PROM Write Verify Timing Repeat X times u Write mn Verify Additional write A14 10 PF6 2 Address high order 7 bits A8 PFO 7 0 7 0 Address low order 8 bits Data 1 6 N Vit Vin OE PB7 7 Vit 209 CHAPTER 13 PROM WRITE AND VERIFY OPERATIONS uPD78CP18 78CP14 ONLY 13 3 PROM Reading Procedure PROM contents can be read onto the external data bus O7 to OO using the following procedure EN Connect unused pins to GND with a pull down resistor N Supply 5 V to the and VPP pins Input address of data to be read to pins A14 through AO Read mode Output data to pins O7 to OO 5 The timing for 2 5 above is shown in Figure 13 2 Figure 13 2 PROM Read Timing A14 10 PF6 2 A8 PFO CE PB6 7 210 CHAPTER 13 PROM WRITE AND VERIFY OPERATIONS uPD78CP18 78CP14 ONLY 13 4 Erasure Procedure Ceramic Package Products Only The programmed data contents of the uPD78CP18DW 78CP18KB 78CP14DW 78CP14KB 78CP14R can be erased by exposure to ultraviolet radiation through the window in the top of the package Erasure is possible using ultraviolet light with a wavelength of approximately 250 nm The exposure required for complete erasure is 15 W s cm 2 UV intensity x erasure time Using a commercially available UV lamp
61. 3 state input output These are the 8 bit input output pins of port B 8 bit input output port with output latch and can be specified bit wise as input output by means of the Mode B register MB Upon RESET input PB7 to PBO are setas an input port high impedance PB7 to PBO also become high impedance in the hardware STOP mode In the uPD78C18 78C144 78C124 78C114 pull up resistors can be incorporated bit wise 2 1 3 PC7 to PCO Port C 3 state input output These pins operate as the 8 bit input output pins of port C 8 bit input output port with output latch but in addition to functioning as an input output port they also function as pins for various control signals The PC7 to PCO operating mode can be set bit wise to port or control signal input output mode by means of the Mode Control C register MCC see Table 2 1 In the uPD78C18 78C144 78C124 78C114 pull up resistors can be incorporated bit wise 23 CHAPTER 2 PIN FUNCTIONS Table 2 1 Operation of PC7 to PCO MCCn 0 1 Port Mode Control Signal Input Output Mode Input output por TxD output Input output por RxD input Input output por SCK input output Input output por INT2 TI input Input output por TO output Input output por Cl input Input output por COO output Input output por CO1 output Remark n 0 to 7 1 Port mode When PC7 to PCO are specified as input output port by means of the mode cont
62. 4 4244422 222 22 154 9 2 External Interrupt Sampling rero ouo peres ose 158 93 Non Maskable Interrupt Operation 160 9 4 Maskable Interrupt 0 0 163 9 5 Interrupt Operation by SOFTI Instruction 4 2442 2 2222 167 9 6 Interrupt Wait 4 168 9 7 Multiple Interrupts oERE RUE RXR RR RR 169 CHAPTER 10 CONTROL 6 0000 40000 171 10 1 Standby 5 1 122222 12 1002111 Rn SIR RR ARR S 171 I4 B Manejo 171 10 1 2 MALT mode release i 172 10 1 3 Software STOP MOJE ie n be i 174 10 1 4 Software STOP mode release iret rhe ee rc EV Ye EGRE 175 10 1 5 Hardware STOP x e trece de ieu car decer Er eoe o 177 10 16 Hardware STOP mode releadse i ERE 178 10 1 7 Low supply voltage data retention
63. 5 116 0 100 byte On Test Immediate with Register 1 Operationcode 10 1 1 1 0 1 0 0 0 1 0 0 1 R Ro 2 Number of bytes 3 3 Number of states 11 11 4 Function r byte Skip if no zero Obtains the logical product of the contents of the register r V A B D H L specified by RzR1Ro 0 to 7 and the immediate data in the 3rd byte and skips if the result is not zero 5 Flags affected ZSK11 0 L0 0 ONI sr2 byte On Test Immediate with Special Register 1 Operation code O 1 1 0 1 0 0 Ss 1 0 0 1 52 51 So 2 Number of bytes 3 3 Number of states 14 11 4 Function sr2Abyte Skip if no zero Obtains the logical product of the contents of the special register sr2 PA PB PC PD PF MKH MKL ANM SMH EOM TMM specified by 53525150 0 to 3 5 to 9 B D and the immediate data in the 3rd byte and skips if the result is not zero 5 Flags affected Z SK L1 lt 0 LO lt 0 6 Example To test bit 0 PCO of port C and jump to XX if 0 or skip and execute the next instruction if 1 on ONI PC 01H PC 00000001 JMP XX 283 CHAPTER 14 INSTRUCTION SET OFFI A byte Off Test Immediate with A 1 Operation code 10 1 0 1 0 1 1 1 lt 2 gt Number of bytes 2 3 Number of states 7 7 lt 4 gt Function i A byte Skip if zero Obtains the logical product of the contents of the accumulator and the conten
64. 53 52 51 50 49 48 47 46 45 44 32 33 34 35 36 37 38 39 40 41 42 43 OPD1 O PDO O PF7 O PF6 O PF5 O PF2 O PF1 O PFO OALE OWR oRD OIC VaREF O AN7 CHAPTER 1 GENERAL DESCRIPTION 2 EPROM mode uPD78CP14 only Cautions 8 lt lt 4 gt gt 00000000000 2 1 68 67 66 65 64 63 62 61 gt lt 2 gt 5 218 e 0 11 2 3 14 5 16 17 8 19 006 005 004 003 002 O Open 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 U U 0 0 Q KO 00 VOY Q C 6 a92ul g 9 lt A V Open Leave open 1 Connect directly to Vss 2 Pull down individually to Vss potential via a resistor Oo O1 Oo O0 O lt 2 gt O lt 2 gt 13 12 11 10 O lt 2 gt OA8 O 7 lt 2 gt O lt 1 gt r lt 1 gt 17 GENERAL DESCRIPTION CHAPTER 1 1 4 Block Diagram 0 0 0 P tae SSA 4015 15538 03004 GON FIV YM GY 202020 ISNI 93H 15 Jo1uoo 8 4 4 0 244 uo spuedeq
65. 63K uPD78C17 64K uPD78C10A Cautions 1 Pins not used as address bus pins output the internal address bus status in all machine cycles When the address changes undefined data is output 2 Emulation cannot be performed by an emulator for a program which varies the port F operating mode dynamically Therefore once the mode has been set it should not be changed to a different mode When the 63K 64K byte mode is used with the uPD78C17 78C104 instructions which output data to port D or port F should not be executed if such an instruction is executed the WR signal will be output 72 CHAPTER 4 PORT FUNCTIONS 4 6 Operation of Arithmetic and Logical Operation Instruction Involving a Port and Immediate Data With the following instructions which perform arithmetic and logical operations involving a port and immediate data the operation differs depending on the input output setting of the port Table 4 4 Operation of Arithmetic Logical Operation Instructions Involving a Port Mnemonic ACI ADI ADINC SBI SUI SUINB ANI ORI XRI GTI LTI OFFI Instruction operations are as follows 1 The port status is input Operand sr2 byte Output mode pin Output latch status is input Input mode pin Pin external status is input 2 The arithmetic logical operation is performed on the input data and immediate data 3 The entire 8 bit operation result data is transferred to the
66. 7 1 set to perform transmission reception at data transfer rates of 110 to 9600 bps 117 CHAPTER 7 SERIAL INTERFACE FUNCTIONS Table 7 1 Timer Setting Oscillator Frequency MHz 11 0592 14 7456 Data Transfer Speed bps The data format in asynchronous mode is shown in Figure 7 5 Figure 7 5 Asynchronous Data Format INTSR INTST generation Start Stop 1 or 2 bits Odd even no parity Note INTSR is generated by the first stop bit INTST is generated by the first bit when there is only one stop bit and by the second bit when there are two stop bits 1 Data transmission A transmit operation in the asynchronous mode is enabled by setting 1 the TxE bit of the serial data high register SMH When data is written to the transmit buffer register by the MOV TXB A instruction and the previous data transfer is terminated the transmit buffer register contents are automatically transferred to the serial register The start bit 1 bit the parity bit odd even no parity and the stop bit s 1 or 2 bits are automatically added tothe data transferred to the serial register and the data is then transmitted LSB first from the TxD pin When the transmit buffer register becomes empty a serial transmission interrupt INTST is generated Serial transmission interrupts are disabled by setting 1 the MKST bit of the interrupt mask register MKH 118 CHAPTER 7 SERIAL INTERFACE
67. 78 11 78 18 78 14 72 4 3 78 17 786 0 nnd ceres tte re nenne d ei 72 4 4 Operation of Arithmetic Logical Operation Instructions Involving a 73 6 1 Timing Tor 82 6 2 83 6 3 EC INST CS AMIN G ERU 84 6 4 INTEIN Interrupt REGUESt Flag Setting iet penetret eme a estet eee bees 84 7 1 Timer Seting ec 118 7 2 Maximum Data Transfer Rate at Transmission 22 9299 119 7 3 Maximum Data Transfer Rate at Reception 2 0 011 120 8 1 Conversion Speed iie te Dd tg eee Od aede e ea a Pedo Fd cdd 140 9 1 Prioriti sarid Interr pt AddEeSSesusu s e taste e 153 9 2 Maximum Interrupt Walt TIME 2 168 0 1 OUTDO UTP IA Stats E Si 171 10 2 Pil Statusesu agetur tpe taedet aat 174 0 3 Hardware States after Reset ineo sr PURI OMEN AN 180 10 4 States alter Reset nivei e beg era y ed dado dh 181 0 5 Recommended Ceramic 21 2 212020202 20 00289 nnne nennen 185 1 1 PF7 to PFO Address BUS SelectiOnz oui tt ito repete bee ce adco mera
68. 78CG14Nete f data is written to these bits in the uPD78C14 78C12A 78C11A it is ignored by the CPU Therefore programs developed on the uPD78CP18 78CP14 78CG14 can be transferred directly to mask ROM Note The uPD78CG14 is described in APPENDIX A INTRODUCTION TO PIGGYBACK PRODUCT 203 CHAPTER 12 PROM ACCESSES uPD78CP18 78CP14 ONLY Figure 12 1 Memory Mapping Register Format uPD78CP18 7 6 5 4 3 2 1 0 peer e owe Tree ne PD7 to PDO Input port PF7 to PFO Port mode Single chip PD7 to PDO Output port PF7 to PFO Port mode Port mode PD7 to PDO Expansion mode 256 bytes PF7 to PFO Port mode PD7 to PDO PF3 to PFO PF7 to PF4 Port mode Expansion mode bytes PD7 to PDO PF5 to PFO PF7 amp PF6 Port mode o o c x Expansion mode 16K bytes PD7 to PDO PF7 to PFO 31K 48K 56K l Expansion mode ytesNote Note Depending on bits MM7 to MM5 On chip RAM access Disable Enable On chip PROM and on chip RAM access ranges On Chip PROM Access Range On Chip RAM Access Range 0000H to 7FFFH 32K bytes 78 18 mode FCOOH to FFFFH 1K bytes 0000H to 3FFFH 204 16K bytes 78 14 mode 256 bytes 0000 to 1FFFH 8K bytes LPD78C12A mode FFOOH to FFFFH 256 bytes 0000 to OFFFH
69. 8 bit 0008H OFFFH 1000H 0010H External memory 61184 x 8 bit 0018H 0020H FEFFH FFOOH On chip 256 x 8 bit 0028H Standby area FFFFH 0060H 0080H 0081H 0082H 0083H Call table OOBEH OOBFH Note Can only be used when the RAE bit of the MM register is 1 1 2 INTEO INTE1 INTEIN INTAD INTSR INTST SOFTI LOW ADRS HIGH ADRS LOW ADRS HIGH ADRS LOW ADRS HIGH ADRS User s area t 31 CHAPTER 3 INTERNAL BLOCK FUNCTIONS Figure 3 8 Memory Map uPD78C10A 0000H 0000H 22222 0004H 0008H INTTO INTT1 External memory 0010H 2 65280 x 8 bit 0018H INTEO INTE1 0020H INTEIN INTAD On chip E 256 8 bit 8 5 0028H INTSR INTST 2 0060H SOFTI 0080H LOW ADRS 2 0081 HIGH ADRS E ol 0082H LOW ADRS E 8 0083H HIGH ADRS oO LOW ADRS HIGH ADRS Note Can only be used when the RAE bit of the MM register is 1 51 CHAPTER 3 INTERNAL BLOCK FUNCTIOS 3 5 2 uPD78CP18 78CP14 memory configuration The uPD78CP18 can operate in any of 4 modes and the uPD78CP14 in any of 3 modes according to the MM register mode specification uPD78C18 modeNote e pPD78C14 mode e 78 12
70. A B C D E H L specified by R2RiRo 0 to 7 and stores the result in the specified register 5 Flags affected Z SK 0 L1 0 LO 0 6 Example SUB A A A lt 0 This operation clears the HC and CY flags and sets the Z flag SBB A r Subtract Register from A with Borrow 1 Operation code 10 1 1 0 0 0 0 1 1 1 1 0 R2 Ri Ro 2 Number of bytes 2 3 Number of states 8 8 4 Function DA A r CY Subtracts the contents of the register V A B C D H L specified by R2R1Ro 0 to 7 including the CY flag from the contents of the accumulator and stores the result in the accumulator 5 Flags affected Z SK 0 L1 lt 0 LO 0 6 Example SBB A L A A L CY SBB r A Subtract A from Register with Borrow 1 Operation code 10 1 1 0 0 0 0 0 O 1 1 1 0 R2 Ri Ro 2 Number of bytes 2 3 Number of states 8 8 4 Function r r A CY Subtracts the contents of the accumulator including the CY flag from the contents of the register r V A B C D E L specified by R2R1Ro 0 to 7 and stores the result in the specified register 5 Flags affected Z SK lt 0 L1 0 LO 0 CY 6 Example SBB B A B B A CY 255 CHAPTER 14 INSTRUCTION SET SUBNB Subtract Register from A Skip if Borrow 1 Operation code O 1 1 0 0 0 0 0 1 0 1 1 0 R2 Ri Ro 2
71. DNE DOFF DON DOR DRLL DRLR DSBB DSLL DSLR DSUB DSUBNB DXR E EADD Instruction A r rA wa rpa A byte r byte sr2 byte wa byte 353 INDEX OF INSTRUCTIONS ALPHABETICAL ORDER Instruction A rA wa rpa A byte r byte sr2 byte wa byte rp2 word r1 sr word word 2 byte sr2 byte wa byte 1 byte Instruction sr2 byte wa byte A wa rpa A byte r byte sr2 byte wa byte A wa rpa A byte r byte sr2 byte wa byte Instruction S SBB A r SBB SBBW wa SBBX rpa SBCD word SBI A byte SBI r byte SBI sr2 byte SDED word SHLD word SK SKIT SKN SKNIT SLL SLLC SLR SLRC SOFTI SSPD STAW STAX STEAX SIC STOP SUB SUB SUBNB SUBNB SUBNBW SUBNBX SUBW wa SUBX rpa SUI A byte SUI r byte SUI sr2 byte A byte r byte sr2 byte APPENDIX INDEX OF INSTRUCTIONS ALPHABETICAL ORDER Instruction 355
72. E E M 2 1 207 5 DMPA 22 EPROM MERE 2 2 1 AVA 0 AO AGGEESS anus sane 22 2 O7 to D ta EE EE A EOR 223 ACE G ip enable zi e etti vete ge e p d bw oO 10 13 15 16 18 19 21 22 23 23 23 23 23 25 26 27 27 27 28 28 28 28 28 28 29 29 29 29 29 29 29 30 30 30 30 2 3 2 4 2 5 CHAPTER 3 INTERNAL BLOCK FUNCTIONS 3 1 3 2 3 3 3 4 3 5 3 6 3 7 3 8 3 9 CHAPTER 4 PORT FUNCTIONS 4 1 4 2 4 3 4 4 4 5 4 6 CHAPTER 5 TIMER FUNCTIONS 5 1 CHAPTER 6 TIMER EVENT COUNTER FUNCTIONS 6 1 6 2 2 2 4 2 2 5 2 2 6 2 2 7 2 2 8 2 2 9 Pin Input Output Circuits OE Output enable MODE1 MOD RESET Reset Pin Mask Options uPD78C18 78C14A 78C12A 78C11A Only Processing of Unused Pins Registers Mode Registers Arithmetic Logical Unit ALU Program Status Word PSW 3 5 1 3 5 2 Timers Timer Event Counter Serial Interface Analog Digital Converter 3 10 Interrupt Control 3 11 Zero Cross Detector LPD78C18 78C17 78C14 78C14A 78C12A 78C114A 78C10A memory configuration UPD78CP18 78CP 14 MEMORY configuratiOni sosoran g ette d Port A PA7 to PAO Port B PB7
73. FUNCTIONS 2 When the transmit buffer register is full when the next data write is performed the previous data is corrupted Therefore when writing data to the transmit buffer register it is necessary to check that the serial transmission interrupt request flag INTFST is set 1 and the transmit buffer register is empty before executing the operation When the bit is 0 or when the serial register contains no data to be transmitted the TxD pin assumes the mark status 1 Transmit data is transmitted on the falling edge of SCK from the TxD pin with a clock rate of serial clock x 1 1 orx data transfer rate in transmission is set as shown in Table 7 2 according SCK and the clock rate at 15 MHz operation Caution When TxE changes from 0 to 1 transmission enabled while the transmit buffer register is empty INTST is generated Table 7 2 Maximum Data Transfer Rate at Transmission Internal Clock External Clock Clock Rate SCK Data Transfer Rate SCK Transfer Rate 625 kHz 625 kbps 1 25 MHz 1 25 Mbps 2 5 MHz 156 kbps 2 5 MHz 156 kbps 39 1 kbps 39 1 kbps Data reception A receive operation is enabled by setting 1 the RxE bit of the serial mode high register SMH The start bit is confirmed by detecting a low level RxD input and then detecting the low level again after a 1 2 bit time This is effective in preventing errors due to noise in the mark state Reception i
74. Figure 11 9 Memory Map uPD78C11A 0000H On chip ROM 4K bytes 1FFFH 1000H External expansion ROM 28K bytes 7FFFH 8000H External expansion RAM 16K bytes BFFFH CO00H External FEFFH expansion I O FFOOH On chip RAMP te FFFFH Note Can only used when the RAE bit of the MM register is 1 197 CHAPTER 11 EXTERNAL DEVICE ACCESSES AND TIMINGS 11 2 uPD78C17 78C10A External Device Access As the uPD78C17 78C10A have no on chip ROM it is possible to install an external device program memory data memory or a peripheral device in an external 63K byte area 0000H to FBFFH 64K byte area 0000H to FEFFH in addition to on chip RAM The address space of an externally installed device is set by the MODEO and MODE1 pins with a choice of 4K bytes addresses 0000H to OFFFH 16K bytes addresses 0000H to 3FFFH or 63K bytes addresses 0000H to FBFFH 64K bytes addresses 0000H to FEFFH Control Pins Operation Mode MODE1 MODEO External Address Area On Chip RAM Area 4k byte access bytes addresses 0000 to OFFFH Address FFOOH to FFFFH 16K byte access 16K bytes addresses 0000 to 3FFFH Addresses to FFFFH Setting Prohibited 63 access bytes addresses 0000 to FBFFH Addresses to FFFFH uPD78C17 only 64 access bytes addresses 0000 to FEFFH Addresses FFOOH to FFFFH uPD78C10A only The externa
75. Input Voltage and A D Conversion Results 145 Memory Map Store Example of A D Conversion Result 146 AJD Chanriel Mod Register Setting Seus tee bec peret de een en e 147 Interrupt Control Circuit Block Diagram 2 2 3 3 022200292 5 154 Mask Register MKL MKH Format 2 2 2 2 0 010000000000 nnn nr nis 156 Iiterr pt Sambplifig 159 Interrupt Operation senex msi ele RE Ronda 161 internal Configuration of NMI 162 Interrupt Servicing Sequence Masking released for both INT1 and 1 72 164 Interrupt Servicing Sequence Masking released for either INT1 or 2 165 3 Level Multiple Intetrupts 2 169 HALT Mode Release Timing RESET Signal 222 1 2 5 172 HALT Mode Release Timing Iri E State e rne tete e te tta ar dec des 173 HALT Mode Release Timing In DI State icto gt eR p abso ce Ex bee sass 173 Software STOP Mode Release Timing RESET Signal Input 175 176 Software STOP Mode Release Timing NMI Signal Input 176 Hardware STOP Mode Release Timing STOP Signal Input
76. LDED word Load D amp E Direct 1 Operation code 0 1 1 1 0 0 0 Low address High address lt 2 gt Number of bytes 4 lt 3 gt Number of states 20 14 lt 4 gt Function E word D word 1 Loads the contents of the memory addressed by the 3rd byte lower address and 4th byte upper address into the E register and loads the contents of the next memory address into the D register 5 Flags affected SK 0 L1 0 10 0 246 CHAPTER 14 INSTRUCTION SET LHLD word Load H amp L Direct 1 Operation code 10 1 1 1 0 0 0 0 2 Number of bytes 4 lt 3 gt Number of states 20 14 lt 4 gt Function L lt word H lt word 1 Loads the contents of the memory addressed by the 3rd byte lower address and 4th byte upper address into the L register and loads the contents of the next memory address into the H register 5 Flags affected 5 0 1160 106 0 LSPD word Load SP Direct lt 1 gt Operation code Low address High address lt 2 gt Number of bytes 4 lt 3 gt Number of states 20 14 lt 4 gt Function SP lt word SPH lt word 1 Loads the contents of the memory addressed by the 3rd byte lower address and 4th byte upper address into the low order 8 bits SPL of the stack pointer and loads the contents of the next memory address into the high order 8
77. Number of bytes 2 lt 3 gt Number of states 8 8 lt 4 gt Function lt Skip if no borrow Subtracts the contents of the register r V A B C D E H L specified by Ra2R Ro 0 to 7 from the contents of the accumulator and stores the result in the accumulator Skips if no borrow is generated as a result of the subtraction 5 Flags affected Z SK HC L1 lt 0 LO 0 CY 6 Example SUBNB A D amp A D A skip is performed if no borrow is generated as a result of the subtraction SUBNB r A Subtract A from Register Skip if No Borrow 1 Operation code O 1 1 0 0 0 0 0 0 1 1 0 Ri Ro 2 Number of bytes 2 3 Number of states 8 8 4 Function 5 r lt r A Skip if no borrow Subtracts the contents of the accumulator from the contents of the register r V A B C D E H L specified by R2R1Ro 0 to 7 and stores the result in the specified register Skips if no borrow is generated as a result of the subtraction 5 Flags affected Z SK HC L1 lt 0 LO lt 0 CY 6 Example To subtract A from the HL register pair SUBNB L A L lt L A SKIP IF NO BORROW SUI H HeH 1 256 CHAPTER 14 INSTRUCTION SET ANA A r And Register with A 1 Operation code 10 1 1 0 0 0 0 lt 2 gt Number of bytes 2 3 Number of states 8 8 lt 4 gt Function Obtains the logical product of the contents of the accumulator and the
78. Outputs high level PC 0 set to 1 Set to output port 3 Change MMC register 2 reset to 0 SCK pin set to port mode 0 reset 0 TxD pin set to port mode 4 Change SMH SK1 0 or SK1 1 Set to internal clock mode SK2 1 SK2 0 5 MKST bit set to 1 Mask INTST 6 INTFST flag reset 0 7 TxE bit gt set to 1 Enable transmission and start output of remaining serial register data 8 Test FST flag Wait until FST is set to 1 9 SK1 amp SK2 bits set to 1 Set to external clock 10 To initial setting of MCC MC MKST 125 CHAPTER 7 SERIAL INTERFACE FUNCTIONS 126 Caution 2 When fewer than 8 external clock pulses are input in reception 1 2 3 4 5 6 7 8 9 RxE bit reset to 0 MC 2 gt set to 1 MMC 2 reset to 0 Change SMH 5 1 0 5 1 1 SK2 1 SK2 0 MKSR bit set to 1 INTFSR flag reset to 0 RxE bit set to 1 SCK trigger bit set to 1 Test FSR flag 10 SK1 amp SK2 bits set to 1 11 To initial setting of MCC MC RxE MKSR Disable reception Set to input port SCK pin set to port mode Set to internal clock mode Mask INTSR Enable reception Start internal clock and start remaining control count Wait until FSR is set to 1 Set to external clock CHAPTER 7 SERIAL INTERFACE FUNCTIONS 7 3 4 Example of serial interf
79. Package ic shrink DIP ic QUIP ic QUIP straight ic OFP resin thickness 2 05 mm ic OFP resin thickness 2 7 mm QUIP resin thickness 2 7mm OFP inter pin pitch 0 8 mm ceramic piggyback QUIP plast ic shrink DIP ceramic shrink DIP with window plast plast ic QUIP resin thickness 2 7 mm ceramic WOFN plast ceramic QUIP with window plast ic QUIP CHAPTER 1 GENERAL DESCRIPTION uPD78C17 78C17 A uPD78C 78 uPD78C uPD78C uPD78C Part number 7CW 7GF 3BE 7GQ 36 7GF A 3BE 7GO A 36 64 pin 64 pin 64 pin 64 pin 64 pin 6 uPD78C18 78C18 A 78CP18 78CP18 A uPD78C uPD78C uPD78C uPD78C 078 Part number 8CW xxx 8GF xxx 3BE 8GO xxx 36 8GF A xxx 3BE 8GOQO A xxx 36 uPD78CP18CW uPD78CP18DW uPD78CP18GF 3BE uPD78CP18GO 36 uPD78CP18KB uPD78CP18GF A 3BE uPD78CP18GQ A 36 64 pin 64 pin 64 pin 64 pin 64 pin 64 pin 64 pin 64 pin 64 pin 64 pin 64 pin 64 pin Remark indicates ROM code number plast plast plast plast plast plast plast plast plast plast plast Package ic shrink DIP ic OFP resin thickness 2 7 mm ic QUIP resin thickness 2 7 mm ic QUIP Package ic shrink DIP ic OFP resin thickness 2 7 mm ic QUIP resin thickness 2 7 mm ic QUIP ic shrink DIP cer
80. SERIAL INTERFACE FUNCTIONS lt a gt The memory address for storing the receive data is set in the HL register pair The setting here is for storage of the receive data in address 2000H onward b The number of receive data bytes is set in the B register The setting here is for reception of 16 OFH data bytes c The MKSR bit of the interrupt mask register MKH is reset 0 releasing masking of INTSR internal interrupts The interrupt mask flag for INTST interrupts which have the same priority as INTSR interrupts is set 1 setting INTST interrupts as masked Figure 7 15 Interrupt Mask Register MKH Setting Serial Interface INTSR Mask Release INTAD masked INTSR masking released INTST masked d The RxE bit of the serial mode high register SMH is set 1 enabling reception Figure 7 16 Serial Mode High Register SMH Setting Serial Interface Reception Enable Previous status Reception enable Previous status e PC7 output is set to 0 activating CTS A program which performs the initialization required for reception is shown below 133 CHAPTER 7 SERIAL INTERFACE FUNCTIONS RVEN LXI H 2000H Set data pointer DP 2000H lt a gt MVI C OFH Set data counter 0 0 b EXX ANI MKH 05H INTST enable c ORI SMH 08H Receive enable d ANI PC 7FH OTSSD lt e gt Following the above settings an INTSR internal interrupt is generated each time
81. SP lt SP 2 Saves the upper half V B D H EAH of the register pair rp1 VA BC DE HL or extended accumulator specified by 20100 0 to 4 to the stack memory addressed by SP 1 and saves the lower half A L EAL to the stack memory addressed by SP 2 5 Flags affected SK 0 1160 10 0 lt 6 gt Example PROGRAM START SP 0 000 INTERRUPT ROUTINE PUSH V PUSH B PUSH D PUSH H PUSH EA POP EA POP H POP D POP B POP V DFF6H DFF7H DFF8H DFF9H DFFAH Stack contents when PUSH EA is executed DFFBH DFFCH DFFDH DFFEH DFFFH 249 CHAPTER 14 INSTRUCTION SET POP rp1 Pop Register Pair off Stack 1 Operation code 1 0 1 0 0 Oo 2 Number of bytes 1 3 Number of states 10 4 4 Function lt SP lt SP 1 lt SP 2 Restores the contents of the stack memory addressed by SP to the lower half A C E L EAL of the register pair 1 VA BC DE HL or extended accumulator specified by 20100 0 to 4 and restores the contents of the stack memory addressed by SP 1 to the upper half V B D H EAH 5 Flags affected SK 0 L1 0 10 0 6 Example PUSH B PUSH D POP D POP B As the stack pointer indicates the last stack address saved to the POP instruction restores items in the reverse order from that used in the PUSH instruction rp2 word Lo
82. TIMER1 count up lt c gt Port C settings are performed as follows PCO as TxD pin PC1 as RxD pin PC7 as output port and PC7 set to output a high level signal 129 CHAPTER 7 SERIAL INTERFACE FUNCTIONS Figure 7 13 Port C Setting Serial Interface PCO set as TxD pin PC1 set as RxD pin PC7 set as input output port PC7 output latch 1 PC7 output port When SCK of the 78 18 is output off chip or SCK is input from off chip the PC2 pin can be used as the SCK input output pin by setting the MCC register lt d gt bit of the serial mode high register SMH is set 1 enabling transmission Figure 7 14 Serial Mode High Register SMH Setting Serial Interface Transmission Enable 7 6 5 4 3 2 1 0 qp Previous status Transmission enable Previous status 130 CHAPTER 7 SERIAL INTERFACE FUNCTIONS The initialization program is shown below SERIAL INTERFACE INITIALIZATION xx SINIT MV SMH 00H Internal serial clock TO MV A OFEH X 16 even parity 8 bit character 2 stop bit MOV SML A Set serial mode J MV A 83 N MOV TMO A Set timer register MV A 02 Baud rate 110 bps f b MOV TM1 A MV TMM 61H Set timer mode amp start J MV A 07H Set port C mode control B MOV MCC A TxD RxD SCK available ORI PC 80H PC7 output latch 1 c MVI A 00H Initialize port C MOV
83. Working Register 1 Operation code O 1 1 0 0 1 1 2 Number of bytes 2 3 Number of states 10 7 4 Function B V wa Stores the accumulator contents in the working register addressed by the V register specifying the high order 8 bits of the memory address and the 2nd byte specifying the low order 8 bits 5 Flags affected SK 0 L1 0 L0 0 6 Example MVI V OEEH STAW OFFH Store A in address EEFFH LDAW wa Load A With Working Register 1 Operation code 10 0 0 0 0 0 0 1 2 Number of bytes 2 lt 3 gt Number of states 10 7 lt 4 gt Function A lt V wa Loads the contents of the working register addressed by the V register specifying the high order 8 bits of the memory address and the 2nd byte specifying the low order 8 bits into the accumulator lt 5 gt Flags affected SK 0 L1 0 L0 0 238 CHAPTER 14 INSTRUCTION SET STAX rpa2 Store A to Memory addressed by Register Pair 1 Operation code 0 1 1 1 Ao lt 2 gt Number of bytes states The number of bytes and number of states are as shown below depending on the rpa2 specification __ Hea HEA 2 1 2 Number of bytes 1 Number of states lt 3 gt Function 2 A Stores the accumulator contents in the memory addressed by the register pair rpa2 BC DE HL DE HL DE HL
84. addressed by the register pair roa BC DE HL DE HL D HL specified by A2A1Ao 1 to 7 from the contents of the accumulator Skips if the result of the subtracti o n is zero A rpa 5 Flags affected ZL SK L1 lt 0 LO 0 CY 6 Example SKIP IF A DE A skip is performed when the contents of A and the contents of the memory addressed by the DE register pair are equal ONAX rpa On Test Memory addressed by Register Pair with A 1 Operation code 0 1 1 1 0 0 0 0 1 1 0 1 Ai Ao lt 2 gt Number of bytes 2 lt 3 gt Number of states 11 8 lt 4 gt Function A rpa Skip if no zero Obtains the logical product of the contents of the accumulator and the contents of the memory addressed by the register pair rpa BC DE HL DE HL DE HL specified by AzA1Ao 1 to 7 and skips if the logical product is not zero lt 5 gt Flags affected Z SK L1 lt 0 LO lt 0 OFFAX rpa Off Test Memory addressed by Register Pair with A 1 Operation code 0 1 1 1 0 0 0 0 1 1 0 1 1 Ai Ao 2 Number of bytes 2 3 Number of states 11 8 4 Function A rpa Skip if zero Obtains the logical product of the contents of the accumulator and the contents of the memory addressed by the register pair roa BC DE HL DE HL DE HL specified by A2A1Ao 1 to 7 and skips if the logical product Is zero lt 5 gt Flags affected 12 5
85. at all other times Supplies Vcc power supply Ver to 27C256 27C256A at same potential as lower pin Supplies Vcc power supply Vcc to 27C256 27C256A at same potential as lower pin Connected to 27C256 27C256A GND pin at same potential as lower Vss pin Supplies OE signal always low to 27C256 27C256A at same potential as lower Vss pin A 2 Memory Configuration Supplies A14 signal always low to 27C256 27C256A at same potential as lower Vss pin The memory of the uPD78CG14 allows implementation of the same functions and configuration as the wPD78C11A 78C12A 78C14 Also the piggyback EPROM address range can be selected by means of the memory mapping register for efficient setting of external memory excluding EPROM The vector addresses call table area and data memory area are the same for all three product types The memory maps are shown in Figures A 1 to A 3 342 APPENDIX INTRODUCTION TO PIGGYBACK PRODUCT Figure A 1 Memory Map uPD78C14 Mode 0000H 0000H 16384 8 bits 0008H INTTO INTT1 3FFFH 4000H 0010H INT1 INT2 External memory 0018H INTEO INTE1 48896 x 8 bits 0020H INTEIN INTAD FEFFH FFOOH A hi n cnip 0028 INTSR INTST 256 x 8 bits f FFFFH 0060H SOFTI 0080H Low address t 0 0081H High address
86. bus are output as they are in synchronization with ALE in the first state of all machine cycles 2 Emulation cannot be performed by an emulator for a program which varies the port D operating mode dynamically Therefore once the mode has been set it should not be changed to a different mode Upon RESET input PD7 to PDO are set as input port high impedance PD7 to PDO also become high impedance in the hardware STOP mode 78 17 78 10 These pins function only as time division address output and data input output multiplexed address data bus pins for accessing externally installed memory The pins output the lower 8 bits of the memory address in the first state and become a bidirectional 8 bit data bus in the second and third states When the RESET signal is low or when in the hardware STOP mode or a standby mode HALT or STOP PD7 to PDO are high impedance Caution Port D can only be used as an address data bus 25 CHAPTER 2 PIN FUNCTIONS 2 1 5 PF7 to PFO Port F 3 state input output uPD78C18 78C14 78C14A 78C12A 78C11A 78CP18 78CP14 These are the 8 bit input output pins of port F 8 bit input output port with output latch but in addition to functioning as an input output port they also function as address outputs AB15 to AB8 for accessing externally expanded memory Pins PF7 to PFO can be specified as shown below by setting the memory mapping register 1 Port mode As port F input
87. circuit enable The zero cross detector detects a negative to positive or positive to negative transition of the AC signal input through an external capacitor and generates a digital pulse which changes from 0 to 1 or 1 to 0 at each transition point Figure 3 14 Zero Cross Detection Signal AC input signal Zero cross detection signal A digital pulse generated in the zero cross detector of the INT1 pin is set to the interrupt control circuit The INTF1 interrupt request flag is set at the zero cross point from negative to positive of the AC signal rising edge and if INT1 interrupt is enabled interrupt servicing is started A digital pulse generated in the INT2 TI zero cross detector is sent to the interrupt control circuit and interrupt servicing can be started at the zero cross point from positive to negative of the AC signal as with the INT1 pin and can also be used as a timer input clock 58 CHAPTER 3 INTERNAL BLOCK FUNCTIONS The zero cross detection function can use the 50 60 Hz power signal as the basis for system timing Further a special characteristic of the zero cross function is that it can be used for servicing of interrupts at the zero voltage point This makes it possible to control a device which uses voltage phase sensing such as a TRIAC or SCR and allows the uPD78C18 to be used for applications such as shaft speed and angle measurement When a capacitor is not connected to the INT1 and INT2
88. code AsA2A1A0 in the instruction as the operand address the contents of that register pair are automatically incremented by 1 thus preparing for the next addressing operation Auto increment addressing is used when an instruction with the following operand formats is executed Notation rpa rpa2 Examples 1 Description Method D H D H STAX rpa2 Operation code As 0 1 1 1 Ar Ao If the auto increment mode is selected for the DE register pair used as 2 the instruction is written as shown below D DE A DE DE 1 The corresponding operation code is shown below Operation code 0 0 1 1 1 1 0 0 2 Execution of the BLOCK instruction Although not specified by an operand when the BLOCK instruction is executed the HL register pair is automatically selected as the source address register and the DE register pair as the destination address register After the data transfer from the source address to the destination address has been performed the HL and the DE register pairs are both automatically incremented by 1 BLOCK DE lt HL DE DE 1 lt HL 1 3 Execution of a return instruction on POP instruction Although not specified by an operand when a return instruction or POP instruction which restores data saved to the stack area is executed auto incrementing of the stack pointer SP is performed RET PCL lt SP PCH lt 5 1 SP lt SP 2 223 CHAPTER 1
89. contents of the accumulator Skips if a borrow is generated as a result of the subtraction A lt byte lt 5 gt Flags affected Z SK HC L1 lt 0 LO lt 0 CY byte Less Than Immediate 1 Operation code 10 1 1 1 0 2 Number of bytes 3 3 Number of states 11 11 4 Function Skip if borrow Subtracts the immediate data in the 3rd byte from the contents of the register r V A B C D E H L specified by R2R1Ro 0 to 7 Skips if a borrow is generated as a result of the subtraction r byte 5 Flags affected Z SK HC L1 lt 0 LO lt 0 CY LTI sr2 byte Less Than Immediate 1 Operation code 10 1 1 0 0 1 0 0 2 Number of bytes 3 3 Number of states 14 11 4 Function sr2 byte Skip if borrow Subtracts the immediate data in the 3rd byte from the contents of the special register sr2 PA PB PC PD PF MKL ANM SMH EOM TMM specified by 53525150 0 to 3 5 to 9 B D Skips if a borrow is generated as a result of the subtraction sr2 byte 5 Flags affected Z SK HC L1 lt 0 10 lt 0 CY 280 CHAPTER 14 INSTRUCTION SET NEI A byte Not Equal Immediate with A 1 Operation code O 1 1 0 0 1 1 1 2 Number of bytes 2 3 Number of states 7 7 4 Function A byte Skip if no zero Subtracts the immediate data in the 2nd byte from the contents of the accumulator Skips if th
90. contents of the register r V A B C D E H L specified by R2R Ro 0 to 7 and stores the result in the accumulator lt 5 gt Flags affected ZSK 0 L1 0 L10 0 lt 6 gt Example ANA A lt And A with Register 1 Operation code 10 1 1 0 0 0 0 0 0 0 0 0 1 R2 Ri Ro 2 Number of bytes 2 3 Number of states 8 8 4 Function rerAA Obtains the logical product of the contents of the register r V A B D H L specified by RzR1Ro 0 to 7 and the contents of the accumulator and stores the result in the specified register 5 Flags affected ZSK 0 L1 0 L0 0 6 Example AH HAA Register with A 1 Operation code 10 1 1 0 0 0 0 0 lt 2 gt Number of bytes 2 3 Number of states 8 8 lt 4 gt Function lt Avr Obtains the logical sum of the contents of the accumulator and the contents of the register r V A B C D E H L specified by R2R1Ro 0 to 7 and stores the result in the accumulator lt 5 gt Flags affected ZSK 0 L1 0 L0 0 lt 6 gt Example ORA AVH 257 CHAPTER 14 INSTRUCTION SET r A Or A with Register 1 Operation code 10 1 1 0 0 0 0 0 0 0 1 1 R2 Ri Ro 2 Number of bytes 2 3 Number of states 8 8 4 Function B rervaA Obtains the logical sum of the contents of the register r V A C D E H
91. flag and 0 is loaded into r2o lt 5 gt Flags affected SK amp 0 L1 0 LO 0 308 CHAPTER 14 INSTRUCTION SET SLR r2 Shift Logical Right Register 1 Operation code 10 1 0 0 1 0 0 0 2 Number of bytes 2 3 Number of states 8 8 4 Function 2 1 2m 27 lt 0 lt 120 7 0 Performs 1 bit right shift of the contents of the register r2 A B C specified by R1Ro 1 to 3 20 15 shifted into the CY flag and 0 is loaded into 27 lt 5 gt Flags affected SKeO L1 amp 0 10 lt 0 SLLC r2 Shift Logical Left Register Skip if Carry 1 Operation code 10 1 0 0 1 0 0 0 lt 2 gt Number of bytes 2 3 Number of states 8 8 4 Function r2m 1 lt 12m 120 lt 0 CY lt r27 Skip if carry Performs 1 bit left shift of the contents of the register r2 A B C specified by RiRo 1 to 3 r27 is shifted into the CY flag and 0 is loaded into 20 Skips if a carry is generated as a result of the shift 5 Flags affected SK L1 0 LO lt 0 CY 309 CHAPTER 14 INSTRUCTION SET SLRC r2 Shift Logical Right Register Skip if Carry 1 Operation code 10 1 0 0 1 000 lt 2 gt Number of bytes 2 3 Number of states 8 8 4 Function 2 1 2 27 lt 0 CY lt 120 7 0 Performs a 1 bit right shift of the contents of the register r2 A B C specified by R1Ro 1 to 3 r2ois sh
92. for 50 duty 329 CHAPTER 15 OPERATING PRECAUTIONS 15 5 Serial Interface Start Bit Input e Target products e Details e Remedy All products When receiving serial data in the asynchronous mode if approximately 1 2 bit pulse is input to the RxD pin the data parity stop bit input is prohibited and an overrun error may result at the time next data Is input Examine the following methods 1 Never input approximately 1 2 bit start bit to the RxD pin 2 When the ER flag is set issue the retransmit request to the transmitting side 15 6 Serial Interface and Transmission Format Change e Target products Details e Remedy All products Serial interface may hang up if a transmit data format is changed by manipulating the SML and SMH registers while transmitting data in the serial register This may occur event if the TxE bit is reset 0 The reasons are as follows When the TxE bit is changed from the set 1 state to reset 0 state the send disabled will result after completing data sending from the serial register Therefore if change is made while data is left in the serial register the serial interface may not be sent Examine the following methods 1 Set the destination mode so that the transfer format needs not be changed 2 When changing transfer format take measure on software so that the transfer format is not be change until the serial register data is sent out after resetting 0 TxE bit
93. in the event of a match between ECNT ETMO or a match between ECNT When the LDO bit of the timer event counter output mode register EOM is set 1 the LVO level is inverted after transfer to the output latch 85 CHAPTER 6 TIMER EVENT COUNTER FUNCTIONS 86 4 CO10 amp CO11 bits 6 amp 7 In similar way to the and COO bits these bits specify the timing for transfer to the output latch of the level of the LV1 level F F When CO10 0 and CO11 1 or CO10 1 and CO11 1 the LV1 level is transferred to the output latch as with the and bits When the LD1 bit of the timer event counter output mode register EOM is set 1 the LV1 level is inverted after transfer to the output latch The timer event counter mode register is reset to 00H by RESET input and in the hardware STOP mode CHAPTER 6 TIMER EVENT COUNTER FUNCTIONS Figure 6 2 Timer Event Counter Mode Register Format 7i 6 5 4 3 2 1 0 11 01 1 EMO ETO ECNT input clock Internal clock 12 12 while Cl input is high Cl input Cl input while TO is high Stop after clearing Free running eared every full count eared on fall of Cl input ET1 0 eared on fall of TO ET1 1 eared by match between ECNT and ETM1 COO output timing Match between ECN Setting prohibited
94. in 15 4 Restrictions on Serial Interface and Asynchronous Modes and 15 8 Limitations on Hardware STOP mode Therefore the above defects are found in the course of debugging Remedy If the defective product is replaced by the improved product or trouble free product is used for debugging change emulation CPU from Standard of uPD78C10A to any of standards other than 15 12 Electrostatic Withstand Limit of Vpp Pin Target products uPD78CP18 Standard Details The VPP pin can withstand a maximum of 500V static electricity in the MIL standard measuring method e Remedy Take suitable precautions when writing to the PROM or mounting the device 336 APPENDIX INTROCUTION TO PIGGYBACK PRODUCT uPD78CG14 On Chip EPROM Type 8 Bit Microcontroller with A D Converter The uPD78CG14 8 bit microcontroller allows program memory standard 27C256 27C256A EPROM to be connected by the piggyback method The uPD78CG14 is pin compatible with the uPD78C114 78C124 78C14 OUIP type 8 bit shingle chip microcontrollers with on chip mask ROM and has identical functions The uPD78CG 14allows the program to be changed by rewriting the EPROM andis suitable for uPD78C1 1A 78C12A 78C14 evaluation and limited production Features e Compatible with uPD78C114 78C12A 78C14 QUIP type products Capacity accessible as piggyback memory can be changed by software 16K 8K 4K bytes e Program memory addressing capacity 65280 x 8 bits e On
95. just after the hardware STOP mode has been released after the STOP signal has changed from the low to high level program execution starts when the RESET signal chnages from the low to high level see Figure 10 9 The oscillation stabilization time should therefore be taken into account when returning the RESET signal to the high level After RESET signal input RAM contents are retained but the contents of other registers are undefined Figure 10 8 Hardware STOP Mode Release Timing RESET Signal Input STOP Instruction Execution of address 0 execution instruction CPU operation RESET OSC 178 CHAPTER 10 CONTROL FUNCTIONS Figure 10 9 Hardware STOP Mode Release Timing STOP Signal Rising to RESET Signal Input STOP Instruction Execution of address 0 execution instruction CPU operation RESET oc 1 UU UU UU UU UL In the case of a hardware STOP mode release as with a release of the software STOP mode by means of the RESET signal it is possible to differentiate between a power on start and a start due to release of the hardware STOP mode by testing the SB flag using a skip instruction 10 1 7 Low supply voltage data retention mode The low supply voltage data retention mode can be set by decreasing the supply voltage after setting the software hardware STOP mode RAM contents can be retained with lower power dissipation than in the software hardware ST
96. logical product of the contents of the working register addressed by the V register high order 8 bits and the immediate data in the 2nd byte low order 8 bits and the immediate data in the 3rd byte and skips if the result is not zero lt 5 gt Flags affected 12 5 116 0 1060 292 CHAPTER 14 INSTRUCTION SET OFFIW wa byte Off Test Immediate with Working Register 1 Operationcode 10 1 0 1 0 1 0 1 lt 2 gt Number of bytes 3 lt 3 gt Number of states 13 10 lt 4 gt Function V wa A byte Skip if zero Obtains the logical product of the contents of the working register addressed by the V register high order 8 bits and the immediate data in the 2nd byte low order 8 bits and the immediate data in the 3rd byte and skips if the result is zero lt 5 gt Flags affected Z SK L1 lt 0 LO lt 0 293 CHAPTER 14 INSTRUCTION SET 14 6 7 16 bit operation instructions EADD EA r2 Add Register to EA 1 Operation code O 1 1 1 0 0 0 0 1 0 00 0 R Ro 2 Number of bytes 2 3 Number of states 11 8 4 Function EA 2 Adds the contents of the register r2 A C specified by RiRo 1 to 3 to the contents of the low order 8 bits of the extended accumulator and stores the result in the extended accumulator lt 5 gt Flags affected Z SK lt 0 L1 0 LO lt 0 DADD EA rp3 Add Register Pair to EA 1 Operation code O 1 1 1
97. lt EAH Transfers the contents of the lower half EAL of the extended accumulator the lower register C E L of the register pair rp3 DE HL specified by P Po 1 to 3 and the contents of the upper half EAH to the upper register B D H of the register pair lt 5 gt Flags affected SK 0 L1 0 L0 0 6 Example DMOV B EA C lt EAL B lt EAH DMOV EA rp3 Move Register Pair to EA 1 Operation code 1 0 1 0 1 Po 2 Number of bytes 1 3 Number of states 4 4 4 Function 5 EAL lt EAH lt 3 Transfers the contents of the lower register C E 1 of the register pair rp3 BC DE HL specified by P1Po 1 to 3 to the lower half EAL of the extended accumulator and the contents of the upper register B D H of the register pair to the upper half EAH lt 5 gt Flags affected SK 0 L1 0 10 0 6 Example DMOV EA B EAL lt lt B DMOV sr3 EA Move EA to Special Register 1 Operation code O 1 0 1 0 0 0 2 Number of bytes 2 3 Number of states 14 8 4 Function i sr3 lt EA Transfers the extended accumulator contents to the special register sr3 0 ETM1 specified by Uo 0 1 lt 5 gt Flags affected SK lt 0 11 0 10 0 lt 6 gt Example i DMOV EA Transfer EA to ETMO 242 CHAPTER 14 INSTRUCTION SET DMOV EA sr4 Move Special Register to EA
98. lt 2 gt Number of bytes 3 lt 3 gt Number of states 14 11 lt 4 gt Function A Skip if no zero Obtains the logical product of the contents of the accumulator and the contents of the working register addressed by the V register high order 8 bits and the immediate data in the 3rd byte low order 8 bits and skips if the result is not zero lt 5 gt Flags affected Z SK L1 lt 0 LO lt 0 OFFAW wa Off Test Working Register with A 1 Operation code 10 1 1 1 0 1 0 0 2 Number of bytes 3 3 Number of states 14 11 4 Function A V wa Skip if zero Obtains the logical product of the contents of the accumulator and the contents of the working register addressed by the V register high order 8 bits and the immediate data in the 3rd byte low order 8 bits and skips if the result is zero lt 5 gt Flags affected 12 5 116 0 1060 ANIW wa byte And Immediate with Working Register 1 Operation code 10 0 0 0 0 1 0 1 2 Number of bytes 3 3 Number of states 19 10 4 Function 5 V wa V wa A byte Obtains the logical product of the contents of the working register addressed by the V register high order 8 bits and the immediate data in the 2nd byte low order 8 bits and the immediate data in the 3rd byte and stores the result in the addressed working register lt 5 gt Flags affected 2 5 lt 0 116 0 10 0 290 CHAPTER 14 INST
99. not affect the receive buffer Serial mode registers These are two 8 bit registers which control the operating mode of the serial interface see 7 2 Serial Mode Registers for details As the serial interface has a serial register and a buffer for send and receive operations it can send and receive data independently full duplex double buffer method transmitter receiver However as the serial clock SCK is used for both send and receive operations a half duplex method is employed in the synchronous mode and the O interface mode 108 CHAPTER 7 SERIAL INTERFACE FUNCTIONS 7 2 Serial Mode Registers These are two 8 bit registers which specify the serial interface operation mode serial clock data format etc 7 2 1 Serial mode high register SMH The individual bits of the serial mode high register are used to specify the operating mode as shown below The configuration of this register is shown in Figure 7 2 1 SK1 SK2 bits 0 amp 1 These bits specify whether an internal clock or external clock is used as the serial clock SCK When an internal clock is specified as the serial clock the serial clock value is determined by the following expressions For internal clock 024 SCK SCK 24 For internal clock 384 Sck 26 CK 384 For output used as internal clock When the timer input clock is 012 erp enm 24x C C When the timer input clock is 384 fxx SCK 768 x C
100. occurs able 9 2 shows maximum interrupt wait times The 14 states of component 10 max in the case of NMI indicate the time required until the interrupt request signal becomes active and is recognized as a normal signal and INTFx is set 1 Therefore this time is only required in the case of NMI INT1 and INT2 interrupts The 59 states of component Il indicate the instruction execution time for the longest instruction This time depends on the performance of the INTFx check at the end of each instruction Thus the required time for component varies depending on the instruction being executed at that time from a minimum of 4 states to a maximum of 59 states The 16 states of component Ill represent the time required to save the contents of the PSW and PC to the stack memory Table 9 2 Maximum Interrupt Wait Time Wait Time Components 1 1 INT2 Others Time required for noise elimination 14 states 10 us MAX 0 states Time required for instruction execution divide instruction 59 states 59 states 59 states Time required for automatic save processing 16 states 16 states 16 states 89 states 75 states 10 us 75 states 22 25 us 12 MHz 28 75 12 MHz 18 75 us 12 MHz Total time 168 CHAPTER 9 INTERRUPT CONTROL FUNCTIONS 9 7 Multiple Interrupts When the El instruction is executed all external and internal interrupt requests are enabled even when an interrupt se
101. or LO1 bit is set 1 the level of the level F F LVO or LV1 is output to the output pin These bits are automatically reset 0 when the level is output 2 LDO amp LD1 bits 1 amp 5 These bits determine whether or not the LVO LV1 level is inverted using the timing specified by the timer event counter mode register When the LDO LD1 bitis set 1 the LVO LV1 level is inverted using the specified output timing When the LDO LD1 bit is reset 0 inversion is disabled 3 LREO LRE1 LRE2 LRE3 bits 2 3 6 7 These bits perform level F F setting resetting When the LREO or LRE2 bit is set 1 LVO or LV1 is reset respectively and when is set 1 LVO LV1 is set These bits automatically return to 0 when the level F F is set reset 88 CHAPTER 6 TIMER EVENT COUNTER FUNCTIONS EOM The timer event counter output mode register is reset to by RESET input and the hardware STOP mode Figure 6 4 Timer Event Counter Output Mode Register Format 7 6 5 4 3 2 1 0 LRE2 LD1 LO1 1 LREO LVO data output No operation LVO contents output output trigger LVO level inversion Disable Enable LVO set reset No operation LVO reset LVO set Setting prohibited No operation LV1 contents output LV1 level inversion Disable Enable LV1 set reset No operation LV1 reset LV1
102. output pins PF7 to PFO can be specified bit wise as input or output by means of the mode F register 2 Expansion mode When an external device is expanded in addition to on chip memory PF7 to PFO are used as an address bus AB15 to AB8 corresponding to the size of the external device as shown in Table 2 2 When an instruction which references an external device is executed the upper address information for the external device is output in the external device reference machine cycle of that instruction Caution Pins PF7 to PFO set as an address bus have output to them the contents of the internal address bus as they are in all machine cycles Pins not specified as address output pins are in port mode Caution Emulation cannot be performed by an emulator for a program which varies the port F operating mode dynamically Therefore once the mode has been set it should not be changed to a different mode Table 2 2 Operation of PF7 to PFO uPD78C18 78C14 78C14A 78C12A 78C11A 78CP18 78CP14 External Address Space Up to 256 bytes Up to 4K bytes Up to 16K bytes Up to 31K 48K 56K 60K bytesNote Note 31K uPD78C18 48K uPD78C14 78C14A 56K uPD78C12A 60K uPD78C11A The operation of the uPD78CP18 and 78CP14 differ depending on the setting of bits MM5 to MM7 of the memory mapping register In the reset state RESET input low or in the hardware STOP mode STOP input low pins PF7 to PFO become
103. que seda 187 3 1 Pin Functions in PROM Programming 22 2 2 222 207 13 2 PROM Programming Modes ustedes deeem he tee per prete sd eda Luce Beaune 208 3 3 Recommended Connection of Unused Pins In PROM Programming 208 5 1 Compare Register Match Signal and Match Interrupt of Each 328 xi CHAPTER 1 GENERAL DESCRIPTION CMOS version products in the 87AD series have the following functions integrated in a single chip e ROM except uPD78C17 78C10A e RAM e 16 bit ALU e A D converter e Multi function timers event counters e General purpose serial interface etc 87AD series CMOS products offer enhanced standby functions and a wide range of packages while maintaining compatibility with existing NMOS products This allows further reductions in system low power consumption and size to be achieved The features of the various products are shown below Product Name PD78C10A uPD78C10A A On Chip ROM None On Chip RAM 256 x 8 bits External Expansion Memory Up to 64K bytes Remarks ROM less product PD78C11A uPD78C11A A x 8 bits 256 x 8 bits Up to 60K bytes On chip pull up resistor specifiable PD78C uPD78C 8K x 8 bits 256 x 8 bits Up to 56K bytes On chip pull up resistor specifiable PD78C PD78C uPD78C PD78CP14 uPD78CP14 A 16K x 8 bits
104. register for the interrupt request be unmasked is set 0 and the other bit is set to 1 In this case if an interrupt requestis generated by setting the unmasked interrupt request flag and that interrupt request Is acknowledged in accordance with the interrupt operation the interrupt request flag is automatically reset When the masked interrupt request flag is set that interrupt request is held pending When the pending interrupt request is unmasked it is acknowledged if there are no other interrupt requests of higher priority in the interrupt enable state Whether or not the interrupt request flag for the acknowledged interrupt is automatically reset depends on the setting of the mask register of the same priority If the other interrupt request is masked when masking is released the interrupt request flag is automatically reset but if the other interrupt request remains unmasked when masking is released the interrupt request flag is not reset even though the interrupt request is acknowledged see 9 4 1 When both types are unmasked Figure 9 7 Interrupt Servicing Sequence Masking released for either INT1 or INT2 Save registers INT Interrupt service program Restore registers ETI am Remark In this example masking is released by the mask register for one of the interrupt requests which have the same priority 165 CHAPTER 9 INTERRUPT CONTROL FUNCTIONS 3 When both types are maske
105. set Setting prohibited 89 CHAPTER 6 TIMER EVENT COUNTER FUNCTIONS 6 3 Timer Event Counter Operation Timer event counter operation is started by setting the count value and operating mode following the procedure shown in Figure 6 5 Once these settings have been made operation continues in that mode until the mode register is set again Figure 6 5 Timer Event Counter Setting Procedure Clear timer event counter RESET input upcounter ECNT Set count value in timer event counter REGO 1 ETMO 1 Timer event counter output In case of programmable mode register EOM setting rectangular wave output Timer event counter mode register ETMM setting 1 Port mode setting MCC Start of count Interrupt m Pin output 6 3 1 Interval timer mode In this mode the timer functions as an interval timer which generates interrupts repeatedly with the specified count time as the interval This interval timer allows a count to be specified from 1 us to 65 535 ms with a resolution of 1 us at 12 MHz operation After the timer event counter upcounter ECNT is cleared the count value is set in timer event counter REGO 1 1 Then when the data shown in Figure 6 6 is set in the timer event counter mode register the timer event counter operates as an interval timer using the internal clock 012 as the input clock 90 CHAPTER 6 TIMER EVENT COUNTER FUNCTI
106. supply source Caution Inthel Ointerface mode one pulse is output at low level from the TxD pin at the time of changing from the transmit enable state to receive enable state transmit disable 1 Data transmission 124 A transmit operation in the I O interface mode is enabled by setting 1 the bit of the serial mode high register When data is written to the transmit buffer register by a MOV TXB Ainstruction and the previous data transfer is terminated the transmit buffer register contents are transferred to the serial register When SCK is an internal clock when the data is transferred to the serial register a controlled SCK 8 pulses for one data item is automatically generated and the transmit data is sent MSB first on the SCK falling edge When an external clock is used the transmit data is sent MSB first on the falling edge of the controlled SCK input to SCK In this mode synchronization is implemented by means of a controlled SCK 8 serial clock pulses and SCK should be driven high except during a data transfer When the transmit buffer register becomes empty a serial transmission interrupt INTST is generated Serial transmission interrupts are disabled by setting 1 the MKST bit of the interrupt mask register MKH The maximum data transfer rate in transmission is 625 kbps when an internal clock is used as SCK and 1 25 Mbps when an external clock is used at 15 MHz operation CHAPTER 7 SERIAL INTERFACE FUNCT
107. system noise can be minimized by supplying a stable power supply to these pins The A D converter can also vary the voltage range for conversion by varying Varer and the A D converter operation can be controlled by inputting a low level signal to VAREF 137 CHAPTER 8 ANALOG DIGITAL CONVERTER FUNCTIONS gt gt gt gt gt gt gt gt 013 WBN Figure 8 1 A D Converter Block Diagram Sampling amp hold r 777777 1 2 8 L oo o 1 Series resistance e string 1 pu ME R 2 R 1 1 Pou A D channel mode Comparator 5 register 8 S i 8 1 1 1 1 1 Internal bus R 2 amo AVss L From Varer Internal bus Caution A capacitor should be connected to the analog input pins AN7 to ANO and the reference voltage 138 input pin to prevent errors due to noise A voltage outside the range from AVss to should not be applied to any of the pins AN7 to ANO which are not used or which use an edge detection function as this will adversely affect the conversion precision An effective means of noise protection in this case is clamping with a diode with a small Vr such as Schottky diode In addition the impedance of the analog signal input source and the reference voltage input source should be as small as possible CHAPTER 8 ANALOG DIGITAL CONVERTER
108. the Cl pin is measured Since the external pulses in the period basic time during which the timer output TO is high are counted in this mode the timer needs to be started beforehand After first clearing ECNT the operation is started by setting the data shown in Figure 6 10 in the timer event counter mode register Figure 6 10 Timer Event Counter Mode Register Setting Frequency Measurement Mode 0 7 6 5 4 3 2 1 2022 22218121 Cl input count while is high ECNT cleared on fall of TO ECNT counts the external pulses input to the pin while the timer output TO is high When the timer output falls the ECNT contents are transferred to the timer event counter capture register ECPT ECNT is cleared and an interrupt INTEIN is generated see Figure 6 11 Since the input to ECNT is the Cl input while TO is high ECNT is cleared and the interrupt generated by the fall of TO see 6 1 6 Clear control circuit and 7 Interrupt control circuit Figure 6 11 Frequency Measurement Mode Operation Timer output TO Cl input ECNT input INTEIN c ECNT contents transferred to ECNT cleared Interrupt acknowledgment 93 CHAPTER 6 TIMER EVENT COUNTER FUNCTIONS 6 3 4 Pulse width measurement mode The pulse width measurement mode is used to measure the high level width of external pulses input to the Cl pin After first clearing ECNT the operation is started by setting t
109. to PBO Port C PC7 to PCO Port D PD7 to PDO Port F PF7 to PFO Operation of Arithmetic and Logical Operation Instruction Involving a Port and Immediate Data Timer Configuration 5 2 Timer Mode Register TMM 5 3 Timer Operations Timer Event Counter Configuration Mode Registers 6 2 1 6 2 2 Timer event counter mode register Timer event counter output mode register EOM 30 30 30 30 30 30 31 37 37 39 39 41 42 42 44 44 52 57 57 57 57 57 58 61 61 65 66 70 71 73 75 75 77 79 81 81 85 85 88 6 3 Timer Event Counter Operation 0 44204420 90 6 3 1 Interval timer MOS 90 6 3 2 nn 92 6 3 3 Frequency measurement 93 6 3 4 Pulse Width measurement mode caen accetto ee etie cea cte dace nel 94 6 3 5 Programmable rectangular wave output 06 2 7 95 6 3 Timer event counter program examples 1 0 00 00000000000 97 CHAPTER 7 SERIAL INTERFACE 65 020000 0 40 107 7 1 Serial Interface Configuration 00 2 440 188 107 7 2 Serial Mode RegisSters to Ru XE s CERA EE ROO RR XR 1
110. triggered rising edge maskable interrupt input pin can also be used as AC input zero cross detection pin AN7 to ANO Analog input 8 analog inputs to A D converter AN7 to AN4 can also be used as edge detected falling edge inputs VAREF Reference voltage Dual function as A D converter reference voltage input pin and A D converter operation control pin Analog A D converter power supply pin AVss Analog Vss A D converter GND pin X1 X2 Crystal System clock oscillation crystal connected inputs When clock is supplied externally it is input to X1 Input inverted phase clock of X1 to X2 RESET Reset Low level active system reset input STOP Stop Hardware STOP mode control signal input pin When driven low oscillator operation stops Positive power supply Vss GND pin Note Should be pulled up The pull up resistor specification is 4 0 4cyc tcvc in ns units 341 APPENDIX INTRODUCTION PIGGYBACK PRODUCT A 1 2 Upper pins 27C256 27C256A compatible Pin Name Input Output Function Outputs 14 bits PCO to PC13 of program counter comprising 27C256 27C256A address signals Ao to A13 After Reset Undefined Inputs data Oo to 07 read from 27C256 27C256A Supplies chip enable signal to 27C256 27C256A CE pin High in hardware software STOP amp HALT mode low
111. uPD27C256A compatible and this chapter should be read in conjunction with documentation on the uPD27C256A Table 13 1 Pin Functions in PROM Programming Pin Name Function RESET Low level input in write verify and read MODEO High level input in write verify and read MODE1 Low level input in write verify and read VppNote1 High voltage input in write verify high level input in read Chip enable input OENote1 Output enable input A13 to AQNotes1 2 Address input A14 to AONotes1 3 Address input 2 Low level input in write verify and read 7 Data input in write data output in verity read VppNote1 Power supply voltage input Notes 1 These pins correspond to the uPD27C256A 2 uPD78CP14 only 3 uPD78CP18 only Cautions 1 The uPD78CP18DW 78CP18KB 78CP14DW 78CP14KB 78CP14R which are provided with an erase window should be fitted with a light protective cover film when EPROM erasure is not being performed 2 The uPD78CP18CW 78CP18GF 3BE 78CP18GO 36 78CP14CW 78CP14G 36 78CP14GF 3BE 78CP14L one time PROM products are not provided with an erase window and thus UV erasure cannot be used on these devices 207 CHAPTER 13 PROM WRITE AND VERIFY OPERATIONS uPD78CP18 78CP14 ONLY 13 1 PROM Programming Operating Modes The PROM programming operating mode is set as shown in table 13 2 Pins not used for programming sho
112. uPD78C14 78C14A 56K uPD78C124 60K uPD78C114A When an external device reference instruction is executed in the 256 byte expansion mode the uPD78C18 78C14 78C14A 78C12A 78C11A masks the high order 8 bits of the 16 bit external reference address and outputs a value from 00H to FFH from pins PD7 to PDO AD7 to ADO as address information 187 CHAPTER 11 EXTERNAL DEVICE ACCESSES AND TIMINGS Similarly in the 4K byte expansion mode the wPD78C18 78C14 78C14A 78C12A 78C11A masks the high order 4 bits of the 16 bit external reference address and outputs a value from 000H to FFFH from pins PF3 to PFO AB11 to AB8 and pins PD7 to PDO as address information Similarly in the 16K byte expansion mode the uPD78C18 78C14 78C14A 78C12A 78C11A masks the high order 2 bits of the 16 bit external reference address and outputs a value from 0000H to 3FFFH from pins PF5 to PFO AB13 to AB8 and pins PD7 to PDO as address information As the high order bits of the 16 bit address are masked in this way in the 256 byte AK byte 16K byte expansion modes the external device can be located in any desired 256 byte AK byte 16K byte area in the external 60K byte area However if in the 16K byte expansion mode external ROM is connected in the expansion area and addresses 1000H to 4FFFH following the on chip ROM are used as the external ROM area it should be noted that there will be the following differences between the program counter PC and the address whic
113. upcounter When TSO is 1 the upcounter is cleared to OOH and the count up is stopped when changed from 1 to 0 the upcounter starts counting up from However if after this bit is set to 0 and the count has begun 0 is written to the bit again the upcounter is not cleared and the count continues 4 CK10 amp CK11 bits 5 amp 6 These bits specify the TIMER input clock 5 TS1 bit 7 TS1 controls the operation of the TIMER1 upcounter and operates in the same way as the TSO bit RESET input sets the timer mode register to clears and stops the upcounter of both TIMERO and resets the timer F F 77 CHAPTER 5 FUNCTIONS Figure 5 2 Timer Mode Register TMM Format 7 6 5 4 3 2 1 0 TMM 751 CK10 TSO TF1 Timer F F input amp operating mode specification TIMERO comparator match signal TIMER1 comparator match signal Internal clock 93 Timer F F reset Internal clock 012 Internal clock 3s4 External pulse TI pin falling edge input Disable Count up Reset 1 input clock specification Internal clock 012 Internal clock 0384 External pulse TI pin falling edge input TIMERO comparator match signal Count up Reset CHAPTER 5 TIMER FUNCTIONS 5 3 Timer Operations Interval timer operation is perform
114. valid and all other functions stop The statuses of the uPD78C18 output pins the software STOP mode are the same for the HALT mode as shown in Table 10 2 Table 10 2 Output Pin Statuses Output Pin Single ChipNete 1 External Expansion PA7 to PAO Data retained Data retained PB7 to PBO Data retained Data retained PC7 to PCO Data retained Data retained PD7 to PDO Data retained High impedance PF7 to PFO Data retained Next address retainedNote 2 Data retainedNote 3 WR RD High level High level ALE High level High level Notes 1 78 18 78 14 78 14 78 12 78 11 78 18 78 14 2 Address output pin 3 Port data output pin Cautions 1 Internal interrupts should be masked before executing the STOP instruction to prevent errors due to an internal interrupt with the oscillation stabilization time upon release of the software STOP mode 2 The TIMER1 coincidence signal is used as the signal to start CPU operation to secure an oscillation stabilization period after the software STOP mode has been released by setting the non maskable interrupt request flag Thus it is necessary to set a count value in timer REG which takes account of the oscillation stabilization time and to set the timer mode register to the timer operating state before executing the STOP instruction 3 Crystal oscillation or ceramic oscillation should be used when using the software STOP mode The software STOP
115. wave can be output from the TO pin The pulse width of the square wave output to the TO pin is determined by the count value set in timer REGO If 0 is set the timer F F contents are inverted and INTTO is generated by the comparator match signal generated every 256 counts The INTTO timer interrupt is disabled by setting MKTO bit 1 of the interrupt mask register MKL 79 MEMO 80 CHAPTER 6 TIMER EVENT COUNTER FUNCTIONS The uPD78C18 is equipped with a multi function 16 bit timer event counter which performs the following operations e Interval timer function see 6 3 1 Interval timer mode e External event counter function see 6 3 2 Event counter mode e Frequency measurement see 6 3 3 Frequency measurement mode Pulse width measurement see 6 3 4 Pulse width measurement mode e Programmable square wave output see 6 3 5 Programmable rectangular wave output mode 6 1 Timer Event Counter Configuration The configuration of the timer event counter is shown in Figure 6 1 Figure 6 1 Timer Event Counter Block Diagram Internal bus gt aes Timer event counter capture REG ECPT 012 OV Timer event counter Clear upcounter control p sca O PC6 COO TO O PC7 CO1 Timer event counter Timer event counter CPO 1 REGO 8
116. write operations but 4 states 12 clock cycles are required for an OP code fetch Wait states TW cannot be inserted 1 2 3 OP code fetch timing see Figure 11 13 This is the timing for fetching the OP operation code of all instructions and consists of 4 states T1 to T4 The two states T1 and T2 are used for the program memory read and and T4 are used for internal processing decoding The upper address signal from the low order 8 bits of the external memory reference address is output to AB15 through AB8 PF7 through PFO from the start of T1 to the end of T4 AD7 to ADO PD7 to PDO function as the multiplexed address data bus The low order 8 bits of the external memory reference address are output during T1 and then AD7 to ADO become high impedance Since the address information on the AD7 to ADO bus is only output temporarily it must be latched by the external device In the 87AD series a special timing signal ALE is provided for latching AD7 to ADO The ALE signal is output in the T1 state of each machine cycle A low level RD signal is output low from midway through the T1 state to the beginning of External device read timing see Figure 11 14 The data read machine cycle when an external device reference instruction is executed consists of T1 to T3 Except for the absence of T4 the timing for AB15 to AB8 PFO AD7 ADO PD7 to PDO and ALE is the same as an OP code fetch A low le
117. 0 2 Number of bytes 3 3 Number of states 20 11 4 Function 22 sr2 lt sr2 byte CY Subtracts the immediate data in the 3rd byte including the CY flag from the contents of the special register sr2 PA PB PC PD PF MKH MKL ANM SMH EOM TMM specified by 53525150 0 to 3 5 to 9 B D and stores the result in the specified special register 5 Flags affected Z SK 0 L1 0 LO lt 0 274 CHAPTER 14 INSTRUCTION SET SUINB A byte Subtract Immediate from A Skip if No Borrow 1 Operation code 10 0 1 1 0 1 1 0 2 Number of bytes 2 3 Number of states 7 7 4 Function lt A byte Skip if no borrow Subtracts the immediate data in the 2nd byte from the contents of the accumulator and stores the result in the accumulator Skips if no borrow is generated as a result of the subtraction 5 Flags affected Z SK HC L1 lt 0 LO 0 CY SUINB r byte Subtract Immediate from Register Skip if No Borrow 1 Operation code 10 1 1 1 0 1 0 0 0 0 1 1 0 Ri Ro 2 Number of bytes 3 3 Number of states 11 11 4 Function r lt r byte Skip if no borrow Subtracts the immediate data in the 3rd byte from the contents of the register r V A B C D E H L specified by R2R1Ro 0 to 7 and stores the result in the specified register Skips if no borrow is generated as a result of the subtraction 5 Flags affected Z SK HC L1
118. 0 CY 6 Example ADC A E A A E CY 252 CHAPTER 14 INSTRUCTION SET ADC r A Add A to Register with Carry 1 Operation code 10 1 1 0 0 0 0 0 0 1 0 1 0 Ri Ro lt 2 gt Number of bytes 2 lt 3 gt Number of states 8 8 lt 4 gt Function r rt A CY Adds the contents of the accumulator to the contents of the register r V A B C D E H L specified by R2R Ro 0 to 7 including the CY flag and stores the result in the specified register 5 Flags affected Z SK lt 0 L1 0 LO 0 6 Example Add the register pairs HL and DE and store the result in HL MOV AE A amp E ADD LA LeLtA MOV AD ADC lt H A CY ADDNC Add Register to A Skip if No Carry 1 Operation code 10 1 1 0 0 0 0 lt 2 gt Number of bytes 2 3 Number of states 8 8 lt 4 gt Function Skip if no carry Adds the contents of the register r V A B C D E H L specified by R2R1Ro 0 to 7 to the contents of the accumulator and stores the result in the accumulator Skips if no carry is generated as a result of the addition 5 Flags affected Z SK HC L1 lt 0 10 lt 0 CY 6 Example 2 ADDNC A V A A V A skip is performed if no carry is generated as a result of the addition 253 CHAPTER 14 INSTRUCTION SET ADDNC r A Add A to Register Skip if No Carry 1 Operation code 10 1 1 0 0 0 0
119. 0 0 2 Number of bytes 2 3 Number of states 8 8 lt 4 gt Function Ae A Obtains the two s complement of the accumulator contents lt 5 gt Flags affected 5 6 0 1160 106 0 305 CHAPTER 14 INSTRUCTION SET 14 6 11 Rotation shift instructions RLD Rotate Left Digit 1 Operation code 0 1 0 0 1 0 0 0 0 0 0 1 1 1 0 0 2 Number of bytes 2 3 Number of states 17 8 4 Function lt HL 74 HL 7 4 lt HL s 0 HL a o lt y 43 0 7 43 0 A Performs left rotation as 4 bit digit units of the low order 4 bits of the accumulator and the high order 4 bits and low order 4 bits of the memory addressed by the HL register pair Bits 7 to 4 of the accumulator are not affected lt 5 gt Flags affected 5 lt 0 11 lt 0 106 0 lt 6 gt Example 7 4 3 0 7 4 3 0 Before execution 00 ojo o 0 1 4 3 0 7 4 3 0 After execution 306 CHAPTER 14 INSTRUCTION SET RRD Rotate Right Digit 1 Operation code 10 1 0 0 1 0 0 0 2 Number of bytes 2 lt 3 gt Number of states 17 8 lt 4 gt Function lt Aa lt HL 7 4 lt 7 4 3 0 7 43 0 une _____ A Performs right rotation as 4 bit digit units of the low order 4 bits of the accumulator and the high order 4 bits and low order 4 bits of the memory addressed by the HL register pair Bits 7 to 4 of th
120. 0 0 52 Si So 2 Number of bytes 3 3 Number of states 14 11 4 Function 5 2 lt byte Transfers the immediate data in the 3rd byte to the special register sr2 PA PB PC PD PF MKH MKL ANM SMH EOM TMM specified by 53525150 0 to 3 5 to 9 D 5 Flags affected SK 0 L1 0 10 0 236 CHAPTER 14 INSTRUCTION SET MVIW wa byte Move Immediate to Working Register 1 Operation code 10 1 1 1 0 0 0 1 2 Number of bytes 3 3 Number of states 13 10 4 Function V wa byte Transfers the immediate data Data in the 3rd byte to the working register addressed by the V register specifying the high order 8 bits of the memory address and the 2nd byte specifying the low order 8 bits lt 5 gt Flags affected SK 0 L1 0 10 0 lt 6 gt Example MVIV OOH 20H Store 20H in working register in address 4000H MVIX rpa1 byte Move Immediate to Memory addressed by Register Pair 1 Operation code 10 1 0 0 1 0 Ai Ao 2 Number of bytes 2 3 Number of states 10 7 4 Function 1 byte Transfers the immediate data Data in the 2nd byte to the memory addressed by the register pair 1 BC DE HL specified by 1 1 to 3 5 Flags affected SK 0 L1 0 L0 0 6 Example MVIX B 00H Store 0 in memory addressed by the BC register pair 237 CHAPTER 14 INSTRUCTION SET STAW wa Store A to
121. 0 1 0 0 2 Number of bytes 2 3 Number of states 11 8 4 Function EA lt EA rp3 Adds the contents of the register pair BC DE HL specified by 1 to 3 to the contents of the extended accumulator and stores the result in the extended accumulator 5 Flags affected Z SK lt 0 L1 lt 0 LO lt 0 CY DADC EA rp3 Add Register Pair to EA with Carry 1 Operation code O 1 1 1 0 1 0 2 Number of bytes 2 3 Number of states 11 8 4 Function i EA lt EA rp3 CY Adds the contents of the register pair BC DE HL specified by 1 to 3 to the contents of the extended accumulator including the CY flag and stores the result in the extended accumulator 5 Flags affected Z SK lt 0 L1 0 LO lt 0 CY 294 CHAPTER 14 INSTRUCTION SET DADDNC EA rp3 Add Register Pair to EA Skip if no Carry 1 Operation code 10 1 1 1 0 1 0 0 120 1070271 Po 2 Number of bytes 2 11 8 lt 4 gt Function EA lt EA rp3 Skip if no carry Adds the contents of the register pair rp3 BC DE HL specified by 1 to 3 to the contents of the extended accumulator and stores the result in the extended accumulator Skips if no carry is generated lt 3 gt Number of states as a result of the addition lt 5 gt Flags affected ESUB EA r2 Subtract Register from EA lt 1 gt Operation code lt 2 gt
122. 0 1 1 1 0 1 0 0 1 0 1 1 0 1 Pi lt 2 gt Number of bytes 2 lt 3 gt Number of states 11 8 lt 4 gt Function EA lt EA rp3 Skip if no borrow Subtracts the contents of the register pair rp3 BC DE HL specified by P Po 1 to 3 from the contents of the extended accumulator and stores the result in the extended accumulator Skips if no borrow is generated as a result of the subtraction 5 Flags affected Z SK HC L1 lt 0 10 lt 0 CY DAN EA rp3 And Register Pair with EA 1 Operation code 10 1 1 1 0 1 0 0 1 00 0 1 1 Pi Po 2 Number of bytes 2 3 Number of states 11 8 4 Function EA lt EA rp3 Obtains the logical product of the contents of the extended accumulator and the contents of the register pair rp3 BC DE HL specified by P1Po 1 to 3 and stores the result in the extended accumulator 5 Flags affected ZSK 0 L1 0 L0 0 296 CHAPTER 14 INSTRUCTION SET DOR EA rp3 Or Register Pair with EA 1 Operation code 10 1 1 1 0 1 0 0 2 Number of bytes 2 lt 3 gt Number of states 11 8 lt 4 gt Function lt v rp3 Obtains the logical sum of the contents of the extended accumulator and the contents of the register pair rp3 DE HL specified by P1Po 1 to 3 and stores the result in the extended accumulator lt 5 gt Flags affected ZSK 0 L1 0 L0 0 DXR EA rp3 Exclusive Or Register Pair with EA
123. 0 AN O 5 OPA4 O 64 63 62 61 20 21 22 23 24 25 26 27 5 MODEOO 60 59 X20 X10 Vss AVss OSTOP OPD7 OPD6 OPD5 OPD4 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 28 29 30 31 32 20 AN40 PD2 O PD1 o PDO O PF7 OA 14 o PF5 O PF4 O PF3 o PF2 O PF1 o PFO o WR o RD O O VAREF OA OA OA N7 N5 13 CHAPTER 1 GENERAL DESCRIPTION 14 2 EPROM mode uPD78CP18 78CP14 only OA5 OA4 OA2 1 007 006 005 004 o O3 64 63 62 61 60 59 58 57 56 55 54 53 52 A6 1 51 o 02 A70 2 50 001 3 49 o 00 4 48 lt 2 gt 5 47 A14 3 5271 6 46 13 7 45 O A12 8 44 11 9 43 O A10 OEO 0 42 lt 2 gt 1 41 O A8 2 40 3 39 4 38 2 5 37 O 6 36 O 7 35 lt 1 gt LO 8 34 O A90 9 33 20 21 22 23 24 25 26 27 28 29 30 31 32 7 150 MODE1 lt 2 gt 0 RESET O MODEOO Cautions 1 Connect directly to Vss 2 Pull down individually to Vss potential via a resistor 3 uPD78CP18 only In the case of 78 14 pull down to Vss potential via a resistor CH
124. 004H to 4007H 400 to 400FH 4014H to 4017H and 401CH to 401 the program jumps to lt e gt The D register is the counter used to check whether or not A D conversion values have been stored in the memory blocks starting at 4004H As the A D conversion values are stored in memory blocks starting at address 4004H the start address 4024H of the next block is stored in the HL register pair in the B register and OOH in the C register and D register The ANI2 bit of the A D channel mode register is inverted to change the input pin on which A D conversion is to be performed and a return is made from the routine When A D conversion values are stored in the memory blocks starting at 4024H 4024H to 4027H 402CH to 402FH 4034H to 4037H and 403CH to 403FH the program jumps to f The E register is the counter used to check whether or not A D conversion values have been stored in the memory blocks starting at 4024H The A D conversion values are stored in memory blocks starting at address 4024H and A D conversion values are stored in the entire area from 4000H to 403FH Therefore initialization is performed in order to store A D conversion values in the memory blocks starting at address 4000H once again The interrupt service routine is shown below A JMP ADSE instruction must be stored in the INTAD interrupt address 0020H 150 CHAPTER 8 ANALOG DIGITAL CONVERTER FUNCTIONS SF A D CONVERTER SERVICE ADSE
125. 09 7 2 1 Serial mode high register SMB eot re ve 109 4212 5 low register SMU low A ERR otv aa RR Td 112 7 2 3 Serial mode register 114 7 3 Serial Interface 114 7 3 1 ASynchirongus Tode con cu need feum ended 114 7452 Synichronous iode mi ter ned a E e vus Rede ecd deut ae be a eed 121 7 3 3 VO interface ModE 123 7 3 4 Example of serial interface program 22 2 22 29 99 9 127 CHAPTER 8 ANALOG DIGITAL CONVERTER FUNCTIONS 44422224441 137 8 1 Analog Digital Converter Configuration eese enne 137 8 2 A D Channel Mode Register 414 400022 140 8 3 Analog Digital Converter Operation 142 8 3 1 Scan MIA OC Scat Cr 142 8 92 JSelecEmode 143 8 3 3 A Dconverter operatiori control i a mrt tare tao ecce 144 8 3 4 Input voltage and conversion results 2 2 222 2 145 8 3 5 Example of analog digital converter program 222222 2 2 21 98 146 CHAPTER 9 INTERRUPT CONTROL FUNCTIONS 153 9 1 Interrupt Control Circuit Configuration
126. 1 Operation code O 1 0 1 0 0 0 lt 2 gt Number of bytes 2 3 Number of states 8 8 4 Function EAn 1 amp EAn 15 lt 0 CY lt EAo 15 0 Performs a 1 bit right shift of the contents of the extended accumulator EAo is shifted into the CY flag and 0 is loaded into EAis lt 5 gt Flags affected SKe 0 L1 lt 0 LO lt 0 CY 312 CHAPTER 14 INSTRUCTION SET 14 6 12 Jump instructions JMP word Jump direct 1 Operation code O 1 0 1 0 1 0 0 High address lt 2 gt Number of bytes 3 lt 3 gt Number of states 10 10 lt 4 gt Function word Loads the immediate data in the 2nd byte into the low order 8 bits PC7 0 of the program counter loads the immediate data in the 3rd byte into the high order 8 bits PCi5 8 and jumps to the address indicated by the immediate data lt 5 gt Flags affected 5 lt 0 11 lt 0 106 0 lt 6 gt Example MVI C 7FH 127 LXI H 4000H HL 4000H LXI D 5000H DE 5000H BLOCK DE lt HL C 1 JMP OWARI PC lt OWARI JUMP TO OWARI When the 128 byte block transfer is completed the program jumps to the address indicated by the label OWARI JB Jump BC indirect 1 Operation code 10 0 1 1 2 Number of bytes 1 3 Number of states 4 4 4 Function PCzo lt C Loads the contents of the B register into the high order 8 bits PC1ss
127. 1 EXTERNAL DEVICE ACCESSES AND TIMINGS Figure 11 12 wPD78C10A Address Space 4 access 16K byte access 64 access 0000H 22 External device External device External device On chip RAM On chip RAM On chip RAM FFFFH N 0 1 MODEO 1 1 0 MODE1 20 MODE1 1 Cautions 1 Instructions on port D or port F must not be executed in the 64K byte access mode as this 200 will result in an unpredictable operation A program which dynamically changes the port F input output mode cannot be emulated an emulator and therefore should not be used AWR pulse is output if an output instruction is executed on port D or port F in the 64K byte mode and this must therefore on no account be performed With an emulator the device may operate normally even if the RAE bit is not initialized by an instruction Overwriting the RAE bit during program execution allows an apparent increase of 256 bytes inthe memory space However this operation cannot be emulated by an emulator and should therefore not be performed CHAPTER 11 EXTERNAL DEVICE ACCESSES AND TIMINGS 11 3 Timings uUPD78C18 operation timings are shown in Figures 11 13 to 11 15 Three oscillator frequency cycles from rise to fall are defined as one state represented by Tn One machine cycle is completed in 3 states 9 clock cycles for all normal read and
128. 101000 A8H v 10101000 A8H 4000H A8H 00000000 00H In this example since the contents of A and the contents of address 4000H are the same the exclusive logical sum is 0 and the Z flag is set Thus the STAX instruction is skipped by the following SK Z instruction and the JMP instruction is executed GTAX rpa Greater Than Memory addressed by Register Pair 1 Operation code 10 1 1 1 0 0 O 0 2 Number of bytes 2 3 Number of states 11 8 4 Function A rpa 1 Skip if no borrow Subtracts the contents of the memory addressed by the register pair BC DE HL DE HL DE HL specified by A2A1Ao 1 to 7 and 1 from the contents of the accumulator Skips if no borrow is generated as a result of the subtraction A gt rpa 5 Flags affected Z SK L1 lt 0 LO lt 0 CY 6 Example GTAX D A DE 1 A skip is performed if A is greater than the contents of the memory addressed by the DE register pair 267 CHAPTER 14 INSTRUCTION SET LTAX rpa Less Than Memory addressed by Register Pair 1 Operation code 10 1 1 1 0 0 0 0 2 Number of bytes 2 lt 3 gt Number of states 11 8 lt 4 gt Function A rpa Skip if borrow Subtracts the contents of the memory addressed by the register pair BC DE DE HL DE HL specified by 2 1 1 to 7 from the contents of the accumulator Skips if a borrow is generated as a result of the subtracti
129. 116 0 1060 269 CHAPTER 14 INSTRUCTION SET 14 6 5 Immediate data operation instructions ADI A byte Add Immediate to A 1 Operation code 0 1 0 0 0 1 1 0 2 Number of bytes 2 3 Number of states 7 7 4 Function A byte Adds the immediate data in the 2nd byte to the contents of the accumulator and stores the result in the accumulator lt 5 gt Flags affected Z SK lt 0 L1 lt 0 LO lt 0 CY ADI byte Add Immediate to Register 1 Operation code 10 1 1 1 0 1 0 0 1 0 0 0 Ri Ro lt 2 gt Number of bytes 3 lt 3 gt Number of states 11 11 lt 4 gt Function r byte Adds the immediate data in the 3rd byte to the contents of the register r V A B C D E H L specified by R2R1Ro 0 to 7 and stores the result in the specified register 5 Flags affected Z SK lt 0 L1 lt 0 LO lt 0 ADI sr2 byte Add Immediate to Special Register 1 Operation code O 1 1 0 0 1 0 0 Ss 1 0 0 0 52 Si So 2 Number of bytes 3 3 Number of states 20 11 4 Function sr2 lt sr2 byte Adds the immediate data in the 3rd byte to the contents of the special register sr2 PA PB PC PD PF MKH MKL ANM SMH EOM TMM specified by 53525150 0 to 3 5 to 9 B D and stores the result in the specified special register 5 Flags affected Z SK lt 0 L1 lt 0 LO lt 0 270 CHAPTER 14
130. 31 CHAPTER 15 OPERATING PRECAUTIONS 15 8 Limitations on Hardware STOP Mode Target products uPD78C10 78C11 78C10A Standards 78C11A Standards 78C12A Standards 78C14 Standards K and E 78C14A 78CG14 Details Ifthe hardware STOP mode is executed not in synchronization with the CPU operation power supply current consumption may become approximately 20 mA even after entering the hardware STOP mode e Remedy Use any of the following signals in combination with the STOP input then use the JR instruction to synchronize the hardware STOP mode with the CPU operation NMI 1 When both NMI and STOP are used As shown in Figure 15 2 input the power off detect signal to the NMI pin as an non maskable interrupt request then input the delayed signal thus obtained to the STOP pin as the hardware STOP mode setting signal Figure 15 2 When Both NMI and STOP Are Used 87AD Series Power off detecting NMI signal R STOP C 332 CHAPTER 15 OPERATING PRECAUTIONS The operation sequence is as follows When the power off detect signal is input the NMI routine starts b Then JR instruction is executed as the start of NMI routine the program is looped to wait STOP Determine values of R and C so that the delay of STOP behind NMI is longer than the longest interrupt wait period 75 states 10 us 28 75 us at 12 MHz operation Figure 15 3 Control Timing of NMI and STOP pe NMI
131. 348 APPENDIX B DEVELOPMENT TOOLS The following development tools are available for system development using 87AD series products Language Processor 87AD series This program converts a program written in mnemonics into object code which can be relocatable assembler executed by a microcontroller RA87 In addition functions are provided for automatic symbol table generation branch instruction optimization processing etc Host Ordering code machine OS Supply medium Product name MS DOS M 3 5 inch 2HD Ver 2 11 1 Ver 5 00ANote DOSIM 3 5 inch 2 uS7B13RA87 Ver 3 1 5 inch 2HC US7B10RA87 US5A13RA87 PC 9800 series 5 inch 2HD 55 10 87 Note Ver 5 00 5 00A are provided with a task swapping function but this software cannot use the function Remark Operation of the assembler is guaranteed only on the host machines and operating systems quoted above 349 APPENDIX B DEVELOPMENT TOOLS PROM Writing Tools Hardware PG 1500 This PROM programmer allows programming in standalone mode or via operation from a host machine of a single chip microcontroller with on chip PROM by connection of the board provided and a separately available programmer adapter It also permits programming of typical PROMs from 256K bits to 1M bits PA 78CP14CW PROM programmer adapter for uPD78CP14 78CP18 used connected to the PG 1500 GF GQ KB L PA 78CP14CW Fo
132. 4 INSTRUCTION SET 14 4 4 Auto decrement addressing This is a special mode of register indirect addressing using the HL and DE register pairs in which after the memory to be manipulated is addressed using the contents of the register pair specified by the addressing specification code in the instruction as the operand address the contents of that register pair are automatically decremented by 1 thus preparing for the next addressing operation Auto decrement addressing is used when an instruction with the following operand formats is executed Notation rpa rpa2 Examples 1 224 Description Method D D ADDX rpa Operation code 0 1 1 1 0 0 0 0 1 1 0 0 0 Az Ai Ao If the auto decrement mode is selected for the HL register pair used as the instruction is written as shown below ADDX H A HL HL e HL 1 The corresponding operation code is shown below Operation code 0 1 1 1 0 0 Interrupt generation or execution of a CALL instruction or PUSH instruction Although not specified by an operand when an interrupt is generated or a CALL instruction or PUSH instruction is executed in all of which cases register contents are stored in the stack auto decrementing of the stack pointer SP is performed SOFTI SP 1 PSW SP 2 PC 1H SP 3 1 PC lt 0060H CHAPTER 14 INSTRUCTION SET 14 4 5 Double auto increment addressing This is a spe
133. 44 78C124 78C114 pull up resistors can be incorporated bit wise Figure 4 5 Mode B Register Format MB 7 6 5 4 3 2 1 0 uer es ws wes ez ues eo PBn Output port PBn Input port n 0 7 yi 6 5 4 3 2 1 0 rer Treo es vos rez As with port A direct bit setting resetting of port B output latch contents is possible by an arithmetic or logical operation instruction without the use of an accumulator Data transfer to from an accumulator is also possible 65 CHAPTER 4 PORT FUNCTIONS 4 3 Port PC7 to PCO Port C PC7 to PCO is an 8 bit special input output port which functions in either port mode or control signal input output mode according to the setting of the mode control C MCC register When the corresponding bit of mode control C register is set 1 the port C is set to control mode and if reset 0 set to port mode see Figure 4 6 When RESET is input or the hardware STOP mode is set all bits of the mode control C register are reset and all bits of port C are set to port mode In the uPD78C18 78C14A 78C12A 78C11A pull up resistors can be incorporated bit wise Figure 4 6 Mode Control C Register Format 0 7 6 5 4 3 2 MCC PCO Port mode PCO TxD output PC1 Port mode PC1 RxD input PC2 Port mode PC2 SCK input output PC3 Port mode INT2 TI input PC4 Port mode PC4 TO output PC5
134. 4Qd 1deox3 71 8930 40 onsejd u 440 21580 u 1 1 6 15 dIND onsejd u onsejd 54448 onsejd 12 89 Id p9 e Id p9 e Id p9 e Id p9 e XV vrl Lx ONV 01 ZNV jueuno yee 1ndu XVI OLX ONY O1 ZNV suonedijioeds 21 2 781498 81082 9 128 jeioeds LdO084 Qd 71082 adr 9 72128 047 08241 08 8108 1 1198 2198 vldOo8Ladr 1198 198 20198 opeJ6 Ajeno 19npoJd 22 CHAPTER 2 PIN FUNCTIONS uPD78C18 78C17 78C14 78C144 78C12A 78C1 1A 78C10A operate with normal operation mode pin functions uUPD78CP18 78CP14 pin functions are of two kinds Normal operation mode and EPROM mode EPROM mode is entered by driving the MODE pin low and the MODEO pin high 2 1 Normal Operation Mode 2 1 1 PA7 to PAO Port A 3 state input output These are the 8 bit input output pins of port A 8 bit input output port with output latch and can be specified bit wise as input output by means of the Mode A register MA Upon RESET input PA7 to PAO are set as input port high impedance PA7 to PAO also become high impedance in the hardware STOP mode In the uPD78C18 78C144 78C124 78C114 pull up resistors be incorporated bit wise 2 1 2 PB7 to PBO Port B
135. 8 bit input output port which has input output buffer and output latch functions in the same way as port A except that input or output port setting is performed as a byte 8 bit unit Port D can be set as input or output as a byte unit by the MMO bit of the memory mapping register It functions as an input port when the bit is reset 0 and as an output port when the bit is set 1 Except for having input output specified as a byte unit port D operation is the same as for port A Direct bit setting resetting of output latch contents is possible by an arithmetic or logical operation instruction without the use of an accumulator and data transfer to from an accumulator is also possible Expansion mode External memory expansion up to 256 bytes is possible using the port D input output pins PD7 to PDO as amultiplexed address data bus Also when a large external memory expansion is made this is done by using PF7 to PFO as the address bus see CHAPTER 11 EXTERNAL DEVICE ACCESSES AND TIMINGS for details uPD78C17 78C10A The port operates only as a multiplexed address data bus AD7 to ADO and has no port function Cautions 1 When the port D input output pins PD7 to PDO are functioning as an address data bus AD7 to ADO the internal address bus status is output in synchronization with ALE in all machine cycles 2 Emulation cannot be performed by an emulator for a program which varies the port D operating mode dynamically
136. ALE AB15 8 PF7 0 Address upper AD7 0 POUR Address X WR N 202 CHAPTER 12 PROM ACCESSES uPD78CP18 78CP14 ONLY The uPD78CP18 uPD78CP14 incorporate 32K byte and 16K byte EPROM respectively Four modes can be selected for the on chip EPROM access range by means of bits MM5 to MM7 of the memory mapping register 4K byte mode Access to addresses 0000H to OFFFH uPD78C11A mode e 8K byte mode Access to addresses 0000H to 1FFFH uPD78C12A mode 16K byte mode Access to addresses 0000H to 3FFFH uPD78C14 mode 32K byte modeNete Access to addresses 0000H to 7FFFH uPD78C18 mode Note The 32K byte mode applies to the uPD78CP18 only The configuration of the uPD78CP18 78C14 memory mapping registers is shown in Figures 12 1 and 12 2 1 2 3 Bits to MM2 These bits control the PD7 to PDO port expansion mode and input output specification and the PF7 to PFO address output specification See 11 1 1 Memory mapping register MM for details bit RAE This bit controls enabling RAE 1 and disabling RAE 0 of on chip RAM accesses See 11 1 1 Memory mapping register MM for details Bits MM5 to MM7 These bits used to specify the on chip EPROM access range When STOP or RESET is input these bits are reset The uPD78CP18 is set to the 32K byte mode and the uPD78CP14 to the 16K byte mode These bits are valid only in the uPD78CP18 78CP14
137. APTER 1 GENERAL DESCRIPTION 1 3 3 OFP 8 7 NMIO INT1O MODE1 RESET MODEOO X20 X10 Vss O AVss O ANO AN1 0 AN2 0 AN3 AN40 AN5 1 2 3 4 5 6 7 8 PC6 COO o PCA TO 6 PC3 INT2 PC2 SCK PC1 RxD O PCO TxD 7 6 O PB5 4 PB3 2 O PB1 19 20 21 22 RDO WRO 23 24 25 26 27 ALEO FOO 55 54 53 52 20 40 FEO PF10 28 29 30 31 7 7 PDO O PA6 O PAS O PA4 O PA3 O PA2 O PAO STOP O PD7 O PD6 PD5 PDA O PD2 OPD1 15 CHAPTER 1 GENERAL DESCRIPTION 1 3 4 16 1 Normal operation mode O 20 PB3 PB40 PB6 O PB7 0 PCO TxD PC1 RxD 2 5 PC3 INT2 PC4 TO PC5 IC 0 1 12 3 14 15 6 17 18 9 OIC O PA6 5 O PA4 O PA2 1 O PAO 27 28 29 30 31 PC7 CO1 NMI O INT1 1 O STOP PD7 O PD6 PD5 O 2 OIC 3 2 1 68 67 6665 64 63 62 61 X20 X10 Vss AVss ANO AN10O AN2 0 AN3 AN4 0 AN5 RESET MODEO Remark Internally connected 60 59 58 57 56 55 54
138. ARIN ARSTO ARST1 ARST2 RETO RET1 RET2 EXA EXX MOV DCR JR MOV DCR JR LXI LXI MVI JR INX JR LXI JR LXI MOV JR LXI MOV MVI MVI MVI XRI EXA EXX CRO 1 H 8H A CR2 H 10 H 18 ARIN ARSTO A D A ARST1 ARST2 H 4000 D 0101 C 01H RET1 ET2 4020 ET1 H 4004 D A RETO H 4024H E A D 00H C 00 B 03 ANM 08H H R H R Save accumulator Save register Store A D conversion data to memory Store A D conversion data to memory Store A D conversion data to memory Store A D conversion data to memory Decrement counter skip if borrow Set data pointer Set counter Set counter Increment HL Set data pointer Set data pointer Set data pointer Invert ANI2 bit Recover accumulator Recover register Enable interrupt Return a PI a Xi V a b lt C gt lt d gt lt gt lt f gt lt b gt lt C gt lt d gt lt gt 151 MEMO 152 CHAPTER 9 INTERRUPT CONTROL FUNCTIONS There are 3 kinds of external interrupt request NMI INT1 INT2 and 8 kinds of internal interrupt requests INTTO INTT1 INTEO INTE1 INTEIN INTAD INTSR INTST plus a software interrupt instruction SOFTI The 11 kinds of interrupt requests excl
139. An internal clock 012 as the ECNT input clock a match between ECNT and ETM1 as the ECNT clear mode and a match between ECNT and ETMO or between ECNT and ETM1 as the COO output timing Timer event counter operation is started by setting the timer event counter mode register 98 CHAPTER 6 TIMER EVENT COUNTER FUNCTIONS Figure 6 19 Timer Event Counter Mode Register Setting Programmable Rectangular Wave Output ECNT Operation Setting 5 4 1 7 6 mw TT ls 2 1 0 ECNT input clock ECNT clear mode Internal clock 012 Match between ECN COO output timing Matc ECN matc ECN and E M1 h between and E MO or h between and E M1 e LVOis set so that a high level signal will be output to the COO pin by the first comparator match signal F TIMER EVENT COUNTER INITIALIZATION INIT MVI A 00H MOV MVI EOM 07H MVI A 40H MOV MCC A LXI EA 00C8H DMOV ETMO EA LXI EA 01F4H DMOV ETM1 EA START MVI A 3CH MOV ETMM A ORI EOM 08H Clear timer event counter Initialize counter output 0 PC6 COO Set Port C mode control Low level 200 us at 12 MHz Set count value High level 300 us at 12 MHz Set count value Set timer event counter mode amp start Set LVO Aa Cc d e 99 CHAPTER 6 TIMER EVENT COUNTER FUNCTIO
140. Asynchronous Mode 2 2 0 7 6 5 4 3 2 1 To Te T T Te De T e SCK selection Internal clock TO output Internal clock 384 Internal clock 024 External clock Disable Enable Reception enable Disable Enable 116 CHAPTER 7 SERIAL INTERFACE FUNCTIONS For internal clock 024 B bx _ 24 For internal clock 384 384 For TO output used as internal clock When the timer input clock is 012 fxx Be 24xNxC When the timer input clock is 384 CE 768xNxC When the timer F F input is 2o 5 6xN TMM xxx00000B SML 108 5 0000xx00B Set by user When an internal clock is specified as the serial clock SCK the data transfer rate is determined from the oscillator frequency and the clock rate by the following expressions where fxx is the oscillator frequency N is the clock rate 1 16 64 C is the timer count value and B is the data transfer rate When the timer F F input is s when the TO output is used as the internal clock the clock can only be used when the clock rate is 16 or 64 When TIMERO is used and the clock rate is 16 the set values of the timer mode register TMM and the serial mode registers SML SMH are as follows When the TO output is specified as the internal clock and the input clock to the timer is used as the internal clock 012 the timer count values shown in Table
141. CTIONS for details 3 9 Analog Digital Converter This consists of an 8 bit A D converter with 8 analog inputs which uses the high precision successive approximation method and 4 conversion result registers CRO to CR3 which hold the conversion results With two analog input selection methods scan mode and select mode and 4 registers CRO to CR3 to hold the conversion results software overheadis minimized see CHAPTER8 ANALOG DIGITAL CONVERTER FUNCTIONS for details 3 10 Interrupt Control There are 3 kinds of external interrupt request and 8 kinds of internal interrupt request controlled according to the status and priority of the interrupt mask register The 11 kinds of interrupt requests are divided into 6 groups with 6 different priorities and 6 different interrupt addresses see CHAPTER 9 INTERRUPT CONTROL FUNCTIONS for details 57 CHAPTER 3 INTERNAL BLOCK FUNCTIOS 3 11 Zero Cross Detector he INT1 pin and INT2 TI dual function can be made to execute zero cross detection operations by setting the zero cross mode register he zero cross detector has a self bias type high gain amplifier It biases the input to the switching point and generates digital displacement in response to a small input displacement Figure 3 13 Zero Cross Detector 78 18 External capacitor INTI AC input signal gt To internal circuitry 1 to 1 8 Ver Self bias
142. CY 6 Example DLT EA EA BC A skip is performed if BC is greater than EA DNE EA rp3 Not Equal Register Pair with EA 1 Operation code 10 1 1 1 0 1 0 2 Number of bytes 2 lt 3 gt Number of states 11 8 lt 4 gt Function EA rp3 Skip if no zero Subtracts the contents of the register pair rp3 DE HL specified by 1 to 3 from the contents of the extended accumulator and skips if the result of the subtraction is not zero EAzrp3 lt 5 gt Flags affected Z SK HC L1 lt 0 LO 0 CY 6 Example DNE EA EA BC A skip is performed if EA and BC are not equal DEO EA rp3 Equal Register Pair with EA 1 Operation code O 1 1 1 0 1 0 0 2 Number of bytes 2 3 Number of states 11 8 4 Function EA rp3 Skip if zero Subtracts the contents of the register pair rp3 BC DE HL specified by 1 to 3 from the contents of the extended accumulator and skips if the result of the subtraction is zero EA rp3 lt 5 gt Flags affected Z SK HC L1 lt 0 LO 0 CY 6 Example DEO EA EA BC A skip is performed if EA and BC are equal 298 CHAPTER 14 INSTRUCTION SET DON EA rp3 On Test Register Pair with EA 1 Operation code 10 1 1 1 0 1 0 0 2 Number of bytes 2 lt 3 gt Number of states 11 8 lt 4 gt Function EA A rp3 Skip if no zero Obtains the product of the contents of the extended
143. DE lt DE 1 STAX H HL A JMP MOTOE This example adds together the contents of address 4100H and address 4000H and stores the result in address 4200H if no carry is generated If a carry is generated the STAX instruction is skipped and the JMP instruction is executed to jump to MOTOE SUBX rpa Subtract Memory addressed by Register Pair from A 1 Operation code 10 1 1 1 0 0 0 0 1 1 1 0 0 Ai Ao 2 Number of bytes 2 3 Number of states 11 8 4 Function lt Subtracts the contents of the memory addressed by the register pair BC DE HL DE DE HL specified by A2A Ao 1 to 7 from the contents of the accumulator and stores the result in the accumulator 5 Flags affected Z SK e0 L1 0 LO 0 6 Example SUBX D A A DE 264 CHAPTER 14 INSTRUCTION SET SBBX rpa Subtract Memory addressed by Register Pair from A 1 Operation code 0 1 1 1 0 0 0 0 1 1 1 1 0 Ai Ao 2 Number of bytes 2 3 Number of states 11 8 4 Function Subtracts the contents of the memory addressed by the register pair DE DE HL DE HL specified by A2A1Ao 1 to 7 including the CY flag from the contents of the accumulator and stores the result in the accumulator lt 5 gt Flags affected Z SK lt 0 HC L1 lt 0 LO lt 0 CY 6 Example SBBX D A lt A DE CY DE
144. ECNT and ETM1 contents In the same way as in the interval timer mode ECNT counts up every 12 and the respective comparator compares the ECNT count with the ETMO ETM 1 contents and if a match is detected generates a match signal CPO CP1 and an interrupt INTEO INTE1 In response to the match signal the output control circuit outputs the contents of the level F F LVO to the COO pin and inverts the LVO contents Only in the event of a match between ECNT and the ECNT contents are cleared and the count starts again from 0000H Thus a rectangular wave output is obtained from COO with a pulse width equal to the count time determined by the count value set in ETMO and see Figure 6 16 Internal interrupts can be disabled by setting 1 the MKEO MKE1 bits of the interrupt mask register MKL Rectangular wave output from the CO1 pin is implemented in the same way as square wave output from the COO pin by changing the mode register setting Figure 6 16 Programmable Rectangular Wave Output Mode Operation Internal clock 012 Start ECNT clearance ECNT clearance Remark ETMO2m lt m n count value ETM1 n 96 CHAPTER 6 TIMER EVENT COUNTER FUNCTIONS 6 3 6 Timer event counter program examples Two examples of timer event counter programs are given here for programmable rectangular wave output and single pulse output synchronized with the fall of the Cl input 1 Programmable rectangular wave
145. EMORY MAPPING TIMER REGO MER REG1 MER MODE TIMER EVENT OUNTER REGO MER EVENT OUNTER REG1 MER EVENT OUNTER UPCOUNTER TIMER EVENT COUNTER CAPTURE 214 CHANNEL A D RESULTO 3 Tx BUFFER Rx BUFFER SERIAL MODE SERIAL MODE MASK High MASK Low ZERO CROSS MODE CONVERSION High Low MODE EXTENDED ACCUMULATOR E L E byte L A L B L EA L byte OVERFLOW ANALOG INPUT 4 7 STANDBY INSTRUCTION SET CHAPTER 14 14 2 Explanation of Operation Code Symbols rpa Fa o gt 2 2 0 0 D LL o n g 8 Lr lt gt gt lt mui 9 o 2 med vno de sae Se se 2 2 4 gt 2 22 25 o OW ou Z LL LL LL LL LL LL LL iL uj O o eo 2 oo o o 4o o lo o o oc Glo o o oc 2 49 OO e OC e HK OO O e e 4Iloo ioo oosc Or
146. FAD flag setting 8 3 2 Select mode In the select mode as shown in Figure 8 5 the A D channel mode register ANM specifies one of the analog inputs ANO to AN7 Figure 8 5 A D Channel Mode Register in Select Mode 7 6 5 4 3 2 1 0 1 Select mode Analog input specification gt gt gt gt gt gt gt gt 192 states 144 states 143 CHAPTER 8 ANALOG DIGITAL CONVERTER FUNCTIONS A D conversion is performed on the single analog input specified by the A D channel mode register and the A D conversion result is stored in the order CRO gt CR1 CR2 CR3 When the conversion values have been stored in all four CR registers CRO to an INTAD internal interrupt is generated The A D converter continues A D conversion again irrespective of whether or not an interrupt request has been acknowledged and stores the A D conversion results in order starting with CRO Thus the most recent conversion values are always stored in the CR registers The A D converter repeats the above operation until the contents of the A D channel mode register are changed This mode holds the most recent conversion values for the selected analog inputs and is useful for averaging conversion values or preventing noise input etc Internal interrupts are disabled by setting 1 the MKAD bit of the interrupt mask register MKH Figure 8 6 Outline of A D Converter Oper
147. FFFH 1000H 0010H INT1 INT2 External memory 61184 x 8 bit 0018H INTEO INTE1 0020H INTEIN INTAD FEFFH FFOOH nenie RAM ES 0028H INTSR INTST E FFFFH 0060H SOFT 0080H LOW ADRS 0081 HIGH ADRS B 0082H LOW ADRS t 1 0083H HIGH ADRS O 00 LOW ADRS HIGH ADRS EM User s area OFFFH Note Can only be used when the RAE bit of the MM register is 1 CHAPTER 3 INTERNAL BLOCK FUNCTIONS 3 6 Timers The timer system comprises two 8 bit interval timers The two interval timers can also be cascaded to operate as a 16 bit interval timer The elapse of the interval time can be identified by the generation of a timer interrupt In addition a square wave with the interval time as a half cycle is obtained from the TO pin see CHAPTER 5 TIMER FUNCTIONS for details 3 7 Timer Event Counter This is a 16 bit timer event counter which performs the following operations according to the operating mode set by the program see CHAPTER 6 TIMER EVENT COUNTER FUNCTIONS for details e Interval timer function e Event counter function e Frequency measurement e Pulse width measurement e Programmable square wave output 3 8 Serial Interface This interface is used to perform serial data transfers in a multi processor configuration or with various terminals and operates in asynchronous mode synchronous mode interface mode see CHAPTER7 SERIAL INTERFACE FUN
148. FUNCTIONS ANn Analog input mi 1000 TIT 78 18 Reference voltage input Q 1 100 1000 pF 1 777 139 CHAPTER 8 ANALOG DIGITAL CONVERTER FUNCTIONS 8 2 A D Channel Mode Register ANM This register controls A D converter operations As shown in Figure 8 2 bit 0 MS of the A D channel mode register controls the operation mode and bits 1 to 3 ANIO to ANI2 select the analog input for A D conversion Bit 4 FR is used to maintain the optimum conversion speed the conversion speed for one operation can be calculated by means of the oscillator frequency and the FR bit using the following expressions and is set as shown in Table 8 1 FR 0 Conversion speed 48 12 fxra us FR 1 Conversion speed 36 x 12 fxtat us fxra Oscillator frequency MHz Table 8 1 Conversion Speed Settings 0 0 0 0 1 1 1 FR bit Conversion speed 38 4 us 48 us 52 4 us 57 6 us 48 us 54 us 61 7us Reading the contents of the A D channel mode register allows the current conversion mode to be ascertained RESET input or hardware STOP mode resets the A D channel mode register to OOH Writing to the ANM register initializes the A D converter stops the A D conversion currently being performed and starts A D conversion from the beginning in accordance with the contents written to ANM Thus if a write is performed on the ANM register after the INTFAD flag has been cleared A D conversion
149. I H word All other instructions 1 Affected set or reset 0 Reset Not affected 43 CHAPTER 3 INTERNAL BLOCK FUNCTIOS 3 5 Memory 3 5 1 uPD78C18 78C17 78C14 78C14A 78C12A 78C11A 78C10A memory configuration The uPD78C18 78C17 78C14 78C144 78C124A 78C114 78C10A can address a maximum of 64K bytes of memory The memory maps are shown in Figures 3 3 to 3 8 The external memory area and the on chip RAM area can be freely used as program memory and data memory Since the access time for on chip memory and external memory are the same processing can be executed at high speeds 44 1 Interrupt start addresses 2 3 The interrupt start addresses are all fixed as follows NMI 0004H INTTO INTT1 0008H INTT INT2 0010H INTEO INTE1 0018H Call address table The call address of a 1 byte call instruction CALT can be stored in the 64 byte area for 32 call addresses from address 0080H to address OOBFH Specific memory area Thereset start address interrupt start addresses and the call table are allocated to addresses 0000H to OOBFH and this area takes account of these in use Addresses 0800H to OFFFH are directly addressable by a 2 byte call instruction CALF On chip mask ROM allocation is shown below uPD78C18 uPD78C17 uPD78C14 78C14A e uPD78C12A uPD78C11A uPD78C10A With the uPD78C17 78C10A a
150. I inputNete Cl input while TO is highNete Note Falling edge input Clear control circuit This circuit clears ECNT as follows according to the specification of the timer event counter mode register ETMM i Remains cleared ii Not cleared iii Match of ECNT ETM1 Cl input falling edge or TO falling edge In case iv the operation is as shown in Table 6 3 according to the ECNT input 83 CHAPTER 6 TIMER EVENT COUNTER FUNCTIONS Table 6 3 ECNT Clearing ECNT Input ECNT Clearing No relation Stop after clearing Free running not cleared Internal clock 12 CI input falling edge 12 while Cl input is high input TO falling edgeNete Cl input while TO is high No relation Match of ECNT ETM1 Note The TO signal cannot be used when timer F F input is used as internal clock see Figure 5 1 Timer Block Diagram When iv is specified in the clear mode the clear operation is performed after the capture operation 7 Interrupt control circuit This circuit controls timer event counter interrupts Interrupt sources are shown below an interrupt request flag is set 1 by each source i ECNT ETMO match signal INTEO ii ECNT ETM1 match signal INTE1 iii Cl input falling edge or TO falling edge INTEIN In case iii the setting is as shown in Table 6 4 according to the ECNT input as in case ii of item 6 Clear
151. INC A byte Add Immediate to A Skip if No Carry 1 Operation code 10 0 1 0 0 1 1 0 2 Number of bytes 2 3 Number of states 7 7 lt 4 gt Function lt Skip if no carry Adds the immediate data in the 2nd byte to the contents of the accumulator and stores the result in the accumulator Skips if no carry is generated as a result of the addition lt 5 gt Flags affected Z SK HC L1 lt 0 LO 0 CY 6 Example ADINC A lt ADINC byte Add Immediate to Register Skip if No Carry 1 Operation code O 1 1 1 0 1 0 0 0 0 1 0 R2 Ri 2 Number of bytes 3 lt 3 gt Number of states 11 11 lt 4 gt Function lt r byte Skip if no carry Adds the immediate data in the 3rd byte to the contents of the register r V A B C D E H L specified by R2R Ro 0 to 7 and stores the result in the specified register Skips if no carry is generated as a result of the addition lt 5 gt Flags affected Z SK HC L1 lt 0 LO lt 0 CY lt 6 gt Example To add immediate data to the HL register pair ADINC L IMM L L IMM SKIP IF NO CARRY ADI H 01H He H 1 ADINC sr2 byte Add Immediate with Special Register Skip if No Carry 1 Operation code 10 1 1 O 0 580 1 0 0 52 51 So 2 Number of bytes 3 3 Number of states 20 11 4 Function sr2 sr2 byte Skip if no carry Adds the immed
152. INSTRUCTION SET ACI A byte Add Immediate to A with Carry 1 Operation code O 1 0 1 0 1 1 0 2 Number of bytes 2 3 Number of states 7 7 4 Function DA Adds the immediate data in the 2nd byte to the contents of the accumulator including the CY flag and stores the result in the accumulator 5 Flags affected Z SK lt 0 L1 0 LO lt 0 CY ACI r byte Add Immediate to Register with Carry 1 Operation code O 1 1 1 0 1 0 0 0 1 0 1 0 Ri Ro 2 Number of bytes 3 3 Number of states 11 11 4 Function r lt r byte CY Adds the immediate data in the 3rd byte to the contents of the register r V A B C D E H L specified by R2RiRo 0 to 7 including the CY flag and stores the result in the specified register 5 Flags affected Z SK 0 HC L1 0 LO 0 ACI sr2 byte Add Immediate to Special Register with Carry 1 Operation code O 1 1 0 0 1 0 0 2 Number of bytes 3 3 Number of states 20 11 4 Function 572 lt sr2 byte CY Adds the immediate data in the 3rd byte to the contents of the special register sr2 PA PB PC PD PF MKH MKL ANM SMH EOM TMM specified by 53525150 0 to 3 5 to 9 B D including the CY flag and stores the result in the specified special register 5 Flags affected Z SK 0 L1 0 LO lt 0 271 CHAPTER 14 INSTRUCTION SET AD
153. IONS 2 Data reception A receive operation in the I O interface mode is enabled by setting 1 the RxE bit of the serial mode high register SMH and receive data RxD is input to the serial register in order from MSB on the rising edge of SCK When the serial register receives 8 bit data the data is transferred from the serial register to the receive buffer register and a serial reception interrupt INTSR is generated When SCK is an external clock the data sent in synchronization with SCK is input to the serial register on the rising edge of SCK When SCK is an internal clock it must be started by setting 1 the TSK bit of the serial mode high register SMH Serial reception interrupts are disabled by setting 1 the MKSR bit of the interrupt mask register MKH The maximum data transfer rate in reception is 625 kbps when an internal clock is used as SCK and 660 kbps when an external clock is used at 15 MHz operation The high level width of the 8th SCK pulse must be at least 6 states Caution 1 When fewer than 8 external clock pulses are input in transmission The correction procedure is shown below for the case where fewer than 8 external clock pulses are input when performing transmission reception in the I O interface mode using external clock input 1 TxE bit reset to 0 Disable transmission 2 Change MC register MC 2 5 set to 1 Set to input port 0 reset to 0
154. In this mode data is transferred received with a fixed character length of 8 bits with no parity bit The serial mode register settings are therefore as shown in Figure 7 8 Figure 7 8 Serial Mode Register Format I O Interface Mode 5 4 3 2 1 0 7 6 dE Synchronous operation Fixed 8 bit character length Parity disable 0 7 6 5 4 3 2 1 re T Tee De Te e SCK selection Internal clock TO output Internal clock Internal clock 024 External clock Disable Enable Reception enable Disable Enable interface mode SCK trigger Disable Enable 123 CHAPTER 7 SERIAL INTERFACE FUNCTIONS In the I O interface mode the transmit data TxD is transferred MSB first on the falling edge of the serial clock SCK Receive data RxD is input on the rising edge of SCK Serial data Figure 7 9 1 0 Interface Mode Timing SCK In this mode character synchronization is implemented using the controlled SCK 8 serial clock pulses An external clock or internal clock can be selected as SCK by means of the serial mode high register When an internal clock is used as SCK the controlled clock 8 pulses per data item is output from the SCK pin When an external clock is used as SCK 8 clock pulses should be accurately supplied to SCK as the single data item transfer 8 bit unit by the control signal
155. L0 0 243 CHAPTER 14 INSTRUCTION SET SHLD word Store H amp L Direct 1 Operation code 10 1 1 1 0 0 0 2 Number of bytes 4 lt 3 gt Number of states 20 14 lt 4 gt Function word word 1 lt H Stores the contents of the L register in the memory addressed by the 3rd byte lower address and 4th byte upper address and stores the contents of the H register in the next memory address lt 5 gt Flags affected SK 0 11 lt 0 LO lt 0 SSPD word Store SP Direct 1 Operation code 10 1 1 1 0 0 0 0 2 Number of bytes 4 lt 3 gt Number of states 20 14 lt 4 gt Function word lt SPL word 1 lt SPH Stores the low order 8 bits SPL of the stack pointer in the memory addressed by the 3rd byte lower address and 4th byte upper address and stores the high order 8 bits SPH in the next memory address lt 5 gt Flags affected SK 0 L1 0 10 0 244 CHAPTER 14 INSTRUCTION SET STEAX rpa3 Store EA to Memory addressed by Register Pair 1 Operation code 10 1 0 0 1 0 0 0 1 0 0 1 C C2 Ci Co 2 Number of bytes states The number of bytes and number of states are as shown below depending on the rpa3 specification Lm oL Number of bytes Number of states lt 3 gt Function rpa3 lt EAL 1 EAH Stores the contents of the low order 8 bits EAL of the extend
156. MC A Port C output mode _ ORI SMH 04H Transmit enable d 2 uPD78C18 data transmission The following example shows a subroutine which performs on byte transmission of the accumulator A contents as serial data In this example operation by means of an interrupt INTST is not used and serial data transmission is performed by testing the interrupt request flag INTFST The operation flow is shown below a b 131 CHAPTER 7 SERIAL INTERFACE FUNCTIONS lt a gt The interrupt request flag INTFST is tested to determine whether not data can be written to the transmit buffer TXB lt b gt The accumulator contents are transferred to the transmit buffer The data transmission routine is shown below When data is transmitted from the uPD78C18 the uPD71051 must be in the reception enabled state TRNS SKIT FST Test FST skip if FST 1 eus JR TRNS Wait until FST 1 MOV TXB A Output transmit data b RET Return 3 uPD78C18 data reception For data reception hardware interrupts INTSR are used Initialization is therefore necessary beforehand including setting of the memory address used to store the receive data the number of received bytes the interrupt mask register etc The operation flow is shown below RVEN Set memory address Set number of received bytes Es Set interrupt mask register Spe Enable reception d CTS 0 lt e gt 132 CHAPTER 7
157. N extrae AMA ERROR tUe E ended 122 Serial Mode Register Format in I O Interface 123 I O Interface Mode TIMING 124 Example of Serial Data Transfer System Configuration 2 2 22 9 127 Serial Mode Register Setting mec 128 Timer Mode Register Setting 129 Port C Setting Serial Interface 130 Serial Mode High Register SMH Setting Serial Interface Transmission Enable 130 Interrupt Mask Register MKH Setting Serial Interface INTSR Mask Release 133 Serial Mode High Register SMH Setting Serial Interface Reception Enable 133 A D Converter Block Diagram uer inedite tede metet dab ed epe qn 138 A D Channel Mode Register Forrnat e iie epa c 141 A D Channel Mode Register in Scan Mode 2212 2 2 2 22000000 000 142 Outline of A D Converter Operation Timing in Scan 143 Channel Mode Register in Select 2 2 22 9 143 Outline of A D Converter Operation Timing in Select 144 Relationship Between Analog
158. NS 2 Single pulse output In single pulse output as shown in Figure 6 20 a pulse is output to the COO pin a specific time after the fall of the Cl input In this program example a pulse with a high level width of 200 us is output 100 after the fall of the Cl input at 12 MHz operation Figure 6 20 Single Pulse Output 1 14100 200 uis T INTEIN INTE1 The following are required in order to perform this operation initialization program a service routine to handle internal interrupts INTEIN generated by the fall of the Cl input anda service routine to handle internal interrupts INTE1 generated by a match between the contents of ECNT 1 First the initialization routine will be described The operation flow is shown below INITIAL Timer event counter initialization Port C initialization lt b gt Interrupt mask register mode setting Timer event counter mode setting lt d gt 100 CHAPTER 6 TIMER EVENT COUNTER FUNCTIONS a The timer event counter ECNT is cleared COO output is driven low LVO is set This is done in the same way as in step lt a gt of 1 programmable rectangular wave output lt b gt The 5 in of port is set as Cl input and the PC6 as COO output Figure 6 21 Port C Setting Single Pulse Output PC5 as Cl input PC6 as COO output c Internal inte
159. OFP resin thickness 2 7 mm ic QUIP ic QUIP straight resin thickness 2 7 mm QUIP OFJ CHAPTER 1 GENERAL DESCRIPTION 3 uPD78C12A 78C12A A uPD78C 78 uPD78C 78 uPD78C uPD78C uPD78C 078 Part number 2ACW xxx 2AGF xxx 3BE 2AGO xxx 36 2AGO xxx 37 2AL xxx 2AGF A xxx 3BE 2AGQ A xxx 36 2AL A xxx 64 pin 64 pin 64 pin 64 pin 68 pin 64 pin 64 pin 68 pin Remark indicates ROM code number plast plast plast plast plast plast plast plast Package ic shrink DIP ic OFP resin thickness 2 7 mm ic QUIP ic QUIP straight resin thickness 2 7 mm QUIP CHAPTER 1 GENERAL DESCRIPTION 4 uPD78C14 78C14 A 78C14A 78CG14 78CP14 78CP 14 A uPD78C uPD78C uPD78C uPD78C uPD78C uPD78C uPD78C uPD78C uPD78C uPD78C Part number 4CW xxx 4G xxx 36 4G xxx 37 4G xxx 1B 4GF xxx 3BE 41 4 36 AGF A xxx 3BE AL A xxx 4 8 uPD78CG14E uPD78CP14CW uPD78CP14DW uPD78CP14G 36 uPD78CP14GF 3BE uPD78CP14KB uPD78CP14L uPD78CP14R uPD78CP14G A 36 64 pin 64 pin 64 pin 64 pin 64 pin 68 pin 64 pin 64 pin 68 pin 64 pin 64 pin 64 pin 64 pin 64 pin 64 pin 64 pin 68 pin 64 pin 64 pin Remark xxx indicates ROM code number plast plast plast plast plast plast plast plast plast plast
160. OHtLAd LHOd 014 214 T zaon ve C 9024 oeiy oriy 49 004 204 144 9 ZA V A 8 0 7 21037 76 11 910614 1959 UJO1S S jo3uoo Aqpueis 8 919 0 4 seues 7 8 195 CHAPTER 11 EXTERNAL DEVICE ACCESSES AND TIMINGS Figure 11 6 Memory Map uPD78C18 0000H 7FFFH 8000H BFFFH CO00H FBFFH FCOOH FFFFH On chip ROM 32K bytes External expansion RAM 16K bytes External expansion O On chip Note Can only be used when the RAE bit of the MM register is 1 Figure 11 7 Memory Map uPD78C14 78C14A 0000H 4000H 7FFFH 8000H BFFFH CO00H FEFFH FFOOH FFFFH On chip ROM 16K bytes External expansion ROM 16K bytes External expansion ROM 16K bytes External expansion O On chip Note Can only be used when the RAE bit of the MM register is 1 196 CHAPTER 11 EXTERNAL DEVICE ACCESSES AND TIMINGS Figure 11 8 Memory Map uPD78C124A 0000H On chip ROM 8K bytes 1FFFH 2000H External expansion ROM 24K bytes 7FFFH 8000H External expansion RAM 16K bytes BFFFH C000H External FEFFH expansion O FFOOH F On chip RAM FFFFH Note Can only be used when the RAE bit of the MM register is 1
161. ON TO PIGGYBACK PRODUCT Figure A 4 Memory Mapping Register Format uPD78CG14 7 6 5 4 3 2 1 0 Jove na Jo PD7 to PDO input port PF7 to PFO port mode Single chip PD7 to PDO output port PF7 to PFO port mode Port mode PD7 to PDO expansion mode PF7 to PFO port mode 256 bytes PD7 to PDO 4K bytes PF3 to PFO PF7 to PF4 port mode expansion mode Expansion mode PD7 to PDO 16K bytes PF5 to PFO PF7 amp PF6 port mode expansion mode 48 56 PD7 to PDO expansion mode 60K bytesNote PF7 to PFO Note Depending on setting of bits 7 amp MM6 On chip RAM access Disable Enable Piggyback memory access Access to addresses 0000H to 3FFFH of EPROM located in upper pin section 78 14 mode Access to addresses 0000 to 1FFFH of above EPROM uPD78C12A mode Access to addresses 0000 to OFFFH of above EPROM LPD78C11A mode Setting prohibited 347 APPENDIX INTRODUCTION TO PIGGYBACK PRODUCT A 4 Interface with EPROM Figure A 5 Connection to 27C256A u PD78CG14 27C256A Vop 1 Vop 28 Ao A13 Vss 27 Vss 22 CE 20 Vss 14 Caution When the uPD2764 27C64 27128 is used a high level signal must be input to 27 For this reason pin 27 only should not be inserted in the socket but should receive a high level input externally
162. ONS Figure 6 6 Timer Event Counter Mode Register Setting Interval Timer Mode 3 2 1 0 1 7 6 5 4 d ee Internal clock 012 count ECNT cleared by match of ECNT and 1 contents ECNT counts up every 1 us and the respective comparator compares the ECNT count with the ETMO ETM1 contents and if a match is detected generates an internal interrupt INTEO INTE1 by means of a match signal CP1 Only in the event of a match between ECNT and ETM1 the ECNT contents are cleared and the count starts again from OOOOH Thus the timer functions as an interval timer which repeatedly generates interrupts using the count time determined by the count value set in ETM1 as the interval see Figure 6 7 Caution Since ETMM setting and the start of the internal clock are asynchronous it should be noted that some degree of error may arise in the first interval Internal interrupts can be disabled by setting 1 the MKEO MKE1 bits of the interrupt mask register MKL Figure 6 7 Interval Timer Mode Operation Internal clock n2 0 m nO m nO CPO CP1 INTEO Interrupt Interrupt Interrupt acknowledgment ECNT acknowledgment ECNT acknowledgment Start clearance clearance ETMM setting Remark m n m n count value ETM1 n 91 CHAPTER 6 TIMER EVENT COUNTER FUNCTIONS 6 3 2 Event counter mode In this mode externa
163. OP mode When returning from the software hardware STOP mode by means of a reset the SB flag is used to determine whether the reset is a power on reset The SB flag is set 1 only when the supply voltage changes from a given voltage or below to a given voltage or above This flag can be tested by the SKIT SB or SKNIT SB instruction and is automatically reset 0 when either of these instructions is executed Figure 10 10 Relation between and SB Flag 000 4 SB flag C 1 STOP mode entered SKIT SB Instruction SKNIT SB execution Caution The software hardware STOP mode should not be released while in the low supply voltage data retention mode must be raised to the normal operating voltage before the release is performed 179 CHAPTER 10 CONTROL FUNCTIONS 10 2 Reset Functions When a low level signal is input to the RESET pin a system reset is effected and initialization is performed as shown below Table 10 3 Hardware States after Reset 1 2 Hardware State after Reset Internal data Power on reset Previous contents retained memory Reset input During CPU Write address data Undefined during normal write operation Data in other addresses Previous contents retained operation During non write CPU operation Extended accumulator EA EA Undefined Accumulators A A General purpose register D E H L B C D E H 17
164. OUNTER FUNCTIONS Timer event counter mode setting See Interrupt mask b register setting SO lt a gt COO output operation is stopped by setting the timer event counter output mode register EOM lt b gt INTE1 interrupts are masked disabled by setting the interrupt mask register MKL S TIMER EVENT COUNTER SERVICE E1SV MVI EOM 00H a ORI MKL 40H INTE1 disable b EI RETI 105 MEMO 106 CHAPTER 7 SERIAL INTERFACE FUNCTIONS The uPD78C18 is equipped with a serial interface which allows distributed processing and the connection of various kinds of terminals This serial interface has three operation modes asynchronous mode synchronous mode and 1 interface mode 7 1 Serial Interface Configuration As shown in Figure 7 1 the serial interface consists of three pins the serial data input RxD serial data output TxD and serial clock input output SCK a transmission unit and reception unit each equipped with an 8 bit serial register a buffer register and transmission reception control and a mode register which specifies the operation mode Figure 7 1 Serial Interface Configuration Internal bus Transmit buffer register TXB Serial mode register Receive INTST INTSR register Serial register Serial register S P Reception control PC1 RxD O Transmission control 25
165. Operation code 10 1 1 1 0 1 0 0 0 0 0 0 1 R Ri Ro 2 Number of bytes 3 3 Number of states 11 11 4 Function byte Obtains the logical product of the contents of the register V A B C D H L specified by RzR1Ro 0 to 7 and the immediate data in the 3rd byte and stores the result in the specified register 5 Flags affected ZSK 0 L1 0 L0 0 ANI sr2 byte And Immediate with Special Register 1 Operation code O 1 1 0 1 0 0 Ss 0 0 0 1 52 8 50 2 Number of bytes 3 3 Number of states 20 11 4 Function Sr2 lt 512 byte Obtains the logical product of the contents of the special register sr2 PB PC PD PF MKH MKL ANM SMH EOM TMM specified by 53525150 0 to 3 5 to 9 D and the immediate data in the 3rd byte and stores the result in the specified special register lt 5 gt Flags affected 12 5 lt 0 11 lt 0 10 0 lt 6 gt Example To reset bit 2 PB2 of port B ANI PB OFBH 11111011 276 CHAPTER 14 INSTRUCTION SET ORI A byte Or Immediate with A 1 Operation code 0 0 0 1 0 1 1 1 2 Number of bytes 2 3 Number of states 7 7 4 Function lt Av byte Obtains the logical sum of the contents of the accumulator and the contents of the immediate data in the 2nd byte and stores the result in the accumulator 5 Flags affected ZSK 0 L1 0 10 0 ORI r
166. PENDIX A INTRODUCTION TO PIGGYBACK PRODUCT For the Special quality grade product refer to the manual by changing it to the Standard quality grade product Legend For general understanding of the 87AD series CMOS product functions Read in order of contents For searching for an instruction function by mnemonics Use APPENDIX INDEX OF INSTRUCTIONS ALPHABETICAL ORDER For searching for mnemonics by the outline of functions Search 14 6 Instruction Descriptions for the functions Usage examples in this manual is produced for the Standard quality grade Using this manual for the Special quality grade applications make use of parts and circuits actually used after checking the quality grade Operating Precaution Be sure to read CHAPTER 15 OPERATING PRECAUTIONS in which operating precautions of the 87AD series CMOS products are compiled For the latest information of this products contact our salesman or special agent Data notation weight Upper digits to the left lower digits to the right Notation of active low Xxx A line over pin or signal names Address on the memory map Lower address to the upper part higher address to the lower part Note Explanation of Note in text Caution Content to be read carefully Remark Complementary explanation of text Numeric notation Binary or Decimal Hexadecimal xxxxH Related Docum
167. Port mode PC5 Cl input PC6 Port mode PC6 COO output PC7 Port mode PC7 CO1 output 66 CHAPTER 4 PORT FUNCTIONS 1 2 Port mode Like port A port C is an 8 bit input output port with input output buffer and output latch functions see Figure 4 1 When port C is set to port mode by the mode control C register it can be set bit wise as an input or output port by means of the mode C register MC When set to input port the pins become high impedance When the corresponding bit of the mode C register is set 1 a port C pin functions as an input port pin and when reset 0 aS an output port pin see Figure 4 7 When RESET is input or the hardware STOP mode is set all bits of the mode C register are set and port C functions as an input port high impedance Figure 4 7 Mode C Register Format 7 6 5 4 3 2 1 0 cr wes wes wes s wer Tues PC Output port PC Input port n 20 7 7 6 5 4 3 2 1 0 eer ros rox ees e As with port A direct bit setting resetting of port C output latch contents is possible by an arithmetic or logical operation instruction without the use of an accumulator Data transfer to from an accumulator is also possible Control signal input output mode Port C input output pins PC7 to PCO can be used bit wise as control signal inputs or outputs by setting 1 the relevant bit of the mode c
168. RETS Return from Subroutine and Skip 1 Operation code 1 0 1 1 1 0 0 1 2 Number of bytes 1 3 Number of states 10 4 4 Function PC7 0 lt SP PCis s SP 1 SP lt SP 2 PC PC n n Number of bytes in the skipped instruction Restores the contents of the stack memory addressed by the SP to the low order 8 bits PC7 0 of the program counter and restores the contents of the stack memory addressed by SP 1 to the high order 8 bits PC1s 8 then skips unconditionally 5 Flags affected SK 1 L1 0 10 0 6 Example EXAM EQU 0600H 0500 CALL EXAM STACK lt 0503H 0503 JMP 0700H 0506 JMP 0800H 0509 0600 EXAM PUSH V PUSH B POP B POP V RETS PC e STACK lt PC 3 After returning from the subroutine EXAM JMP 0700H is skipped and JMP 0800H is executed 319 CHAPTER 14 INSTRUCTION SET Return from Interrupt 1 Operation code 10 1 1 0 0 0 1 0 2 Number of bytes 1 3 Number of states 13 4 4 Function PC7 0 lt SP 15 SP 1 PSW lt SP 2 SP lt 5 3 Restores the contents of the stack memory addressed by the SP to the low order 8 bits 7 of the program counter restores the contents of the stack memory addressed by SP 1 to the high order 8 bits 5 of the program counter and restores the contents of the stack memory addressed by SP 2 to the PSW This instruction is used to retur
169. RUCTION SET ORIW wa byte Or Immediate with Working Register 1 Operation code 10 0 0 1 0 1 O 1 2 Number of bytes 3 lt 3 gt Number of states 19 10 lt 4 gt Function V wa V wa byte Obtains the logical sum of the contents of the working register addressed by the V register high order 8 bits and the immediate data in the 2nd byte low order 8 bits and the immediate data in the 3rd byte and stores the result in the addressed working register lt 5 gt Flags affected Z SK 0 L1 0 L0 0 GTIW wa byte Greater Than Immediate 1 Operation code 10 0 1 0 0 1 0 1 2 Number of bytes 3 3 Number of states 13 10 4 Function V wa byte 1 Skip if no borrow Subtracts the immediate data in the 3rd byte and 1 from the contents of the working register addressed by the V register high order 8 bits and the immediate data in the 2nd byte low order 8 bits Skips if no borrow is generated as a result of the subtraction V wa gt byte 5 Flags affected Z SK HC L1 lt 0 LO amp 0 LTIW wa byte Less Than Immediate 1 Operation code 10 0 1 1 0 1 0 1 2 Number of bytes 3 3 Number of states 13 10 4 Function V wa byte Skip if borrow Subtracts the immediate data in the 3rd byte from the contents of the working register addressed by the V register high order 8 bits and the immediate data in the 2nd byte low order 8 b
170. SKIT or SKNIT is executed to test interrupt request flags except INTFNMI for each interrupt source NMI pin states and test flags which do not generate an interrupt request Interrupt enable F F IE F F This is a flip flop which is set by the El instruction and reset by the DI instruction This flip flop is reset when an interrupt is acknowledged by RESET input hardware and in STOP mode Interrupts are enabled when this flip flop is set and disabled when it is reset Non maskable interrupts can be acknowledged at any time irrespective of the status of this flip flop Test flag register This register consists of 8 test flags which do not generate interrupt requests Enables the NMI pin status to be tested This flag is set to 1 when the NMI pin input level is 1 and 0 when the level is 0 e OV Set 1 when the timer event counter ECNT overflows e Set 1 in the event of a parity error framing error or overrun error in serial reception SB Set 1 if pin increases from a level lower than specified to a level higher than specified AN7 to ANA Set 1 by a falling edge input to pins AN7 to Falling edge detection is performed by the same method as in the case of the INT2 pin The above test flags can be tested by a skip instruction SKIT or SKNIT Test flags other than NMI are cleared when tested The NMI test flag is not changed by execution of an instruction and the pin statu
171. SOFTI 0080H Low address t 0 0081H High address 0082 Low address t 1 8 0083 High address 75 OOBEH Low address t 31 OOBFH High address User s area OFFFH Note Can only be used when the RAE bit of the MM register is 1 345 APPENDIX INTRODUCTION PIGGYBACK PRODUCT Memory Mapping Register MM This is an 8 bit register in which the function of specifying the piggyback EPROM access address MM6 amp MM7 is added to the control functions of the uPD78C114 78C12A 78C14 The configuration of the memory mapping register is shown in Figure A 4 When MM7 and MM6 are set to 00 piggyback EPROM addresses 0000H to 3FFFH 16K bytes are accessed and the external memory capacity is 48K bytes When set to 10 addresses OOOOH to OFFFH 4K bytes are accessed and thus the external memory capacity is 60K bytes The MM7 and MM6 bits are only valid in the uPD78CG14 78CP14Nete if data is written to these bits in the uPD78C11A 78C124 78C14 it is ignored by the CPU Therefore a program developed piggyback mode be transferred without modification to mask ROM In the uPD78CG14 MM7 MM6 MM2 MM1 are initialized to 0 by RESET input Therefore the uPD78C14 starts operating in single chip mode Also the RAE bit is undefined after RESET input and must be initialized at the start of the program Note See CHAPTER 12 PROM ACCESSES uPD78CP18 78CP14 ONLY 346 APPENDIX INTRODUCTI
172. Therefore once the mode has been set it should not be changed to a different mode CHAPTER 4 PORT FUNCTIONS 4 5 Port F PF7 to PFO uPD78C18 78C14 78C14A 78C12A 78C11A 78CP18 78CP14 Port F is an 8 bit special input output port in addition to functioning as a general purpose input output port port mode this port also functions as an address bus Port expansion mode can be specified in steps for PF7 to PFO by means of the memory mapping register see 11 1 1 Memory mapping register MM 1 Port mode Like port A port F is an 8 bit input output port with input output buffer and output latch functions see Figure 4 1 Port A Port F can be set bit wise as an input or output port by means of the mode F register MF When set to input the pins become high impedance When the corresponding bit of the mode F register is set 1 a port F pin functions as an input port pin and when reset 0 as an output port pin When RESET is input or the hardware STOP mode is set all bits of the mode F register are set Figure 4 10 Mode F Register Format 7 6 5 4 3 2 1 0 Dar wre ws ere Tw MF 0 PF Output port 1 PF Input port n 2 0 7 7 6 5 4 3 2 1 0 rer ee ea oa en one As with port A direct bit setting resetting and bit testing of port F output latch contents is possible by an arithmetic or logical operation instruction without the use of an accumulator Data t
173. a license from that country Please call an NEC sales representative The customer must judge the need for license uPD78C11 78 11 78C12A 78 14 78C14A 78CP14CW 78CP14G 36 78CP14GF 3BE 78CP14L 78C18 78CP18CW 78CP18GF 3BE 78CP18GO 36 78 11 78C11A A 78C12A A 78 14 78 14 78 18 78CP18 A License not needed uPD78C10 78C10A 78CG14 78CP14DW 78CP14KB 78CP14R 78C17 78CP18DW 78CP18KB 78C10 A 78C10A A 78C17 A The information in this document is subject to change without notice No part of this document may be copied or reproduced in any form or by any means without the prior written consent of NEC Corporation NEC Corporation assumes no responsibility for any errors which may appear in this document NEC Corporation does not assume any liability for infringement of patents copyrights or other intellectual property rights of third parties by or arising from use of a device described herein or any other liability arising from use of such device No license either express implied or otherwise is granted under any patents copyrights or other intellectual property rights of NEC Corporation or others While NEC Corporation has been making continuous effort to enhance the reliability of its semiconductor devices the possibility of defects cannot be eliminated entirely To minimize risks of damage or injury to persons or property arising from a defect in an NEC semiconductor device customer mu
174. a tesi nsa suede 334 15 6 78 8 Read Operation ee tede ee res e ads Rue BR ed 335 A 1 Memory Map 4uPD78CTA4 ee i efe te dete t hace tds 343 A 2 Memory Map uPD78G12A 344 A 3 Memory uPD78C11A 0 2 222 22020000000 000000 eene nennen rennes 345 A 4 Memory Mapping Register Format UPD78CG14 347 A 5 10 27 256 348 MEMO LIST OF TABLES Table No Title Page 2 1 20 40 0 EEE 24 2 2 Operation of to PFO 78 18 78 14 78 14 78 12 78 11 78 18 78 14 26 2 3 Operation of 7 to PFO UPD78C17 78C10A 27 2 4 MODEO MODE1 Functions 78 17 78 10 28 2 5 5 CM 31 3 1 Mode Register 41 3 2 Flag dese ada 43 4 1 Operation of PD7 to PDO 78 18 78 14 78 14 78 12 78 11 78 18 78 14 70 4 2 Operation of to PFO 78 18 78 14 78 14 78 12
175. accumulator and the contents of the register pair BC DE HL specified by 1 to 3 and skips if the result is not zero lt 5 gt Flags affected 12 5 116 0 1060 DOFF rp3 Off Test Register Pair with EA 1 Operation code 10 1 1 1 0 1 0 0 2 Number of bytes 2 lt 3 gt Number of states 11 8 lt 4 gt Function EA Arp3 Skip if zero Obtains the product of the contents of the extended accumulator and the contents of the register pair rp3 BC DE HL specified by 1 to 3 and skips if the result is zero lt 5 gt Flags affected Z SK L1 lt 0 LO lt 0 299 CHAPTER 14 INSTRUCTION SET 14 6 8 Multiplication division instructions MUL r2 Multiply A by Register 1 Operation code 10 1 0 0 1 0 0 0 0 0 1 0 1 1 R Ro 2 Number of bytes 2 lt 3 gt Number of states 32 8 lt 4 gt Function EA Axr2 Performs unsigned multiplication of the contents of the accumulator by the contents of the register r2 A B C specified by RiRo 1 to 3 and stores the result in the extended accumulator 5 Flags affected SK 0 L1 0 10 0 DIV r2 Divide EA by Register 1 Operation code 10 1 0 0 0 0 1 1 1 1 Rac Re 2 Number of bytes 2 3 Number of states 59 8 4 Function EA lt EA r2 r2 lt remainder Divides unsigned division the contents of the extended accumulator by the contents of the regis
176. ace program In the following example of serial interface programming data is exchanged with a uPD71051 in the asynchronous mode This example uses the following parameters uPD78C18 oscillator frequency of 11 0592 MHz TO output internal clock used as the serial clock 110 bps data transfer rate clock rate of 16 8 bit character length 2 stop bits and even parity enabled An example of the system configuration is shown in Figure 7 10 Three lines are necessary for serial data transfer the TxD and RxD serial data input and output lines and the CTS clear to send control line In this example PC7 is functions as the CTS control line which is used when the uPD78C18 receives data As PC7 is in input port mode from resetting until the mode is set 1 is written to the PC7 output latch before it is pulled high with a pull up resistor and set as an output port Figure 7 10 Example of Serial Data Transfer System Configuration uPD78C18 71051 CTS PC7 CTS TxD RxDATA RxD TxDATA Baud TxCLK rate generator RxCLK 127 CHAPTER 7 SERIAL INTERFACE FUNCTIONS 1 Initialization The serial mode registers timer port C etc must be initialized in advance to allow uPD78C18 serial data transmission reception The operation flow is shown below Set serial a interface mode Initialize timer b Initialize port C c mE d transmission a The parameters required for serial data transm
177. ad Register Pair with Immediate 1 Operation code 10 P2 P Po O 1 High byte 2 Number of bytes 3 lt 3 gt Number of states 10 10 lt 4 gt Function i rp2 lt word Loads the 2nd byte into the low order 8 bits SPL of the SP or the lower half C E L EAL of the register pair rp2 BC DE HL or extended address specified by P2P Po 0 to 4 and loads the 3rd byte into the upper half SPu B D H EAH A stacking effect is produced when HL is specified as the register pair 5 Flags affected SK 0 L1 0 LO lt 1 when rp2 HL SK 0 L1 lt 0 LO lt 0 other cases 6 Example 4000H Load 40H into register and OOH into register 250 CHAPTER 14 INSTRUCTION SET TABLE Table pick up 1 Operation code O 1 0 0 1 000 lt 2 gt Number of bytes 2 3 Number of states 17 8 4 Function lt 3 lt PC 3 A 1 Loads the table contents addressed by 3 into the C register and loads the table contents addressed by PC 3 A 1 into the B register lt 5 gt Flags affected SK 0 L1 0 10 0 6 Example TBO MVI A 0 A 0 TB1 MVI 1 A21 TB2 MVI A 2 A22 SLL A Shift Logical Left Accumulator PC TABLE BC lt TABLE PC 2 JB PC BC 3 4 5 6 7 8 251 CHAPTER 14 INSTRUCTION SET 14 6 3 8 bit opera
178. amic shrink DIP with window plast plast resin thickness 2 7 mm ic QUIP ceramic WOFN plast plast resin thickness 2 7 mm ic QUIP CHAPTER 1 GENERAL DESCRIPTION 1 2 2 Quality grade e Standard uPD78C10A uPD78C14A uPD78C18 uPD78C11A uPD78CG14 uPD78CP18 78 12 78 14 uPD78C14 uPD78C17 Special 78 10 78 14 UPD78C18 A uPD78C11A A uPD78CP14 A wPD78CP18 A uPD78C12A A 78 17 Please refer to Quality grade on NEC Semiconductor Devices Document number IEI 1209 published by NEC Corporation to know the specification of quality grade on the devices and its recommended applications CHAPTER 1 GENERAL DESCRIPTION 1 3 Pin Configurations Top View 1 3 1 Shrink DIP QUIP straight 37 QUIP 36 1 Normal operation mode PAO O 1 2 STOP 2 3 PD7 PA3O 4 O PD6 PALO 5 O PD5 6 7 7 8 O PD2 PBOO 9 0 O PDO 2 1 7 2 PF6 3 O PF5 4 PF4 6 5 PB7O 6 O PF2 PCO TxD 7 OPF1 PC1 RxD O 8 O PFO PC2 SCK O 9 O ALE PC3 INT2 O O WR PC4 TO O ORD PC5 CI O 7 1 7 O ANG O AN5 MODE1 O ANA RESET O AN3 MODEO O AN2 X20 O ANI X10 O ANO Vss O AVss 10 CHAPTER 1 GENERAL DESCRIPTION
179. amp 1 These bits specify the timer event counter upcounter ECNT input clock latch timing and INTEIN interrupt flag setting conditions They may also be used for clear mode specification when EM1 1 and 0 0 The internal clock 12 is obtained by dividing the oscillator frequency by 12 EMO amp EM1 bits 2 amp 3 These bits control the ECNT clear mode When the value of the EMO bit and EM1 bit is 00 ECNT is cleared to 0000H and counting up is not performed When the EMO and bits are set to any value other than 00 ECNT counts up using the input clock ECNT is cleared by the conditions shown in Figure 6 2 after which the count starts again from 0000H When 0 0 and EM1 1 the conditions for clearing ECNT are as follows according to the input clock specification e When ET1 0 and 0 or ET1 0 and 1 ECNT is cleared by the falling edge of the Cl input see 6 3 4 Pulse width measurement mode e When ET1 1 0 or ET1 1 and 1 ECNT is cleared by the falling edge of the TO input see 6 3 3 Frequency measurement mode 8 bits 4 amp 5 These bits specify the timing for transfer to the output latch of the level of the LVO level F F shown in Figure 6 3 When 0 and CO01 1 the LVO level is transferred to the output latch in the event of either a match between ECNT and or a fall of the input When 00 1 and CO01 1 the level is transferred
180. ance High level Output O output to pin specified by address bus Remainder are high impedance Power Operating 65 mW Typ 15 MHz Note 1 750 mW Typ consumption Standby 5 uW Typ 4 8 mW Typ PackageNote 2 64 pin plastic shrink DIP 64 pin plastic QUIP straight 64 pin plastic QUIP 64 pin plastic OFP bent leads 68 pin plastic OFJ 64 pin plastic shrink DIP 64 pin plastic QUIP straight 64 pin plastic QUIP Pin connection except amp OFJ Notes 1 Voo 64 64 STOP pin 63 Voo pin 63 80 mW 15 MHz on the 78 18 78 17 78 14 78 14 2 Correspondence between pin connection and pin number depends on the type of package Caution There also differences in electrical specifications oscillator characteristics and some internal operation timings These should be noted when directly replacing a uPD7811 7810 with a uPD78C18 78C17 78C14 78C14A 78C12A 78C11A 78C10A 21 GENERAL DESCRIPTION CHAPTER 1 1 7 Differences between Standard and Special Quality Grade Products onsejd uld 79 e 440 onsejd e 2 onsejd 14 89 e dIND onsejd uid y9 e z onse d uid p9 e onsejd uid g9 e onsejd uid p9 e 440 onsejd e uid p9 e 440 uld 7g e did yuuus onse d utd p9 e 14284047 1992 9 74 v0L28 0128
181. asing masking of INTAD internal interrupts The A D converter initialization routine is shown below SF A D CONVERTER INITIALIZATION ADIN LXI H 4000 Set data pointer a LXI B 0301H Set counter aus LXI D 0101 Set counter EXX Exchange register set MVI ANM 00H c SKIT FAD Reset INTFAD NOP lt d gt ANI INTAD enable lt e gt In the INTAD interrupt service routine the A D conversion values in CRO to are stored in the prescribed memory locations The operation flow is shown below 148 CHAPTER 8 ANALOG DIGITAL CONVERTER FUNCTIONS E INTAD Store contents of CRO to CR3 lt a gt In memory lt b gt Y ue c d Breg Y 4020 Set memory end C Y lt e gt reg address N 4004H HL e HL 1 end Set memory 4 Dreg Y address 4024H HL lt 4020H end Set memory Ereg address HL lt 4004H Set memory Set memory address address HL lt 4024H HL lt 4000H Set counter 0 Set counters 0 Set counter Bc3 Set A D channel mode register invert ANI2 bit a RETI lt a gt The contents of CRO to CR3 which hold the A D conversion values for pins ANO to AN3 or pins AN4 to AN7 are stored in the prescribed memory locations lt b gt A check is made to see if an INTAD internal interrupt has been generated 4 times If fewer than 4 the HL register pair is incremented by 1 and control retur
182. at the processing time can be reduced BC DE and HL can be simultaneously replaced with the ALT register by means of the EXX instruction The HL register can be independently replaced with the ALT register by means of the EXH instruction Program counter PC This is a 16 bit register which holds information on the next program address to be executed This register is normally incremented automatically according to the number of bytes of the instruction to be fetched When an instruction associated with a branch is executed immediate data or register contents are loaded RESET input clears this counter to 0000H Stack pointer SP This is a 16 bit register which holds the start address of the memory stack area LIFO format SP contents are decremented when a call or PUSH instruction is executed or an interrupt is generated and incremented when a return or POP instruction is executed CHAPTER 3 INTERNAL BLOCK FUNCTIONS 3 2 Mode Registers Mode registers are provided see Table 3 1 to control the ports timers timer event counters serial interface A D converter and interrupt control blocks Table 3 1 Mode Register Functions Mode Register Name Function Mode A register Performs bit wise input output specification for port A Mode B register Performs bit wise input output specification for port B Mode control C register Performs bit wise port control mode specification for port C Mode C register Performs bit wise
183. ates is 3 Therefore the number of idle states consumed when this instruction is skipped is 4 4 3 11 232 CHAPTER 14 INSTRUCTION SET 14 6 Instruction Descriptions 14 6 1 8 bit data transfer instructions MOV r1 Move A to Register 1 Operation code O 0 1 1 T2 To lt 2 gt Number of bytes 1 lt 3 gt Number of states 4 4 lt 4 gt Function r1 lt Transfers the accumulator contents to register r1 EAH EAL B C D E H L specified by T2T1To 0 to 7 When EAH is specified by r1 the contents transferred to the high order 8 bits of the extended accumulator and when EAL is specified to the low order 8 bits lt 5 gt Flags affected SK 0 L1 0 L0 0 lt 6 gt Example B Transfer A to MOV r1 Move Register to A 1 Operation code 0 0 0 1 To lt 2 gt Number of bytes 1 3 Number of states 4 4 4 Function lt r1 Transfers the contents of registerr1 EAH EAL C D E L specified by T2T1To 0 to 7 to the accumulator When EAH is specified by r1 the contents of the high order 8 bits of the extended accumulator are transferred to the accumulator and when EAL is specified the low order 8 bits of the extended accumulator are transferred 5 Flags affected SK 0 L1 0 10 0 6 Example MOV A C Transfer C to A 233 CHAPTER 14 INSTRUCTION SET MOV sr A Move A to Special Regi
184. ation Timing in Select Mode ANn ANn ANn ANn ANn conversion conversion conversion conversion conversion operation operation operation operation operation Sampling Sampling Sampling Sampling ANM Conversion Conversion Conversion Conversion Conversion register result write result write result write result write result write write to CRO register to CR1 register to CR2 register to CR3 register to CRO register INTFAD flag setting 8 3 3 A D converter operation control method A D converter operation can be stopped by controlling the Varer input voltage When a voltage of or more is input to the Varer pin the A D converter starts the conversion operation and the conversion result is guaranteed for 3 4 V to If the Vaner pin input voltage is made or less during the conversion operation the A D converter conversion operation stops and CRO to CR3 contents are undefined If the Varer input voltage is changed for A D converter to stop control the A D channel mode register ANM is not affected Thus if the Varer input voltage is increased to 3 4 V or more to reset the operating state from the stop state the A D converter restarts its operation by storing a conversion value in CRO in the mode in effect just before it stopped If the Varer input voltage level is changed the edge detection function of inputs AN7 is not affected Caution When Varer is low inputs ANO to AN7 must be in the range from AVss
185. bits SP lt 5 gt Flags affected SK 0 L1 0 L0 0 247 CHAPTER 14 INSTRUCTION SET LDEAX rpa3 Load EA with Memory addressed by Register Pair 1 Operation code 10 1 0 0 1 0 0 0 1 0 0 O Cs C2 Co lt 2 gt Number of bytes states The number of bytes and number of states are as shown below depending on the rpa3 specification _ gt 1 oe nes Debra ven Heb Number of bytes Number of states lt 3 gt Function EAL lt rpa3 EAH lt rpa3 1 Loads the contents of the memory addressed by the register pair roa3 DE HL DE HL DE byte HL A HL B HL EA HL byte specified by C3C2C1Co 2 to 5 B to F into the low order 8 bits EAL of the extended accumulator and loads the contents of the memory addressed by rpa3 1 into the high order 8 bits EAH f DE byte or HL byte is specified as rpa3 the memory is addressed by the result of adding the 3rd byte Data of the instruction to the contents of DE HL f HL A HL B or HL EA is specified the memory is addressed by the result of adding the contents of the register A B EA to the contents of HL 4 Flags affected SK 0 L1 lt 0 LO lt 0 248 CHAPTER 14 INSTRUCTION SET PUSH rp1 Push Register Pair on Stack 1 Operation code 1 0 1 1 0 Qi Qo lt 2 gt Number of bytes 1 lt 3 gt Number of states 13 4 lt 4 gt Function i SP 1 lt 1 SP 2 rptu
186. bps 830 kHz 830 kbps 1 25 MHz 1 25 MbpsNete 1 x 16 2 5 MHz 156 kbps 2 5 MHz 156 kbps x 64 39 1 kbps 39 1 kbps Notes 1 When data is received at transfer rates between 830 kbps and 1 25 Mbps 2 stop bits are necessary 2 At the x 1 clock rate RxD must input a signal synchronized with SCK CHAPTER 7 SERIAL INTERFACE FUNCTIONS 7 3 2 Synchronous mode In the synchronous mode character synchronization is implemented by means of synchronization characters and bit synchronization by means of the serial clock In this mode data is transferred with a fixed character length of 8 bits with no parity bit The serial mode register settings are therefore as shown in Figure 7 6 Figure 7 6 Serial Mode Register Format in Synchronous Mode 5 4 3 2 1 0 7 6 ee Synchronous operation Fixed 8 bit character length Parity disable 7 6 5 4 3 2 1 0 o o T Te ne ne SCK selection Internal clock TO output Internal clock 384 Internal clock 024 External clock Disable Enable Reception enable Disable Enable Search mode Disable Enable 121 CHAPTER 7 SERIAL INTERFACE FUNCTIONS In the synchronous mode as shown in Figure 7 7 the transmit data has a fixed character length of 8 bits with no parity bit and is transferred LSB first on the falling edge of the serial clock SCK Re
187. ceive data is input on the rising edge of SCK Serial data 1 2 122 Figure 7 7 Synchronous Mode Timing 1 data transfer Data transmission A transmit operation in the synchronous mode is enabled by setting 1 the TxE bit of the serial mode high register SMH When data is written to the transmit buffer register by a MOV TXB A instruction and the previous data transfer is terminated the transmit buffer register contents are transferred to the serial register converted into serial data and transmitted LSB first from TxD in synchronization with the falling edge of SCK Serial data is transmitted at the same rate as SCK When data is transferred from the transmit buffer register to the serial register and the transmit buffer register becomes empty an interrupt request INTST is generated Serial transmission interrupts are disabled by setting 1 the MKST bit of the interrupt mask register When the TxE bit is 0 or when the serial register contains not data to be transmitted the TxD pin assumes the mark status 1 However when an external clock is used the mark status is assumed after output of a 1 bit low level pulse The maximum data transfer rate in transmission is 625 kbps when an internal clock is used as SCK and 1 25 Mbps when an external clock is used at 15 MHz operation Data reception A receive operation in the synchronous mode is enabled by setting 1 the RxE bit of serial mode high
188. ces cedem un i v dcus 226 14 4 7 Base index addressing 227 14 4 8 Working register cose rena te ipte ode To Rb PN RR a 228 14 4 9 Accumulator indirect addressing 2 229 144 10 Immediate addressing dicun 229 14 4 11 Extended immediate addressing on ael i tu ede 230 14412 Drect 269555 e 231 14 5 Number of States Required for 232 14 6 Instruction 2 233 14 6 1 8 0 data transfer instructions 233 1406 2 16 bit data transfer INSTTUCTIONS 242 146 3 8 bit operation instructions Register ae bec Rs e 252 14 6 4 8 bit operation instructions Memory SaR EEE 263 14 6 5 Immediate data operation 270 14 6 6 Working register operation instructions 2 12 9 285 14 6 7 T16 bit operation INSTIUCTIONS
189. chip RAM capacity 256 8 bits e Standby functions HALT mode hardware software STOP mode e CMOS e Single power supply 5 V 10 Ordering Information Part Number Package uPD78CG14E 64 pin ceramic piggyback QUIP 337 APPENDIX INTRODUCTION PIGGYBACK PRODUCT Pin Configuration Top View PAO PA1 PA2 PA3 PA4 5 6 PBO 1 2 4 5 6 7 PCO TxD PC1 RxD PC2 SCK PC3 INT2 PC4 TO PC6 COO PC7 CO1 NMI INT1 MODE1 RESET MODEO 2 1 Vss 1 2 3 4 5 6 7 8 Upper pin section 338 INTRODUCTION TO PIGGYBACK PRODUCT APPENDIX A Block Diagram 0 L8d 0 24 0 1 0 4 8 gt 8 418 0 44 0 2 O ELV 0JGOWLSAGOW 14544 4015 9 0 02 0 00 UJe1s S Aqpuels Jepooeq 715 93H 15 HM snq jeujeiu 5 QN 8 Jojunoo 1 992 ejeq 1 LNI jeues 250 SSAV DAVY O LNV LOO LOd 009 99d 19 99d
190. cial mode of register indirect addressing using the HL and DE register pairs which is effective for 16 bit data transfers between the extended accumulator EA and memory With double auto increment addressing after the memory to be manipulated is addressed using the contents of the register pair specified by the addressing specification code 2 1 in the instruction as the operand address the contents of that register pair are automatically incremented by 2 thus preparing for the next addressing operation Double auto increment addressing is used when an instruction with the following operand format is executed Notation 1 Description Method D H STEAX rpa3 Operation code 0 1 0 0 1 0 0 0 1 0 0 1 C Ci Co If the double auto increment mode is selected for the HL register pair used as rpa3 the instruction is written as shown below STEAX HL lt EAL HL 1 lt EAH HL lt HL 2 The corresponding operation code is shown below Operation code 0 1 0 0 1 0 0 0 22b CHAPTER 14 INSTRUCTION SET 14 4 6 Base addressing This is a special mode of register indirect addressing using the HL and DE register pairs in which the memory to be manipulated is addressed using as the operand address the sum of the contents of the register pair base register specified by the addressing specification code AsA2A1Ao CsC2C1Co in the instruction and the immediate data of
191. comprising 255 equal resistors and two resistors equal to half that value to provide 256 voltage steps between the two pins The series resistance string voltage tap is selected by the tap decoder This decoder is driven by the 8 bit successive approximation register SAR One bit of the SAR is set ata time starting from the most significant bit MSB until the value of the series resistance string voltage tap matches the voltage value of the analog input That is when conversion starts the MSB of the SAR is set 1 and the series resistance string voltage tap is made 1 2 Varer and is compared with the analog input If the analog input is greater than 1 2 Varer the MSB of the SAR remains set if smaller than 1 2 Varer the MSB is reset and the operation proceeds to comparison with the next upper bit after the MSB reset Here i e for bit 7 the series resistance string voltage tap is made 3 4 Varer or 1 4 Varer and is compared with the analog input The comparison process continues this way up to the least significant bit of the SAR binary search method When the 8 bit comparison ends the SAR contains the valid digital result and this result is serially latched into registers CRO to CR3 When the A D conversion result has been latched into all the registers CRO to CR3 and INTAD A D conversion termination interrupt is generated The A D converter has independent power supply pins AVbp and AVss and the effects of power supply fluctuations and
192. cumulator Skips if no borrow is generated as a result of the subtraction A gt byte lt 5 gt Flags affected Z SK HC L1 lt 0 LO 0 GTI r byte Greater Than Immediate 1 Operation code 10 1 1 1 0 1 0 0 0 0 1 0 1 Ri Ro 2 Number of bytes 3 3 Number of states 11 11 4 Function i r byte 1 Skip if no borrow Subtracts the immediate data in the 3rd byte and 1 from the contents of the register r V A B C D E H L specified by R2RiRo 0 to 7 Skip if no borrow is generated as a result of the subtraction r gt byte 5 Flags affected Z SK HC L1 e 0 LO 0 CY GTI sr2 byte Greater Than Immediate 1 Operation code 10 1 1 0 0 1 0 0 Ss 0 1 0 1 52 8 So 2 Number of bytes 3 3 Number of states 14 11 4 Function 5 sr2 byte 1 Skip if no borrow Subtracts the immediate data in the 3rd byte and 1 from the contents of the special register sr2 PA PB PC PD PF MKH MKL ANM SMH EOM TMM specified by 53525150 0 to 3 5 to 9 B D Skips if no borrow is generated as a result of the subtraction sr2 gt byte 5 Flags affected Z SK HC L1 lt 0 10 lt 0 CY 279 CHAPTER 14 INSTRUCTION SET A byte Less Than Immediate 1 Operation code 10 0 1 1 0 1 1 1 lt 2 gt Number of bytes 2 3 Number of states 7 7 lt 4 gt Function A byte Skip if borrow Subtracts the immediate data in the 2nd byte from the
193. d The corresponding bits of the mask register for two types of interrupt request are both set to 1 In this case the interrupt requests are held pending are not acknowledged when the interrupt request flag is set When the pending interrupt requests are unmasked they are acknowledged if there are no other interrupt requests of higher priority in the interrupt enabled state When execution of the interrupt service routine ends processing is performed to return to the address at which the interrupt was acknowledged First registers flags etc other than the PSW which have been savedare restored and the IE F F is set by the El instruction Next an RETI instruction is executed to restore the previously saved return address and PSW in the order lower PC byte upper PC byte PSW 166 CHAPTER 9 INTERRUPT CONTROL FUNCTIONS 9 5 Interrupt Operation by SOFTI Instruction When the SOFTI instruction is executed the program jumps unconditionally to the interrupt address 0060 he SOFTI instruction interrupt is not affected by the IE F F and the IE F F is not affected when this instruction is executed The servicing procedure for an interrupt generated by the SOFTI instruction is as follows 1 PSW upper PC byte and lower PC byte are saved to the stack memory in that order 1 The program jumps to the interrupt address 0060 When execution of the interrupt service routine ends processing is performed to return
194. d H L 1 Operation code 0 1 0 1 0 0 0 0 2 Number of bytes 1 lt 3 gt Number of states 4 4 lt 4 gt Function 5 Exchanges the contents of H and L registers with the contents of the H and L registers 5 Flags affected SK 0 L1 0 10 0 BLOCK Block Data Transfer 1 Operation code 10 0 1 1 0 0 0 1 2 Number of bytes 1 3 Number of states 13 x C 1 4 4 Function DE HL DE DE 1 HL HL 1 C C 1 end if borrow Performs a block transfer to the memory addressed by the DE register pair comprising the number of bytes specified by the C register used as a counter C register value 1 of the contents of the memory addressed by the HL register pair Each time a byte is transferred HL and DE are auto incremented and the C register is decremented When the C register value reaches FFH the instruction is terminated and the program moves on to the next instruction Interrupts can be acknowledged during repeated transfers by means of a BLOCK instruction in which case the transfer continues after returning from the interrupt service routine 5 Flags affected SK 0 L1 0 10 0 241 CHAPTER 14 INSTRUCTION SET 14 6 2 16 bit data transfer instructions DMOV rp3 EA Move EA to Register Pair 1 Operation code 1 0 1 1 0 1 Po 2 Number of bytes 1 3 Number of states 4 4 4 Function rp3L lt EAL
195. d for TIMER1 This can only be specified for TIMER1 The timer operates as a 16 bit interval timer which counts TIMERO match signals as the TIMER1 upcounter input An interval from 1 us to 65 536 ms or from 32 us to 2 1 s can be selected at 12 MHz operation Since both TIMERO and TIMER1 perform the same operation TIMERO operation is described here Interval timer operation is started by setting the count value in timer REGO and writing the necessary data to the timer mode register The upcounter counts up every input clock cycle while the comparator constantly compares the contents of the counting upcounter and the contents of timer REGO and generates an internal interrupt INTTO if they match When a match occurs the upcounter is cleared and the count up starts again from 00H Thus TIMERO functions as an interval timer which generates repeated interrupt requests using the value set in timer REGO as the interval When timer REGO is set an interrupt is generated on the 256th count Cautions 1 When data is written to timer REGO output of the comparator match signal is disabled and therefore INTTO is not generated 2 After RESET input the contents of TMO are undefined Ensure that TMO initialization is performed by the program before the timer is started When the TIMERO match signal is selected as the timer F F input and the upcounter contents and the timer REGO contents match the timer F F contents are inverted and a square
196. d gt Set interrupt mask register SES a The memory address for storing the A D conversion results is set in the HL register pair Here the setting is for storage of the conversion results in address 4000H onward b Generalregisters B C D and E are used as counters to enable the A D conversion results to be stored in the specified memory The B register is used to check that A D conversion has been performed four times for pins ANO to or pins ANA to AN7 Therefore 03H is set in the B register The C D and E register are stored in the respective memory areas and 01H is set in each c The A D channel mode register is set to specify the scan mode and ANO to AN3 as the input pins Figure 8 9 A D Channel Mode Register Settings 7 6 5 4 3 2 1 0 Scan mode Pins ANO to AN3 Oscillator frequency gt 9 MHz 147 CHAPTER 8 ANALOG DIGITAL CONVERTER FUNCTIONS lt d gt The A D channel mode register is cleared to OOH when a reset is performed and A D conversion is performed on pins ANO to AN3 in the scan mode The conversion values are stored in register CRO to and itis possible that the interrupt request flag INTFAD may be set 1 Therefore the interrupt request flag is reset 0 by a skip operation before setting the MKAD bit of the interrupt mask register MKH to 0 and releasing masking e MKAD bit of the interrupt mask register MKH is 0 rele
197. d in the hardware STOP mode Figure 7 2 Serial Mode High Register SMH Format 7 6 5 4 3 2 1 se o se Tee ye s SCK selection Internal clock TO output Internal clock 3a4 Internal clock 024 External clock Disable Enable Reception enable Disable Enable Search mode Disable Enable interface mode Disable Enable Disable Enable 111 CHAPTER 7 SERIAL INTERFACE FUNCTIONS 7 2 2 Serial mode low register SML The individual bits of the serial mode low register are used to specify the operating mode as shown below The configuration of this register is shown in Figure 7 3 1 2 3 4 5 112 B1 amp B2 bits 0 amp 1 These bits determine asynchronous mode and synchronous operation switching and the data rate in the synchronous mode In the asynchronous mode the serial clock is divided by the clock rate specified by these bits and used for data transfer For synchronous operation the B1 and B2 bits are set to 00 L1 amp L2 bits 2 amp 3 These bits specify the number of bits comprising a character PEN bit 4 This bit determines whether odd even parity is added to the transfer data and whether an odd even parity check is made on the transfer data When the PEN bit is set 1 a parity bit is added to each character before transmission and a parity check is performed
198. d without executing the instruction following the STOP instruction Figure 10 6 Software STOP Mode Release Timing NMI Signal Input Interrupt execution CPU OSC NMI INTFNMI II Wait programmable TIMER1 match signal CHAPTER 10 CONTROL FUNCTIONS 10 1 5 Hardware STOP mode When the STOP signal changes from the high to low level the hardware STOP mode is set In this mode all clocks stop When the hardware STOP mode is set program execution stops and the on chip RAM contents just before stoppage are retained and the STOP signal used to release the hardware STOP mode is valid All other functions stop and the reset state is set In the hardware STOP mode the uPD78C18 output pins become high impedance However the port output latch values are retained Cautions 1 Crystal oscillation or ceramic oscillation should be used when using the hardware STOP mode The hardware STOP mode must not be used when an external clock is input The STOP mode is entered at a machine cycle boundary Thus memory contents are not corrupted but the STOP mode may be entered midway through execution of an instruction Therefore with instructions which perform a 16 bit data transfer the STOP mode may be entered after only 8 bits have been transferred with the transfer of the remaining 8 bits incomplete 16 bit data transfer instructions and call instructions
199. dress Memory Jump address table Effective address 1 Stores the high order 8 bits of the start address of the next instruction in the stack memory indicated by SP 1 and stores the low order 8 bits in the stack memory indicated by SP 2 then loads the contents of the memory addressed by the effective address comprising the 5 bit immediate data ta into the low order 8 bits PC7 0 of the program counter and loads the contents of the memory addressed by the effective address 1 into the high order 8 bits PC1s 8 and jumps to the address indicated by the memory contents The jump address table must be located in memory address 128 to 191 The table address should be directly written as a label or a number of up to 16 bits in the operand field of the CALT instruction 5 Flags affected SK lt 0 1160 10 0 317 CHAPTER 14 INSTRUCTION SET SOFTI Software Interrupt lt 1 gt Operation code lt 2 gt Number of bytes 3 Number of states 4 Function 0 1 1 1 0 0 1 0 1 16 SP 1 lt PSW SP 2 PC 115 8 SP 3 PC 17 0 SP SP 3 PC lt 0060H This is the software interrupt instruction which stores the PSW contents Z SK HC L1 LO CY in the stack memory indicated by SP 1 then stores the high order 8 bits of the start address of the next instruction in the stack memory addressed by SP 2 and stores the low order 8 bits in the stack memory addressed by SP 3 The instruction then l
200. dress 0000H the contents of the various registers should be initialized or re initialized as required in the program Caution With an external clock input if Voo is within the operating voltage range all the pins are high impedance after RESET signal input Then a system reset is effected after X1 input However this does not apply when the clock is not input at all to X1 after powering on X1 input 1 1 System reset 1 1 1 1 Ports become high impedance 181 CHAPTER 10 CONTROL FUNCTIONS 10 3 Clock Generation Circuit The uPD78C18 incorporates a clock generation circuit allowing the necessary clock to be generated simply by connecting a crystal or a ceramic resonator and capacitors It is also possible to input an externally generated clock Figure 10 11 shows a circuit with a resonator connected and Figure 10 12 shows an example of a circuit when an external clock 15 input Figure 10 11 Oscillator Connection Circuit Figure 10 12 Example of External Clock Input Circuit uPD78C18 uPD78C18 x1 x1 HCMOS inverter Caution When using the system clock oscillator the shaded area in Figure 10 11 should be wired in order to avoid effects of wiring capacitor etc as shown below Minimize the length of wiring Do not cross other signal lines or position wiring close to a variable high current The connecting point of the oscillator capacitor should always be the same potential as Vss D
201. during reception if a parity error is generated the error flag is set When the PEN bit is reset 0 parity addition and checking is not performed EP bit 5 This bit controls whether odd or even parity is used Even parity is used when the EP bit is set 1 and odd parity when reset 0 The EP bit is only valid when the PEN bit is set 1 S1 amp S2 bits 6 amp 7 These bits control the number of stop bits transmitted in the asynchronous mode CHAPTER 7 SERIAL INTERFACE FUNCTIONS Figure 7 3 Serial Mode Low Register SML Format 7 6 5 4 3 SML 52 51 12 Clock rate Synchronous operation x1 Setting prohibited Setting prohibited 7 bits 8 bits Disable Enable Even parity generation check 0 Odd 1 Even Number of stop bits Setting prohibited 1 bit Setting prohibited 2 bits The serial mode low register SML is set to 48H by RESET input and in the hardware STOP mode 113 CHAPTER 7 SERIAL INTERFACE FUNCTIONS 7 2 3 Serial mode register initialization The following procedure should be used for serial mode register initialization lt 1 gt lt 2 gt lt 3 gt lt 4 gt lt 5 gt Set the mode to be used in the SMH register while the TxE bit and RxE bit are both 0 transmission and reception disabled Set the SML register When the TO output is used as the serial clock perfo
202. e accumulator are not affected lt 5 gt Flags affected 5 lt 0 11 0 10 lt 0 lt 6 gt Example A HL 7 4 3 0 7 4 3 0 Before execution 0 0 0 0 00 0 1 010 0 1 1 7 4 3 0 7 4 3 0 After execution 00010101 RLL r2 Rotate Logical Left Register 1 Operation code 10 1 0 0 1 0 0 0 2 Number of bytes 2 3 Number of states 8 8 4 Function r2m 1 lt 2 120 lt CY CY lt 127 7 0 Bih 2 Performs 1 bit left rotation including the CY flag of the contents of the register r2 A B C specified by RiRo 1 to 3 lt 5 gt Flags affected SK 0 L1 lt 0 LO lt 0 CY 307 CHAPTER 14 INSTRUCTION SET RLR r2 Rotate Logical Right Register 1 Operation code O 1 0 1 0 lt 2 gt Number of bytes 2 3 Number of states 8 8 lt 4 gt Function 2 1 12m 127 lt CY lt 120 7 0 20 45 2 Performs 1 bit right rotation including the CY flag of the contents of the register r2 A C specified by R1Ro 1 to 3 lt 5 gt Flags affected SK 0 L1 lt 0 10 0 SLL r2 Shift Logical Left Register 1 Operation code O 1 0 0 1 000 2 Number of bytes 2 3 Number of states 8 8 4 Function r2m 1 lt 12m 20 0 lt 127 7 0 Performs 1 bit left shift of the contents of the register r2 A specified by RiRo 1 to 3 r27 is shifted into the CY
203. e generated due to noise etc hence causing malfunction CMOS devices behave differently than Bipolar or NMOS devices Input levels of CMOS devices must be fixed high or low by using a pull up or pull down circuitry Each unused pin should be connected or GND with a resistor if it is considered to have a possibility of being an output pin All handling related to the unused pins must be judged device by device and related specifications governing the devices STATUS BEFORE INITIALIZATION OF MOS DEVICES Note Power on does not necessarily define initial status of MOS device Production process of MOS does not define the initial operation status of the device Immediately after the power source is turned ON the devices with reset function have not yet been initialized Hence power on does not guarantee out pin levels I O settings or contents of registers Device is not initialized until the reset signal is received Reset operation must be executed immediately after power on for devices having reset function QTOP is a trademark of NEC Corporation MS DOS is a trademark of Microsoft Corporation PC AT and PC DOS are trademarks of IBM Corporation The export of these products from Japan is regulated by the Japanese government The export of some or all of these products may be prohibited without governmental license To export or re export some or all of these products from a country other than Japan may also be prohibited without
204. e management is not required In addition products with built in capacitors etc are available offering the advantage of fewer parts and reduced mounting area 186 CHAPTER 11 EXTERNAL DEVICE ACCESSES AND TIMINGS 11 1 uPD78C18 78C14 78C14A 78C12A 78C11A External Device Accesses For the uPD78C18 78C14 78C14A 78C12A 78C11A the areas shown below can be used for external device expansion data memory program memory or peripheral devices uPD78C18 Addresses 8000H to FBFFH 31K bytes e uPD78C14 78C14A Addresses 4000H to FEFFH 48K bytes e uPD78C12A Addresses 2000H to FEFFH 56K bytes uPD78C11A Addresses 1000H to FEFFH 60K bytes The memory mapping register MM is used for external device expansion Pins PD7 to PDO are used as a multiplexed address data bus AD7 to ADO and pins PF7 to PFO are used as an address bus AB15 to AB8 With pins PF7 to PFO the number of bits functioning as the address bus can be varied according to the size of the external expansion memory and memory can be expanded in steps from 256 bytes up to 31K 48K 56K 60K bytes depending on the product Pins which are not used for the address bus can be used as general purpose input output port pins see Table 11 1 Table 11 1 PF7 to PFO Address Bus Selection External Address Space Up to 256 bytes Up to 4K bytes Up to 16K bytes Up to 31K 48K 56K 60K bytesNote Note 31K uPD78C18 48K
205. e result of the subtraction is not zero Azbyte 5 Flags affected Z SK HC L1 lt 0 LO lt 0 CY NEI r byte Not Equal Immediate with Register 1 Operation code 10 1 1 1 0 1 0 0 2 Number of bytes 3 3 Number of states 11 11 4 Function j r byte Skip if no zero Subtracts the immediate data in the 3rd byte from the contents of the register r V A B C D E H L specified by R2RiRo 0 to 7 Skips if the result of the subtraction is not zero rzbyte 5 Flags affected Z SK HC L1 lt 0 LO 0 CY NEI sr2 byte Not Equal Immediate with Special Register 1 Operation code 10 1 1 0 0 1 0 0 Ss 1 1 0 1 52 51 2 Number of bytes 3 3 Number of states 14 11 4 Function sr2 byte Skip if no zero Subtracts the immediate data in the 3rd byte from the contents of the special register sr2 PA PB PC PD PF MKL ANM SMH EOM TMM specified by 53525150 0 to 3 5 to 9 B D Skips if the result of the subtraction is not zero sr2zbyte 5 Flags affected Z SK HC L1 lt 0 LO 0 CY 281 CHAPTER 14 INSTRUCTION SET EQI A byte Equal Immediate with A 1 Operation code 10 1 1 1 0 1 1 1 2 Number of bytes 2 3 Number of states 7 7 lt 4 gt Function i A byte Skip if zero Subtracts the immediate data in the 2nd byte from the contents of the accumulator Skips if the result of the subtraction is ze
206. e selected as 4K bytes 16K bytes or 63K 64K bytes according to the settings of the MODEO and pins Table 2 4 MODEO and Functions uPD78C17 78C10A External Address Space 4 bytes addresses 0000H to OFFFH 16K bytes addresses 0000H to 3FFFH Setting prohibited 63K bytes addresses 0000H to FBFFH Note 2 64K bytes addresses 0000H to FEFFH Notes 1 Pull up resistor required The pull up resistor R is 4 KO R 0 4 tcvc kQ tcvc unit is ns 2 63K uPD78C17 64K uPD78C10A When the MODEO and MODE pins are pulled high up to 1 a control signal is output in synchronization with ALE MODEO and input signals are sampled periodically and the mode is set Caution The uPD78CP18 and 78CP14 use the MODEO pin for input and the pin for input output 2 1 10 NMI Non maskable interrupt Input The edge triggered falling edge non maskable interrupt input 2 1 11 1 1 Interrupt request Input The edge triggered rising edge maskable interrupt input Can also be used as the AC input zero cross detection pin 2 1 12 AN7 to ANO Analog input Input The 8 analog inputs to the A D converter AN7 to AN4 can also be used as input pins for falling edge detection when a falling edge is detected the test flag is set 1 2 1 13 Varer Reference voltage Input The A D converter reference voltage input pin Also used as the A D converter operation con
207. e several items listed under the description method one of these is selected Alphanumeric characters written in upper case and the symbols and are keywords and are written in that form The relevant numeric value or label is written as immediate data 213 CHAPTER 14 INSTRUCTION SET Description Method Notation PA PB PC PD PF MKH MKL ANM SMH SML EOM ETMM TMM MM MCC MA MB MC MF TXB 0 TM1 ZCM PA PB PC PD PF MKH MKL ANM SM PA PB PC PD PF MKH MKL ANM SM ETMO ETM1 SP B D H V B D H EA SP B D EA EOM TMM CRO CR1 CR2 EOM TMM H D H D H H D H D H D byte H A H B H EA H byte D H D H D byte H A H B H EA H byte D 8 bit immediate data 16 bit immediate data 8 bit immediate data 3 bit immediate data CY HG Z NMINote 1 F1 F2 FEO FE1 FEIN FAD FSR FST ER OV AN5 AN6 AN7 SB Note NMI can also be written as FNMI Remark 1 sr sr4 special register 2 rp rp3 register pair 4 f flag CARRY HALF CARRY STACK POINTER CY BC HC DE Z HL 5 TIMER EVENT COUNTER MODE TIMER EVENT COUNTER OUTPUT MODE PORTA PORT B PORT C PORT D PORT F irf interrupt flag MODE MODE B MODE C MODE CONTROL C MODE F M
208. ected When peripheral devices are connected since the uPD78C18 78C14 78C14A 78C12A 78C11A has 1 0 address space memory mapped I O must be used for all of them The connection of typical peripheral devices is illustrated here Figure 11 5 shows an example of a configuration in which external memory and a parallel interface unit uPD71055 are connected The memory maps for the wPD78C18 78C14 78C14A 78C12A 78C11A when set to the full expansion mode are shown in Figure 11 6 to 11 9 An example of the control program for the uPD71055 is shown below PPIST LXI H 0CO3 H Set base address MVI A 1000001 1 B 23 to P20 Input 2 2 P17 to P10 Input Mode 0 Selection anangisi P27 to P24 Output E ME c e 7 to POO Output a Mode 0 Selection eater Mode selection STAX H Set control word 1 03 C003H MVI A OFOH STAX H Port 2 OFOH output 1 02 C002H MVI A 0C3H MVI L 00H STAX H PortO OC3H output C000H 194 EXTERNAL DEVICE ACCESSES AND TIMINGS CHAPTER 11 pesn J91 9Scevadr 2 1198 Se1Aq 382 2198 pesn seiq 191 ZLGOLZAd 71 8030 QNO YM UJO1s S 13534 Ocd Lcd C90 3M siy ELS
209. ed accumulator the memory addressed by the register pair rpa3 DE DE HL DE byte HL A HL B HL EA HL byte specified by C3C2CiCo 2 to 5 B to F and stores the contents of the high order 8 bits EAH in the memory addressed by rpa3 1 If DE byte or HL byte is specified as rpa3 memory is addressed by the result of adding the 3rd byte Data of the instruction to the contents of DE HL If HL A HL B or HL EA is specified the memory is addressed by the result of adding the contents of the register A B EA to the contents of HL lt 4 gt Flags affected SK 0 L1 0 10 0 b Example LXI D 4000H DE lt 4000H STEAX D 4000H EAL 4001H EAH DE lt 4002H STEAX D 10H 4012H EAL 4013H EAH DE 4002H This example stores the low order 8 bits EAL of the extended accumulator in address 4000H and address 4012H and stores the high order 8 bits EAH in address 4001H and address 4013H 245 CHAPTER 14 INSTRUCTION SET LBCD word Load B amp C Direct 1 Operation code O 1 1 1 0 0 0 0 lt 2 gt Number of bytes 4 lt 3 gt Number of states 20 14 lt 4 gt Function word word 1 Loads the contents of the memory addressed by the 3rd byte lower address and 4th byte upper address into the C register and loads the contents of the next memory address into the B register lt 5 gt Flags affected SK 0 L1 0 10 0
210. ed for the two timers using the following input clocks according to the specification of the timer mode register TMM 1 2 3 4 Internal clock 012 When the internal clock 012 is specified as the upcounter input clock the timer operates as an interval timer with an interval from 1 us to 256 us at 12 MHz operation with 1 resolution of 1 us Internal clock 0384 When the internal clock 0884 is specified as the upcounter input clock an interval time from 32 us to 8 192 ms can be selected at 12 MHz operation with a resolution of 32 us External pulse When an external pulse TI input is specified as the upcounter input clock the timer operates as an interval timer of any desired resolution Also when the upcounter counts external pulses up to the value set in timer REGO 1 1 it can also be used as an event counter which generates internal timer interrupts INTTO INTT1 However it is not possible to read the count data the upcounter contents during the count To prevent errors due to noise signals in the TI pin sampling is performed by a sampling pulse with a 1 state 250 ns 12 MHz cycle Thus an input signal of less than 1 state is eliminated and a high level or low level duration of 2 states or more is necessary for a signal to be acknowledged as a TI pin input signal The upcounter count operation is performed by falling edge input on the pin TIMERO output can only be specifie
211. edures should be followed First process the pending interrupt or reset the interrupt request flag by executing a skip instruction or mask all interrupts except those used to release the HALT mode This function is valid when pins PC7 to PCO are in the control signal input output mode Therefore TO output and serial transmission reception is enabled in the HALT mode 171 CHAPTER 10 CONTROL FUNCTIONS 10 1 2 HALT mode release 1 2 172 Release by RESET signal When the RESET signal changes from the high to low level in the HALT mode the HALT mode is released and the reset state is set When the RESET signal returns to the high level the CPU starts program execution at address 0 When the RESET signal is input the RAM contents are retained but the contents of other registers are indeterminate Figure 10 1 HALT Mode Release Timing RESET Signal Input Execution of address 0 instruction CPU HLT s SUL RESET Release by interrupt request flag The HALT mode is released if at least one interrupt request flag is set by the generation of a non maskable interrupt NMI or one of ten unmasked maskable interrupts INTTO INTT1 INT1 INT2 INTEO INTE1 INTEIN INTAD INTST and INTSR When the HALT mode is released by a non maskable interrupt the instruction following the HLT instruction is not executed and the program jumps to the interrupt address 0004 irrespective of the in
212. ees 2 14 Normal Operation Mode 00 0 40 40008 00 2 1 1 PAT tO PAO eee b be 2 1 2 PBZ 19 PBO POM iet ena ed etin ae rbv tns eed Ee 21 3 PCI to aeneo bere erga dep pecado eo va Pu Ro dcc bed 2 14 PDZ TORO PORE ID 2 1 5 PFA tO PFO IF 2067 ADS 2 1 8 ALE Address latehr enable iude tte tape te 2 19 MODEO MODET Mode in eerte 2 430 NMI Noni maskable e rer e bc detecte 2 1 11 1 1 Interrupt 2 7512 ANZ to ANO Analog Inl 25 21 13 Reference Voltage iic cet cde see trea cet trt re cq queat n ride 2 114 VbD uiu ctr rite rob to CORE HI lanes te eR UE aves 251 15 56 Analog VSS seni 1542 de e RR d let ae tuf 2 1 16 STOP Stop control input 2 2 2 2 0 0 60 010010000000 DM 255 M ME 2118 RESET
213. ement auto decrement is specified the contents of the register pair DE or HL are automatically incremented or decremented by 1 after the accumulator has been loaded DE byte or HL byte is specified as rpa2 the memory is addressed by the result of adding the 2nd byte Data of the instruction to the contents of DE HL If HL A HL B or HL EA is specified the memory is addressed by the result of adding the contents of the register A B EA to the contents of HL lt 4 gt Flags affected SK 0 1160 10 lt 0 lt 5 gt Example LXI H 4000H HL lt 4000H MVI B 20H B lt 20H LDAX H B A lt 4020H This example loads the contents of address 4020H into A EXX Exchange Register Sets 1 Operation code 0 0 0 1 0 0 0 1 2 Number of bytes 1 3 Number of states 4 4 4 Function EZE LeL Exchanges the contents of registers B C D H L with the contents of registers C D E L 5 Flags affected SK 0 L1 0 10 0 240 CHAPTER 14 INSTRUCTION SET EXA Exchange V A EA and V A EA 1 Operation code 0 0 0 1 0 0 0 0 lt 2 gt Number of bytes 1 lt 3 gt Number of states 4 4 lt 4 gt Function EAZEA Exchanges the contents of V and A registers and EA with the contents of the and A registers and EA 5 Flags affected SK 0 1160 1060 Exchange HL an
214. ents The following documents are provided for 87AD series CMOS version products Numbers in the table are document numbers Document Name m Data Sheet User s Manual Application Note Product Name 078 1872 This manual e l uPD78C Software fundamental 78 2678 1131 78 e 11 78 Floating point format uPD78C 2417 operation package 078 2565 1242 uPD78CG14 2564 78 14 2533 Hardware 078 17 2788 1240 78 18 2789 uPD78CP18 3033 78 2814 uPD78C uPD78C10A A 2846 uPD78C11A A uPD78C12A A uPD78C14 A 2813 uPD78CP14 A 3068 uPD78C IC 3127 uPD78C PD78CP18 A 3233 contents of the above documents are subject to change without prior notification Please check whether requested documentation is the latest version 87AD Series CMOS Version Development uPD78C18 HPD78CP18 PROM product Expanded ROM RAM capacity 78 17 ROM less product On chip pull up resistor 78 14 Mask option we _____ PD78CP14 PROM uPD78C14 product Expanded capacit 5 On chip pull up 5 resistor 2 Mask option On chip pull up uPD78C11 resistor uPD78C11A LuPD78C10 Mask option LPD78C10A ROM l
215. er 8 bits and stores the result in the accumulator lt 5 gt Flags affected 2 5 lt 0 11 lt 0 10 0 XRAW wa Exclusive Or Working Register with A 1 Operation code O 1 1 1 0 1 0 0 T 0 0 70 0 0 0 lt 2 gt Number of bytes 3 3 Number of states 14 11 4 Function Obtains the exclusive logical sum of the contents of the accumulator land the contents of the working register addressed by the V register high order 8 bits and the immediate data in the 3rd byte low order 8 bits and stores the result in the accumulator lt 5 gt Flags affected 12 5 lt 0 11 lt 0 10 0 wa Greater Than Working Register 1 Operation code 10 1 1 1 0 2 Number of bytes 3 3 Number of states 14 11 4 Function A V wa 1 Skip if no borrow Subtracts the contents of the working register addressed by the V register high order 8 bits and the immediate data in the 3rd byte low order 8 bits and 1 from the contents of the accumulator Skips if no borrow is generated as a result of the subtraction A V wa 5 Flags affected Z SK HC L1 e 0 LO 0 CY 288 CHAPTER 14 INSTRUCTION SET LTAW wa Less Than Working Register 1 Operation code O 1 1 1 0 1 0 0 lt 2 gt Number of bytes 3 lt 3 gt Number of states 14 11 lt 4 gt Function A V wa Skip if borrow Subtracts the contents of the workin
216. eral purpose port pins RESET input or the hardware STOP mode resets 0 these bits and sets PD7 to PDO to input port mode high impedance MM3 bit RAE This bit controls enabling RAE 1 and disabling RAE 0 of on chip RAM accesses This bit should be set to 0 during standby operation and when externally connected RAM and not on chip RAM is used In normal operation this bit retains its value when RESET is input Cautions 1 Overwriting the RAE bit during program execution allows an apparent increase of 256 bytes in the memory space However this operation cannot be emulated by an emulator and should therefore not be performed 2 The RAE bit is undefined after a power on reset and must therefore be initialized by an instruction CHAPTER 11 EXTERNAL DEVICE ACCESSES AND TIMINGS In the uPD78CP18 78CP14 bit MM5 to MM7 are also valid These are used to specify the access range of the on chip EPROM See CHAPTER 12 PROM ACCESSES uPD78CP18 78CP14 ONLY for details Figure 11 2 Memory Mapping Register Format uPD78C18 78C14 78C14A 78C12A 78C11A 7 6 5 4 3 2 1 0 Te Pe e PD7 to PDO Input port PF7 to PFO Port mode Single chip Port mode PD7 to PDO Output port PF7 to PFO Port mode PD7 to PDO Expansion 256 bytes mode PF7 to PFO Port mode PD7 to PDO Expansion 4K bytes PF3 to PFO mode PF7 to PF4 Port mode PD7 to PDO Expansion 16K bytes PF5 to PFO mode
217. esistor not incorporated PC7 to PCO Caution Ifa pull up resistor is incorporated the zero cross function cannot be operated correctly 2 5 Processing of Unused Pins Recommended Connection PAO to PA7 Connect to Vss or Vpp via a resistor PBO to PB7 PCO to PC7 PDO to PD7 PFO to PF7 RD Leave open WR ALE STOP INT1 NMI Connect to Vss or Connect to VAREF Connect to Vss AVss ANO to AN7 Connect to AVss or 37 MEMO 38 CHAPTER 3 INTERNAL BLOCK FUNCTIONS 3 1 Registers The central registers are the sixteen 8 bit registers four 16 bit registers and special registers shown in Figure 3 1 Figure 3 1 Register Configuration SP 15 0 7 07 0 V A es B ain D E H L 15 0 EA 1 7 07 0 1 Accumulator A Since an accumulator type architecture is used data processing such as 8 bit arithmetic and logical operation instructions centers on this accumulator This accumulator can be replaced with the ALT register paired with the vector register V by means of the EXA instruction 2 Expansion accumulator EA Data processing such as 16 bit arithmetic and logical operation instructions centers on this accumulator This accumulator be replaced with the ALT register EA by means of the EXA instruction 39 CHAPTER 3 INTERNAL BLOCK FUNCTIOS 40 3 4
218. ess product ROM less product CMOS process on chip pull up resistors Mask option LPD7811H HPD7810H ROM less product Time of product release Note 4PD78C10 78C11 are maintenance products TABLE OF CONTENTS CHAPTER 1 GENERAL 5 0 44444 44 8000 1 1 FO AtUNOS E A T 1 2 Ordering Information and Quality 24 2 1 1 2 1 Ordering eR 12 2 Quality GLA a Een qo 1 3 Pin Configurations Top 1 3 shrink DIP OOIP straight 37 1 3 2 WOEN sn 2329 AB a ne b e s 1 3 4 a uA ec oes et uem aD dert 14 BIOCK DIA Gra INEO 1 5 Functional Comparison of 87AD Series CMOS 1 6 Differences between 87AD Series CMOS and NMOS 1 7 Differences between Standard and Special Quality Grade Products CHAPTER 2 PIN FUNCTIONS c ccccccccccceecsssssssnseceeseseeeeseecesseesenaeseeseseeeeseesesssssenaeseeeeseeseeeeesee
219. ess FFFFH INX rp Increment Register Pair 1 Operation code 0 0 Pi 1 0 2 Number of bytes 1 lt 3 gt Number of states 7 4 lt 4 gt Function rp 1 Increments SP or the contents of the register pair BC DE HL specified by 1 0 to 3 5 Flags affected SK 0 1160 10 0 lt 6 gt Example INX D DE lt 1 In this example the 16 bit register with D as the high order 8 bits and E as the low order 8 bits is incremented 301 CHAPTER 14 INSTRUCTION SET INX EA Increment EA 1 Operation code 1 0 1 0 1 0 0 0 2 Number of bytes 1 3 Number of states 7 4 4 Function EA EA 1 Increments the extended accumulator lt 5 gt Flags affected SK 0 L1 0 10 0 DCR r2 Decrement Register 1 Operation code 10 1 0 1 0 R Ro 2 Number of bytes 1 3 Number of states 4 4 4 Function 3 r2 lt 12 1 Skip if borrow Decrements the contents of the register r2 A B C specified by R Ro 1 to 3 and skips if a borrow is generated as a result of the decrement 5 Flags affected 12 SK L1 e0 L00 lt 6 gt Example DCR B B B 1 DCRW wa Decrement Working Register 1 Operation code 10 0 1 1 0 0 O 0 Offset 2 Number of bytes 2 3 Number of states 16 7 4 Function V wa V wa 1 Skip if borrow Decrements the contents of the working register addre
220. f states 8 8 4 Function Skip if f 0 Skips if flag f CY HC Z specified by FzF Fo 2 to 4 is set to 0 5 Flags affected SK L1 0 L0 0 SKIT irf Skip if Interrupt 1 Operation code O 1 0 1 0 0 0 O 1 0 ls 12 h lo 2 Number of bytes 2 3 Number of states 8 8 4 Function Skip if irf 1 then reset irf Skips if the interrupt request flag or test flag NMI FTO FT1 F1 F2 FEO FE1 FEIN FAD FSR FST ER OV AN5 AN6 AN7 SB specified by lalslzlilo 0 to C 10 to 14 is set to 1 then resets the checked interrupt request flag The NMI flag is not affected 5 Flags affected SK L1 0 L0 0 SKNIT irf Skip if No Interrupt 1 Operation code O 1 0 0 1 0 0 0 O 1 1 k gt 10 2 Number of bytes 2 3 Number of states 8 8 4 Function Skip if irf 0 Skips if the interrupt request flag or test flag NMI FTO FT1 F1 F2 FEO FE1 FEIN FAD FSR FST ER OV AN5 AN6 AN7 SB specified by 1413121110 0 to C 10 to 14 is set to 0 If the checked interrupt request flag is 1 that interrupt request flag is reset The NMI flag is not affected lt 5 gt Flags affected SK L1 lt 0 LO 0 322 CHAPTER 14 INSTRUCTION SET 14 6 16 CPU control instructions NOP No Operation 1 Operation code 10 0 0 0 lt 2 gt Number of bytes 1 lt 3 gt Number of states 4 4 lt 4 gt Function Expends 4 states
221. g may not be set normally event if the reception is made normally Remedy Examine the following methods Correction by software When the ER flag is set issue the transmit request to transmitting side This is the most desirable method as a remedy against error occurrence Using the internal clock as SCK signal source Use the internal clock as the SCK signal source In this case do not output the SCK from the PC2 pin MCC2 0 with PC2 placed in the port mode Inputting an external clock signal to Input an external clock signal to PC3 TI and count TI with the timer Reverse TO by the timer comparator match signal and use the reversed TO as SCK signal In this case never output SCK from the PC2 pin MCC220 Receving processing initialization program example MVI SMH 00H SCK TO MV A XxH SML setting MOV SML A MVI xxH data to scale the TI input setting MOV TMO A MV TMM xxx01000B TIMERO TI count TO is reversed by the TIMERO match signal MV A xxxx101xB PC1 RxD input PC2 Port mode PC3 TI input MOV MCC A ORI SMH 08H Receive enabled Remarks 1 Relationship between input frequency fri data transfer speed B and clock rate N is as given below fn 2xCxN Where C is TMO set value 2 The TI input high low level width is 6 b oscillation frequency or more The level width B is 0 4 us or more when fxx 15 MHz and the maximum frequency of fri is 1 25 MHz
222. g register addressed by the V register high order 8 bits and the immediate data in the 3rd byte low order 8 bits from the contents of the accumulator Skips if a borrow is generated as a result of the subtraction A V wa 5 Flags affected Z SK HC L1 lt 0 10 lt 0 CY NEAW wa Not Equal Working Register with A 1 Operation code O 1 1 1 0 1 0 0 1 1 1 01 0 0 0 2 Number of bytes 3 3 Number of states 14 11 4 Function A V wa Skip if no zero Subtracts the contents of the working register addressed by the V register high order 8 bits and the immediate data in the 3rd byte low order 8 bits from the contents of the accumulator Skips if the result of the subtraction is not zero A V wa lt 5 gt Flags affected Z SK HC L1 lt 0 LO 0 CY EQAW wa Equal Working Register with A 1 Operation code 10 1 1 1 0 1 0 0 2 Number of bytes 3 lt 3 gt Number of states 14 11 lt 4 gt Function i A V wa Skip if zero Subtracts the contents of the working register addressed by the V register high order 8 bits and the immediate data in the 3rd byte low order 8 bits from the contents of the accumulator Skips if the result of the subtraction is zero A V wa 5 Flags affected Z SK HC L1 lt 0 LO e 0 CY 289 CHAPTER 14 INSTRUCTION SET ONAW wa On Test Working Register with A 1 Operation code 10 1 1 1 0 1 0 0 1 1 0 O 1 0 0 0
223. h is actually output from pins PF5 through PFO and PD7 through PDO PC PF5 0 PD7 0 1000H 1000 4000H 0000 AFFFH OFFF When external ROM addresses are used as consecutive addresses the external ROM area should be set in addresses 4000H to 7FFFH Since in this case on chip ROM and external ROM are not in consecutive addresses a jump instruction must be used to move the program to the respective areas The same applies if the external ROM area is set in addresses 8000H to BFFFH Cautions 1 The internal address bus contents are output in all machine cycles to port D when it is functioning as an address data bus Also the internal address bus contents are output in all machine cycles from port F pins functioning as an address bus However RD and WR signals are only output in a memory cycle 2 Software which dynamically changes the operating mode of port D and port F cannot be emulated by an emulator and therefore should not be used 188 CHAPTER 11 EXTERNAL DEVICE ACCESSES AND TIMINGS Wve 2 IVY 9 2 pesn 1oN IVY 9192 00 pesn IVY diu uo pesn 1oN IVY diuo uo 89 4 992 EU191X3 seAq Jt AIOUJeuJ AZE 1 48 4 diuo uo pesn epouu uoisuedxe 1 309 494 87 316 Se14q 6 91 38 9 WOH 4149 40 pesn JON
224. he data shown in Figure 6 12 in the timer event counter mode register ETMM Caution The timer event counter count should be started while TO is low ECNT input is masked If the timer is started when TO is high the counter contents should be read by the second INTEIN onward after the timer is started Figure 6 12 Timer Event Counter Mode Register Setting Pulse Width Measurement Mode 7 6 5 4 3 2 1 0 2 Count while input is high Cleared on fall of Cl input When the CI input rises the internal clock 12 is supplied to ECNT and the count is started ECNT continues the internal clock while the Cl input is high When the CI input falls the internal clock supply to ECNT is stopped the ECNT contents are transferred to the ECPT register ECNT is cleared and an internal interrupt INTEIN is generated see Figure 6 13 The transfer of the ECNT contents to the ECPT register clearing of ECNT and interrupt generation are performed on the fall of the Cl input see 6 1 2 Timer event counter capture register ECPT 6 Clear control circuit and 7 Interrupt control circuit In the pulse width measurement mode both the high level and low level width of pulses input to the CI pin must be at least 16 states 4 us at 12 MHz operation if less than 12 states ECNT contents will not be transferred to the ECPT register and ECNT will not be cleared 94 CHAPTER 6 TIMER EVENT COUNTER FUNCTIONS
225. he register V A B C D E H L specified by R2RiRo 0 to 7 5 Flags affected SK 0 L1 0 L0 0 6 Example MOV B 89 Transfer contents of address 89ABH to MOV word r Move Register to Memory 1 Operation code 10 1 1 1 0 0 0 0 R2 Ri Ro Low address e High address lt 2 gt Number of bytes 4 lt 3 gt Number of states 17 14 lt 4 gt Function word lt Transfers the contents of the register r V A B C D E H L specified by R2R1Ro 0 to 7 to the memory addressed by the 3rd byte Low address and 4th byte High address 5 Flags affected SK 0 L1 0 L0 0 6 Example 5 MOV EXAM A Transfer to memory addressed by label EXAM 235 CHAPTER 14 INSTRUCTION SET byte Move Immediate to Register 1 Operation code 10 1 1 0 1 R2 Ri Ro 2 Number of bytes 2 3 Number of states 7 7 lt 4 gt Function i r byte Transfers the immediate data in the 2nd byte Data to the register r V A B C D E H L specified by R2R1Ro 0 to 7 Has a stacking effect when A or L is specified as r 5 Flags affected SK 0 L1 1 LO 0 when r A SK 0 L1 0 LO lt 1 when r L SK 0 L1 0 LO lt 0 other cases 6 Example MVI D OAFH Load AFH into the D register MVI sr2 byte Move Immediate to Special Register 1 Operation code O 1 1 0 0 1 0 0 53 0 0
226. hould be secured by the following means lt 1 gt RESET input when powering on reset period lt 2 gt RESET input reset period or automatically used timer when returning from the hardware STOP mode lt 3 gt RESET input or preset timer when returning from the software STOP mode Using a crystal resonator C1 C2 10 pF should be kept The values of C1 and C2 as recommended resonator when a ceramic resonator is used are shown in Table 10 5 184 CHAPTER 10 CONTROL FUNCTIONS Table 10 5 Recommended Ceramic Resonator 1 2 Recommended C1 pF C2 pF uPD78C10A Murata Mfg Co Ltd CSA15 00MX001 15 15 78C11A CSA12 0MT 30 30 Product Name Manufacturer Part Name 78C12A CST12 0MT Build in uilt in CST12 0MTW uilt in uilt in CSA7 37MT 30 30 CST7 37MT i uilt in CST7 37MTW i uilt in FCR15 0MC i uilt in FCR10 0MC ilt i uilt in FCR8 0MC i uilt in uPD78C14 Murata Mfg Co Ltd CSA15 0MX3 22 22 CSA12 0MT 30 30 CST12 0MT uilt in uilt in CST12 0MTW uilt in uilt in CSA10 0MT 30 30 CST10 0MT uilt in uilt in CST10 0MTW uilt in uilt in CSA6 00MG 30 30 CST6 00MG uilt in FCR15 0MC uilt in FCR12 0MC uilt in FCR10 0MC uilt in FCR8 0MC uilt in uPD78C14A Murata Mfg Co Ltd CSA15 0MX3 22 22 CSA12 0MT 30 30 CST12 0MT uilt in uilt in CST12 0MTW uilt in uilt in CSA10 0MT 30 30 CST10 0MT uil
227. iate data in the 3rd byte to the contents of the special register sr2 PA PB PC PD PF MKH MKL ANM SMH EOM TMM specified by 53525150 0 to 3 5 to 9 B D and stores the result in the specified special register Skips if no carry is generated as a result of the addition 5 Flags affected Z SK HC L1 lt 0 LO 0 272 CHAPTER 14 INSTRUCTION SET SUI A byte Subtract Immediate from A 1 Operation code 10 1 1 0 0 1 1 0 lt 2 gt Number of bytes 2 3 Number of states 7 7 lt 4 gt Function 5 lt A byte Subtracts the immediate data the 2nd byte from the contents of the accumulator and stores the result in the accumulator lt 5 gt Flags affected Z SK lt 0 L1 lt 0 LO lt 0 CY SUI byte Subtract Immediate from Register 1 Operation code O 1 1 1 0 1 0 0 0 1 1 0 0 Ri Ro 2 Number of bytes 3 lt 3 gt Number of states 11 11 lt 4 gt Function i r r byte Subtracts the immediate data in the 3rd byte from the contents of the register r V A B C D E H L specified by R2RiRo 0 to 7 and stores the result in the specified register 5 Flags affected Z SK e0 L1 0 LO 0 CY SUI sr2 byte Subtract Immediate from Special Register 1 Operation code 10 1 1 0 O 1 0 0 Ss 1 1 0 0 52 Si So 2 Number of bytes 3 3 Number of states 20 11 4 Function o 572 lt sr2 byte Subtracts the im
228. ifted into the CY flag and 0 is loaded into r27 Skips if a carry is generated as a result of the shift 5 Flags affected SK L1 0 LO 0 CY DRLL EA Rotate Logical Left EA 1 Operation code 10 1 0 1 000 2 Number of bytes 2 3 Number of states 8 8 4 Function EAn 1 lt EAn CY lt 15 15 0 Performs 1 bit left rotation including the CY flag of the contents of the extended accumulator lt 5 gt Flags affected SK 0 L1 lt 0 LO lt 0 CY 310 CHAPTER 14 INSTRUCTION SET DRLR EA Rotate Logical Right EA 1 Operation code 0 1 0 0 1 0 0 0 lt 2 gt Number of bytes 2 3 Number of states 8 8 4 Function EAn 1 lt EAn EAis lt CY CY lt EAo 15 0 MM Performs 1 bit right rotation including the CY of the contents of the extended accumulator lt 5 gt Flags affected SKe 0 L1 0 L0 lt 0 CY DSLL EA Shift Logical Left EA 1 Operation code 10 1 0 0 1 lt 2 gt Number of bytes 2 3 Number of states 8 8 4 Function EAn 1 EAn EAo lt 0 CY lt 15 15 0 Performs a 1 bit left shift of the contents of the extended accumulator 15 is shifted into the CY flag and 0 is loaded into EAo lt 5 gt Flags affected SKe 0 L1 0 10 0 CY 311 CHAPTER 14 INSTRUCTION SET DSLR EA Shift Logical Right EA
229. in the 3rd byte low order 8 bits to the contents of the accumulator and stores the result in the accumulator lt 5 gt Flags affected Z SK lt 0 L1 lt 0 LO lt 0 CY ADCW wa Add Working Register to A with Carry 1 Operation code 10 1 1 1 0 1 0 0 2 Number of bytes 3 lt 3 gt Number of states 14 11 lt 4 gt Function DA lt A V wa CY Adds the contents of the working register addressed by the V register high order 8 bits and the immediate data in the 3rd byte low order 8 bits to the contents of the accumulator including the CY flag and stores the result in the accumulator 5 Flags affected Z SK lt 0 L1 lt 0 10 lt 0 CY ADDNCW wa Add Working Register to A Skip if No Carry 1 Operation code 10 1 1 1 0 1 0 0 1 0 1 0 0 0 0 0 lt 2 gt Number of bytes 3 lt 3 gt Number of states 14 11 lt 4 gt Function A V wa Skip if no carry Adds the contents of the working register addressed by the V register high order 8 bits and the immediate data in the 3rd byte low order 8 bits to the contents of the accumulator and stores the result in the accumulator Skips if no carry is generated as a result of the addition lt 5 gt Flags affected Z SK HC L1 e 0 LO 0 CY 285 CHAPTER 14 INSTRUCTION SET SUBW wa Subtract Working Register from A 1 Operation code 10 1 1 1 0 1 0 0 1 1 1 0 0 0 0 0 lt 2 gt Number of bytes 3
230. ing method the register to be manipulated is specified by the contents of the register specification code R2R Ro T2T1To 555453525150 etc in the instruction Register addressing is used when an instruction with the following operand formats is executed In some cases an 8 bit register is specified and in others a register pair 16 bits is specified Notation Description Method r V A C D E H L r1 EAH EAL B C D E H L r2 A B C sr PA PB PC PD PF MKH MKL ANM SMH SML EOM ETMM TMM MM MCC MA MB MC MF TXB TMO TM1 ZCM sr PB PD PF MKH MKL ANM SMH EOM TMM RXB CRO CR2 CR3 sr2 PA PB PC PD PF MKH MKL ANM SMH EOM TMM sr3 ETMO ETM1 sr4 ECNT ECPT rp SP B D H 1 D H EA rp2 SP B D H EA rp3 B D H f CY HC Z irf NMINote FT1 F1 F2 FEO FE1 FEIN FAD FSR FST ER OV AN5 AN6 AN7 SB Note NMI can also be written as FNMI 220 CHAPTER 14 INSTRUCTION SET Examples 1 MOV rl A Operation code 0 0 0 1 1 T2 Ti To If the E register is selected as r1 the instruction is written as shown below The part after the semicolon is a comment and has no effect on the operation of the instruction The corresponding operation code is shown below Operation code 0 0 0 1 1 1 0 1 DCX rp Operation code 0 0 Pi 1 1 If the HL register pair selected as
231. input output specification for port C when in port mode Memory mapping register Performs port expansion mode specification for port D and port F Mode F register Performs bit wise input output specification for port F when in port mode Timer mode register Specifies timer operating mode Timer event counter mode Specifies timer event counter operating mode register Timer event counter output Controls COO and output level mode register Serial mode register Specifies serial interface operating mode Interrupt mask register Specifies interrupt request enable disable A D channel mode register Specifies A D converter operating mode Zero cross mode register Specifies zero cross detector operation 41 CHAPTER 3 INTERNAL BLOCK FUNCTIOS 3 3 Arithmetic Logical Unit ALU The ALU executes data processing such as 8 bit arithmetic and logical operations shift and rotation data processing such as 16 bit arithmetic and logical operations and shift operations 8 bit multiplication and 16 bit by 8 bit division 3 4 Program Status Word PSW This word consists of 6 types of flags which are set reset according to instruction execution results Three of these flags Z HC and CY can be tested by an instruction PSW contents are automatically saved to the stack when an interrupt external internal SOFTI instruction is generated and restored by the RETI in
232. is low or when in the hardware STOP mode WR become high impedance Remark In a data write to internal RAM WR is driven high 2 1 7 RD Read strobe 3 state output The strobe signal output for a read operation on external memory This pin is driven high except in external memory data read machine cycles When the RESET signal is low or when in the hardware STOP mode RD become high impedance Remark a data read from internal ROM or RAM RD is driven high 2 1 8 ALE Address latch enable 3 state output The strobe signal which externally latches the lower address information output to pins PD7 to PDO for an access to external memory When the RESET signal is low or when in the hardware STOP mode ALE is high impedance Caution ALE output continues while the CPU is operating Therefore address latching by ALE is effective external access machine cycles 27 CHAPTER 2 PIN FUNCTIONS 2 1 9 MODEO MODE1 Mode Input output B uPD78C18 78C14 78C14A 78C12A 78C11A The MODEO pin is set to 0 low level and the MODE1 pin is set to 1 high level via a pull up resistor The pull up resistor R is 4 KO 0 4 tcvc tcvc unit is ns When the MODEO pin is set to 0 low level and the MODE is 1 high level on chip ROM is not accessed and these pins are functioned in the same way as those of the uPD78C17 78C10A uPD78C17 78C10A The size of the externally installed memory can b
233. is possible on returning from the interrupt service routine to determine whether the next instruction is one which should be given a stacking effect Using stacked MVI instructions a program which clears a 4 byte register located in a specific area of memory in this case with 10H as the upper address byte can be written as shown below 8 9 A B C D E F 0 1 2 3 4 5 6 7 CLX MVI L OOH CLEAR X REG CLY MVI L 04H CLEAR Y REG CLZ MVI L 08H CLEAR Z REG CLW MVI 1 OCH CLEAR W REG MVI H 40H MVI C 3 SET COUNTER XRA A A CLEAR A LOOP STAX H HL 0 HL lt HL 1 DCR C SKIP IF BORROW JR LOOP RET When CLY is called for example 04H is loaded into the L register and the two stacked instructions MVI L 08H and MVI L OCH are replaced with an idle cycle NOP cycle comprising a total of 14 states the upper byte of the address is determined by the next MVI H 40H instruction and the Y REG start address 4004H is loaded into the HL register pair 326 CHAPTER 15 OPERATING PRECAUTIONS Be sure to read the following before using an 87AD series CMOS products 15 1 RAE Bit Setting e Target products Details All products When using on chip memory be sure to set the MM register RAE bit to 1 If it is not the on chip memory cannot be used Also when using the on chip RAM for stack be sure to set the RAE bit to 1 before entering interrupt enable and subroutine call Initia
234. is register consists of 11 interrupt request flags which are set by the different interrupt requests A flag is reset when an interrupt request is acknowledged or a skip instruction SKIT or SKNIT is executed RESET input resets all flags The interrupt request flags are not affected by the interrupt mask register e Set 1 by a falling edge input to the NMI pin Unlike other interrupt request flags this flag cannot be tested by a skipinstruction However the status of the NMI pin can be tested see 6 Test flag register e Set 1 by TIMERO match signal e INTFT1 Set 1 by TIMER1 match signal e Set 1 by a rising edge input to the INT1 pin NTF2 Set 1 by a falling edge input to the INT2 pin e NTFEO Set 1 when timer event counter ECNT and ETMO register contents match e INTFE1 Set 1 when timer event counter ECNT and ETM1 register contents match e Set 1 by a falling edge of the timer event countr input CI input or timer output TO 154 CHAPTER 9 INTERRUPT CONTROL FUNCTIONS e INTFAD Set 1 when A D converter conversion values are transferred to the four registers CRO to CR3 e NTFSR Set 1 when the serial interface receive buffer becomes full INTFST Set 1 when the serial interface transmit buffer becomes empty 2 Mask register This is a 10 bit mask register which handles all interrupt requests except non maskable inte
235. is started in accordance with the written contents Therefore when the INTAD flag is set again the post change result is stored in the CR registers CRO to CR3 140 CHAPTER 8 ANALOG DIGITAL CONVERTER FUNCTIONS Figure 8 2 A D Channel Mode Register Format 7 6 5 4 3 2 1 0 wow D pompe ons Operating mode specification Scan mode Select mode Select mode Scan mode ANO AN3 192 states AN4 AN7 144 states 141 CHAPTER 8 ANALOG DIGITAL CONVERTER FUNCTIONS 8 3 Analog Digital Converter Operation Either the scan mode or select mode can be specified for the A D converter by means of the MS bit of the A D channel mode register ANM 8 3 1 Scan mode In the scan mode as shown in Figure 8 3 the A D channel mode register ANM specifies either analog inputs to ANI2 0 or analog inputs AN4 to ANI2 1 Remark Each of the analog inputs AN4 to has a function for detecting a falling edge and setting a test flag which is unrelated to A D conversion operations see 9 2 External Interrupt Sampling Figure 8 3 A D Channel Mode Register in Scan Mode 7 6 5 4 3 2 1 0 ow foe D Scan mode Analog input specification AN4 AN7 Conversion speed 192 states 144 states When the ANI2 bit of the A D channel mode register is set to 0 analog inputs are selected in the order
236. ission reception character length clock rate number of stop bits odd even parity serial clock are set in the serial mode registers Figure 7 11 Serial Mode Register Setting Clock rate 16 Character length 8 bits Parity Enabled Odd even parity Even parity Number of stop bits 2 bits 7 6 5 4 3 2 1 0 Serial clock Internal clock TO output 128 CHAPTER 7 SERIAL INTERFACE FUNCTIONS lt b gt Since the timer TO output is being used as the serial clock SCK setting of the timer count value and timer operation is performed As an oscillator frequency of 11 0592 MHz data transfer rate of 110 bps and clock rate of 16 are used here the count value is found from Table 7 1 or the following expression to be 262 _ fxx C fx Oscillator frequency N Clock rate Data transfer rate 00 C Count value Since the count value is greater than 255 TIMERO and TIMER are cascaded 131 83H is set in timer register 2 02H in TM1 Since TIMERO and TIMER 1 are cascaded the timer mode register TMM settings are as shown in Figure 7 12 Figure 7 12 Timer Mode Register Setting 7 6 5 4 3 2 1 0 1 match signal as timer F F input TIMERO count input 12 TIMERO count up TIMERO match signal as TIMER1 count input
237. itialization when the Cl input falls the value of the free running ECNT the value at the time of the Cl input fall is latched in the ECPT TIMER EVENT COUNTER CAPTURE REG and an internal interrupt INTEIN is generated The operation flow for the servicing of this interrupt is shown below EINSV Count value setting Timer event counter mode setting lt b gt Interrupt mask register setting see RETI 102 CHAPTER 6 TIMER EVENT COUNTER FUNCTIONS a 100 us after the fall of the Cl input a pulse with a width of 200 us is output to the COO pin and thus the value obtained by adding 0064H 100 us to the ECPT value is set in ETMO and the value obtained by adding 012CH 300 us to the ECPT value is set in ETM1 at 12 MHz operation b COO output timing is specified by setting the timer event counter mode register ETMM to a match between ECNT ETMO or between and The ECNT input clock and ECNT clear mode are kept as they are LVO of the output control circuit is set and L VO level inversion enabled by setting the timer event counter output mode register EOM Figure 6 24 Timer Event Counter Mode Register Setting Single Pulse Output COO Output Timing Setting 5 4 3 2 1 0 1 7 6 mw TS T CEST TIS ECNT input clock Internal clock 012 ECNT clear mode Free running COO output timing Match between ECNT and ETMO or match between ECNT and ETM1
238. its Skips if a borrow is generated as a result of the subtraction V wa byte 5 Flags affected Z SK HC L1 lt 0 10 0 CY 291 CHAPTER 14 INSTRUCTION SET NEIW wa byte Not Equal Immediate with Working Register 1 Operation code 10 1 1 0 0 1 0 1 2 Number of bytes 3 3 Number of states 13 10 4 Function i V wa byte Skip if no zero Subtracts the immediate data in the 3rd byte from the contents of the working register addressed by the V register high order 8 bits and the immediate data in the 2nd byte low order 8 bits and skips if the result of the subtraction is not zero V wa zbyte 5 Flags affected Z SK HC L1 e 0 LO 0 CY EOIW wa byte Equal Immediate with Working Register 1 Operation code 10 1 1 1 0 1 0 1 2 Number of bytes 3 3 Number of states 13 10 4 Function V wa byte Skip if zero Subtracts the immediate data in the 3rd byte from the contents of the working register addressed by the V register high order 8 bits and the immediate data in the 2nd byte low order 8 bits and skips if the result of the subtraction is zero V wa byte 5 Flags affected Z SK HC L1 lt 0 LO 0 CY ONIW wa byte On Test Immediate with Working Register 1 Operation code 10 1 0 0 0 1 0 1 2 Number of bytes 3 3 Number of states 13 10 4 Function V wa A byte Skip if no zero Obtains the
239. l masked Check nonmasked INTFx 2 or more Number of flags set Y Next instruction Check Highest priority interrupt Same level interrupts both non maskable Y Reset INTFx Save PSW amp PC to stack memory PC lt interrupt address 161 CHAPTER 9 INTERRUPT CONTROL FUNCTIONS When execution of the interrupt service routine ends processing is performed to return to the address at which the interrupt was acknowledged First registers flags etc other than the PSW which have been save are restored and if necessary the IE F F is set by the El instruction Next the RETI instruction is used to restore the previously saved return address and PSW in the order Lower PC byte upper PC byte PSW Since interrupt servicing is performed for non maskable interrupts irrespective of the status of the IE F F they are useful for program processing in the event of an emergency such as a power failure The configuration of the NMI is shown in Figure 9 5 Although INTFNMI cannot be tested by a skip instruction the NMI pin status can be tested by a skip instruction SKIT NMI or SKNIT NMI Thus in the non maskable interrupt service routine relatively wide noise can be removed by testing the NMI pin status several times using a skip instruction The NMI pin status is not changed when tested by a skip instruction Caution ThelE F F is reset unconditionally when a non maskab
240. l device is accessed using the RD WR and ALE signals with pins PD7 to PDO functioning as a multiplexed address data bus AD7 to ADO and pins PF7 to PFO as an address bus AB15 to AB8 When accessing 4 or 16K byte area external device pins PF7 to PFO which are not used as address lines can be used as general purpose input output port pins The size of the external address space is determined by the setting of the MODEO and MODE1 pins 198 CHAPTER 11 EXTERNAL DEVICE ACCESSES AND TIMINGS 11 2 1 MM register setting The low order bits of the uPD78C17 78C10A MM register should be set 0 The RAE bit controls enabling and disabling of on chip RAM accesses When on chip RAM is not used and that area is used by externally connected memory the RAE bit should be set to 0 to disable on chip RAM accesses In normal operation the RAE bit retains its current value when RESET signal is input However the RAE bit is undefined after a power on reset and must therefore be initialized by an instruction Figure 11 10 MM Register Format uPD78C17 78C10A 7 6 5 4 3 2 1 0 Disable Enable Figure 11 11 4PD78C17 Address Space 4 access 16K byte access 63K byte access External device External device External device FCOOH On chip RAM On chip RAM On chip RAM FFFFH N 4 0 1 1 1 0 MODE1 0 MODE 1 199 CHAPTER 1
241. l is high for at least 12 states after first returning to the low level INT2 input This is the falling edge active maskable interrupt input Except for having the opposite active state its functions are the same as those of the INT1 input AN7 to AN4 inputs A falling edge is detected by the same method as for the INT2 input and the test flag is set AN7 to AN4 of the test flag register These flags can be tested by an instruction SKIT or SKNIT and are automatically reset when tested In setting a testable flag again the criterion for detection is a low level input signal for a duration of at least 12 states after first returning to the high level CHAPTER 9 INTERRUPT CONTROL FUNCTIONS Figure 9 3 Interrupt Sampling Sampling pulses INT2 Valid AN7 5 INT1 INTF1 2 AN7 AN4 As can be seen from the above diagram INT1 INT2 and AN7 to AN4 are determined to be correct interrupt signals when the active level is detected in or more 012 0 8 at 15 MHz operation cycle sampling pulses Therefore noise signals of 8 states 1 6 us at 15 MHz operation or shorter duration are eliminated and the interrupt request flag is properly set by a high level or low level input of at least 12 states 2 4 us at 15 MHz operation 159 CHAPTER 9 INTERRUPT CONTROL FUNCTIONS 9 3 Non Maskable Interrupt Operation When the INTFNMI interrupt request flag is set by a falling edge input to the NMI pin
242. l pulses input to the pin dual function as PC5 are counted After first clearing ECNT the external even count is performed by setting the data shown in Figure 6 8 in the timer event counter mode register Figure 6 8 Timer Event Counter Mode Register Setting Event Counter Mode 0 7 6 5 4 3 2 1 ema os Cl input count Free running cleared after full count External pulses input to the pin are synchronized with the internal clock ECNT counts up on their falling edge The pulse width of the pulses input to the Cl pin must be at least 500 ns at 12 MHz operation pulses of 250 ns or less in width are regarded as noise signals and are not counted The count value can be read at any time by software When the timer event counter mode register is set as shown in Figure 6 8 if ECNT counts up to FFFFH the OV Overflow flag is set and the count starts again from 0000 The OV flag does not have an interrupt function but can be tested in the program by means of a skip instruction SKIT or SKNIT When the external event count reaches the value set in 1 and internal interrupt INTEO INTE1 is generated Figure 6 9 Event Counter Mode Operation Internal clock Cl input Internal signal A 1 ECNT input 92 CHAPTER 6 TIMER EVENT COUNTER FUNCTIONS 6 3 3 Frequency measurement mode In this mode the frequency of the external pulses input to
243. le interrupt is generated and the contents of the IE F F prior to the non maskable interrupt are not saved Therefore when returning to the main routine the original status of the IE F F should be determined by means of the stack address when the non maskable interrupt was generated Figure 9 5 Internal Configuration of NMI Pin c E o NMI Zog Los Non maskable interrupt request Non maskable interrupt acknowledgment Test control 78 18 162 CHAPTER 9 INTERRUPT CONTROL FUNCTIONS 9 4 Maskable Interrupt Operation Interrupt requests except non maskable interrupts and the SOFTI instruction are maskable interrupts which be enabled disabled F F set reset by the EI DI instructions and can be masked individually by means of the mask register When an external maskable interrupt is recognized as a normal interrupt signal by an active level input for more than the specified time an interrupt request flag is set If an internal interrupt request is generated an interrupt request flag is immediately set Once the interrupt request flag is set both the external and internal interrupts are serviced using the following procedure see Figure 9 3 Interrupt Sampling In the El state IE F F 1 a check is made to see if the interrupt request flag has been set at the end checked at end of each instruction If the flag has been set the interrupt cycle starts However interr
244. lemented in this product Specif M7 94 11 Intended Readership Purpose Organization Using This Information INTRODUCTION This manual is intended for engineers who require an understanding of 87AD series products functions prior to designing an application system or an application program The relevant products are the following 87AD series CMOS version products uPD78C10A 78 11 78C10A A 78C11A A uPD78C12A 78C12A A 78 14 78C14A 78CG14 78CP14 78C14 A 78CP14 A 78 17 78C18 78CP18 78C17 A 78C18 A 78CP18 A Remark PD78C10 78C11 78C10 A 78C11 A have been maintenance products since October 1991 The purposes of this manual is that users understand the hardware functions of 87AD series products shown in the organization below This manual is mainly composed of the following contents General description e Pin functions nternal block functions nterrupt control functions e m xternal device accesses and timing e 0 ROM accesses nstruction set Operating precautions Use of this information requires general knowledge of electricity logic circuits and microcontrollers This manual describes the uPD78C18 as a representative product as long as there no differences in the functions Using this manual as the other 87AD series CMOS products manual refer to the manual by changing uPD78C18 to each product name For the uPD78CG14 referto AP
245. lization Example 1 CSEG AT 00 GJMP START Branches to initial routine LXI SP xxxx Stack pointer setting MVI MOV MM A Initialization Example 2 Bad example CSEG AT 00 GJMP START Branches to initial routine LXI SP xxxx Stack pointer setting CALL INIT MVI MOV MM A In a state in which the RAE bit is not set the on chip RAM cannot be used In addition the RAE bit is indefinite when reset is cleared The indefinite condition varies with a power source voltage rising condition unevenness between product lots difference between masked PROM and on chip PROM etc Therefore in Initialization Example 2 above the RAE bit is indefinite when the INIT routine is called In case the RAE bit is reset stack cannot be used when the INIT routine branches This will result in an inadvertent running due to incapability in normal restore from the INIT routine 327 CHAPTER 15 OPERATING PRECAUTIONS Even when the RAE bit is set and operates normally an abnormality will result due to power source voltage rising condition unevenness between product lots difference between masked PROM and on chip PROM etc Remedy As shown in Initialization Example 1 set the stack pointer and MM register before interrupt enable and subroutine call to enable the use of on chip RAM 15 2 Port D F Setting e Target products All products Details program to dynamically change the por
246. lt of the subtraction is not zero r 5 Flags affected Z SK HC 11 lt 0 LO lt 0 CY 6 Example NEA C A SKIP IF C A If C A the CY flag is set if C 2 A the Z flag is set EQA A r Equal Register with A 1 Operation code 10 1 1 0 0 0 0 1 1 1 1 1 Ri Ro 2 Number of bytes 2 3 Number of states 8 8 4 Function Skip if zero Subtracts the contents of the register r V A B C D E H L specified by R2R1Ro 0 to 7 from the contents of the accumulator Skips if the result of the subtraction is zero A r 5 Flags affected Z SK HC L1 lt 0 LO 0 CY 6 Example D SKIP IF A D 261 CHAPTER 14 INSTRUCTION SET Equal A with Register 1 Operationcode 10 1 1 0 0 0 0 0 0 1 1 1 1 Ri Ro 2 Number of bytes 2 3 Number of states 8 8 4 Function Skip if zero Subtracts the contents of the accumulator from the contents of the register r V A B C D E H L specified by R2RiRo 0 to 7 Skips if the result of the subtraction is zero r A 5 Flags affected Z SK L1 lt 0 LO 0 6 Example E A SKIPIFE A On Test Register with 1 Operation code O 1 1 0 0 0 0 1 1 0 0 1 R2 Ri Ro 2 Number of bytes 2 3 Number of states 8 8 4 Function 3 A r Skip if no zero Obtains the logical product of the conte
247. lt 3 gt Number of states 14 11 lt 4 gt Function lt A V wa Subtracts the contents of the working register addressed by the V register high order 8 bits and the immediate data in the 3rd byte low order 8 bits from the contents of the accumulator and stores the result in the accumulator lt 5 gt Flags affected 12 5 lt 0 HC L1 amp 0 LO 0 SBBW wa Subtract Working Register from A with Borrow 1 Operation code O 1 1 1 0 1 0 1 1 1 1 00 0 2 Number of bytes 3 3 Number of states 14 11 4 Function DA A V wa CY Subtracts the contents of the working register addressed by the V register high order 8 bits and the e immediate data in the 3rd byte low order 8 bits including the CY flag from the contents of the accumulator and stores the result in the accumulator 5 Flags affected Z SK 0 L1 amp 0 LO 0 286 CHAPTER 14 INSTRUCTION SET SUBNBW wa Subtract Working Register from A Skip if No Borrow 1 Operation code 10 1 1 1 0 1 0 0 1 0 1 10000 lt 2 gt Number of bytes 3 lt 3 gt Number of states 14 11 lt 4 gt Function lt Skip if no borrow Subtracts the contents of the working register addressed by the V register high order 8 bits and the immediate data in the 3rd byte low order 8 bits from the contents of the accumulator and stores the result in the accumulator Skips if no borrow is genera
248. mediate data in the 3rd byte from the contents of the special register sr2 PA PB PC PD PF MKH MKL ANM SMH EOM TMM specified by 53525150 0 to 3 5 to 9 B D and stores the result in the specified special register 5 Flags affected Z SK 0 HC L1 0 LO 0 CY 273 CHAPTER 14 INSTRUCTION SET SBI A byte Subtract Immediate from A with Borrow 1 Operation code 10 1 1 1 0 1 1 0 2 Number of bytes 2 3 Number of states 7 7 4 Function A A byte CY Subtracts the immediate data in the 2nd byte including the CY flag from the contents of the accumulator and stores the result in the accumulator 5 Flags affected Z SK lt 0 L1 lt 0 LO lt 0 CY 6 Example SBI A lt A 30H CY This example subtracts 30H from A including the CY flag SBI r byte Subtract Immediate from Register with Borrow 1 Operation code O 1 1 1 0 1 0 0 O 1 1 1 0 R2 Ri 2 Number of bytes 3 3 Number of states 11 11 4 Function r r byte CY Subtracts the immediate data in the 3rd byte including the CY flag from the contents of the register r V A B C D E H L specified by R2R1Ro 0 to 7 and stores the result in the specified register 5 Flags affected Z SK lt 0 L1 0 LO lt 0 SBI sr2 byte Subtract Immediate from Special Register with Borrow 1 Operation code 0 1 1 0 0 1 0 0 53 1 1 1 0 52 1 5
249. mode must not be used when an external clock is input 174 CHAPTER 10 CONTROL FUNCTIONS 10 1 4 Software STOP mode release 1 Release by RESET signal When the RESET signal changes from the high to low level in the software STOP mode the software STOP mode is released and clock oscillation starts as soon as the reset state is set When the RESET signal is driven high after oscillation has stabilized the CPU starts program execution at address 0 When the RESET signal changes from the high to low level clock oscillation starts but it takes time for oscillation to stabilize The RESET signal low level width must therefore be longer than the oscillation stabilization time When the RESET signal is input the RAM contents are retained but the contents of other registers are indeterminate Figure 10 4 Software STOP Mode Release Timing RESET Signal Input Execution of address 0 CPU instruction operation OSC _ RESET If the software STOP mode is released by the RESET signal program execution starts at address 0 as in the case of anormal power on reset The SB Standby flag can be used to identify the program execution mode The SB flag is set 1 when the pin rises from the specified low level or below to the specified high level or above and is reset 0 by executing skip instruction Thus testing the SB flag using a skip instruction in the program executed after RESET inp
250. n from the interrupt service routine for an external interrupt NMI INT1 INT2 an internal interrupt timer serial transfer etc or a SOFTI instruction interrupt lt 5 gt Flags affected SK L1 LO 320 CHAPTER 14 INSTRUCTION SET 14 6 15 Skip instructions BIT bit wa Bit Test Working Register 1 Operation code 10 1 0 1 1 B2 Bi Bo 2 Number of bytes 2 3 Number of states 10 7 4 Function Skip if bit on Skips if the bit specified by B2B1Bo 0 to 7 of the working register addressed by the V register high order 8 bits and the immediate data in the 2nd byte low order 8 bits is 1 5 Flags affected SK L1 0 L0 0 6 Example When the contents of address 10FOH MVI V 40H BIT 3 42 RET Working register 7 65543210 40FOH 010 1 1 0 1 0 In this example since the specified bit of the specified address is 1 the JR instruction is skipped and the RET instruction is performed SK f Skip if Flag 1 Operation code 10 1 0 0 1 0 0 0 2 Number of bytes 2 3 Number of states 8 8 lt 4 gt Function Skip if f 1 Skips if flag f CY HC Z specified by FzF Fo 2 to 4 is set to 1 5 Flags affected SK L1 0 L0 0 321 CHAPTER 14 INSTRUCTION SET SKN f Skip if No Flag 1 Operation code 10 1 0 0 1 0 0 0 0 0 0 1 1 Fi Fo 2 Number of bytes 2 3 Number o
251. ne communication etc Home electric appliances Air conditioner VCRs etc sc C Ote Susie erbe eer eed dd Electronic musical instrument POS Point of sales terminal inverter electronic sewing machine auto focus cameras etc The Special Products e Automobile Automobile electronic equipment fuel control CHAPTER 1 GENERAL DESCRIPTION 1 1 Features 159 types of instructions Multiplication division instructions 16 bit operation instructions possible Minimum instruction execution time 0 8 us at 15 MHz operation ROM capacity e 32768 x 8 bits uPD78C18 78CP18Note 1 e 16384 x 8 bits uPD78C14 78C14A 78CP14Note 1 e 8192 x 8 bits uPD78C12A e 4096 x 8 bits uPD78C114 ROM less uPD78C17 78C10A RAM capacityNote 2 e 1024 x 8 bits uPD78C18 78CP18 78C17 256 x 8 bits uPD78C14 78C14A 78CP14 78C12A 78C1 1A 78C10A 8 bit resolution A D converter 8 channels General purpose serial interface e Asynchronous mode Synchronous mode e O interface mode 16 bit timer event counter e 1 channel 8 bit timer e 2 channels nterrupt functions 3 external 8 internal e Non maskable interrupt 1 e Mlaskable interrupts 10 e 6 priority levels 6 interrupt addresses Notes 1 4PD78CP18 78CP14 have on chip one time PROM or EPROM 2 On chip RAM can only be used when the RAE bit of the MM register i
252. njunction with the IE 78C11 M EV 9200G 64 64 pin WOFN socket Can be used in conjunction with the 78 14 78CP18KB by which 64 pin plastic products with window are superseded Software IE 78C11 M control Connects the IE 78C11 M to the host machine via RS 232 C and controls the IE program IE controller 78C11 M on the host machine Host Ordering code machine OS Supply medium Product name MS DOS 3 5 inch 2HD 55 131 78 11 Ver 2 11 PC 9800 series i 5 inch 2 55 101 78 11 Ver 3 30D IBM PC AT Po DOS 5 inch 2 uS7B101E78C11 Ver 3 1 Remark Operation of IE controller is guaranteed only on the host machines and operating systems quoted above Related Documents e Hardware tools IE 78C11 Control Program User s Manual EEU 1368 e Software tools RA87 Assembler Package User s Manual PC 9800 Series MS DOS Based IBM PC PC DOS Based EEM 1202 Macro Processor User s Manual 1041 351 MEMO 352 APPENDIX C INDEX OF INSTRUCTIONS ALPHABETICAL ORDER Instruction A byte r byte sr2 byte A wa A r rA A r wa wa rpa A byte r byte sr2 byte A byte r byte sr2 byte A r r wa rpa A byte r byte sr2 byte wa byte Instruction CALL CALT CLC D DAA DADC DADD DADDNC DAN DCR DCRW DCX DCX DEQ DGT DI V LT MOV MOV MOV MOV
253. no borrow Subtracts the contents of the register V A B C D E H L specified by R2R Ro 0 to 7 and 1 from the contents of the accumulator Skips if no borrow is generated as a result of the subtraction A r 5 Flags affected Z SK HC L1 lt 0 LO 0 CY 6 Example GTA A B A B 1 A skip is performed if A 15 greater than Greater Than A 1 Operation code 10 1 1 0 0 0 0 0 0 0 1 0 1 Ri Ro lt 2 gt Number of bytes 2 3 Number of states 8 8 lt 4 gt Function 1 lt Skip if no borrow Subtracts the contents of the accumulator and 1 from the contents of the register r V A B C D E H L specified by R2R Ro 0 to 7 Skips if no borrow is generated as a result of the subtraction r gt lt 5 gt Flags affected Z SK HC L1 0 LO 0 6 Example GTA B A B A 1 A skip is performed if B is greater than A 259 CHAPTER 14 INSTRUCTION SET LTA A r Less Than Register 1 Operation code 10 1 1 0 0 0 0 0 1 0 1 1 1 R2 Ri Ro 2 Number of bytes 2 3 Number of states 8 8 4 Function Skip if borrow Subtracts the contents of the register r V A B C D E H L specified by R2R Ro to 7 from the contents of the accumulator Skips if a borrow is generated as a result of the subtraction A r 5 Flags affected Z SK HC L1 lt 0 LO 0 CY 6 Example 5 LTA A L A L A skip is pe
254. ns from the routine If there have been 4 interrupts the program jumps to lt c gt The B register is the counter used to check whether 4 interrupts have been generated lt c gt As the A D conversion values are stored in memory blocks starting at address 4000H 4000H to 4003H 4008H to 400BH 4010H to 4013H and 4018H to 401BH the start address 4020H of the next block is stored in the HL register pair and in the B register The ANI2 bit of the A D channel mode register is inverted to change the input pin on which A D conversion is to be performed and a return is made from the routine When A D conversion values are stored in the memory blocks starting at 4020H 4020H to 4023H 4028H to 402BH 4030H to 4033H and 4038H to 403BH the program jumps to d The C register is the counter used to check whether or not A D conversion values have been stored in the memory blocks starting at 4020H 149 CHAPTER 8 ANALOG DIGITAL CONVERTER FUNCTIONS lt d gt lt gt lt f gt As the A D conversion values are stored in memory blocks stating at address 4020H the start address 4004H of the next block is stored in the HL register pair in the register and OOH in the C register The ANI2 bit of the A D channel mode register is inverted to change the input pin on which A D conversion is to be performed and a return is made from the routine When A D conversion values are stored in the memory blocks starting at 4004H 4
255. nts of the accumulator and the contents of the register r V A B C D E H L specified by R2R1Ro 0 to 7 Skips if the logical product is not zero 5 Flags affected Z SK 116 0 10 60 OFFA Off Test Register with A 1 Operation code 10 1 1 0 0 0 0 0 1 1 0 1 1 R2 Ri Ro 2 Number of bytes 2 3 Number of states 8 8 4 Function Skip if zero Obtains the logical product of the contents of the accumulator and the contents of the register r V A B C D E L specified by R2RiRo 0 to 7 Skips if the logical product is zero lt 5 gt Flags affected 12 5 116 0 1060 262 CHAPTER 14 INSTRUCTION SET 14 6 4 8 bit operation instructions Memory ADDX rpa Add Memory addressed by Register Pair to A 1 Operation code O 1 1 1 0 0 0 0 1 1 0 0 0 Ai Ao 2 Number of bytes 2 3 Number of states 11 8 4 Function A Adds the contents of the memory addressed by the register pair roa BC DE HL DE HL DE HL specified by A2A1Ao 1 to 7 to the contents of the accumulator and stores the result in the accumulator 5 Flags affected Z SK lt 0 L1 0 LO 0 6 Example MOV A 4000H lt 4000H LXI H 4200H HL lt 4200H ADDX H A lt A HL This example adds together the contents of address 4000H and address 4200H ADCX rpa Add Memory addressed by Register Pair to A with Ca
256. o not connect it to the gland pattern where there is a high current Do not pick up the signal from the oscillator 182 CHAPTER 10 CONTROL FUNCTIONS Figure 10 13 Examples of Poor Resonator Connection Circuit a Long Connection Circuit Wiring 78 18 c Signal Line Close to Varying High Current 78 18 High current e Signal is Picked Up 78 18 b Crossed Signal Lines PAn 78 18 2 Vss d Current Flows an Oscillator Ground Line Potentials at A B and C fluctuate 78 18 183 CHAPTER 10 CONTROL FUNCTIONS The wiring should also be kept as short as possible when an external clock is input to prevent the effects of extraneous electromagnetic wave radiation or external noise When the hardware software STOP mode is entered the X1 and X2 pin levels are fixed Therefore the hardware software STOP mode should not be used when an external clock is used When the hardware software STOP mode is used a crystal or ceramic resonator should be used When the device is powered on and when returning from the hardware software STOP mode sufficient time must be allowed for the oscillation to stabilize The time required for oscillation stabilization is several ms when a crystal is used and several hundred us when a ceramic resonator is used An adequate oscillation stabilization period s
257. oads the 0060H into the program counter and jumps to address 0060H 5 Flags affected 6 Example 7 NOTE 318 SK 0 L1 0 L0 0 When a SOFTI instruction is executed at address 500 500 SOFTI 501 502 Memory SP 3 5 2 SP 1 0 Z SK HC L1 LO O CY 500 01F4H The following functional difference between the 87 87AD series should be noted The uCOM 87 SOFTI instruction saves the address of the SOFTI instruction itself to the stack memory whereas the address saved to the stack memory by the 87AD series SOFTI instruction is the start address of the next instruction Even if the skip condition is satisfied by execution of the instruction arithmetic or logical operation increment decrement skip or RETS instruction immediately preceding the SOFTI instruction the SOFTI is executed not skipped see 9 4 Maskable Interrupt Operation CHAPTER 14 INSTRUCTION SET 14 6 14 Return instructions RET Return from Subroutine 1 Operation code L0 3d 151 9 0 0 2 Number of bytes 1 3 Number of states 10 4 4 Function PC7 0 lt SP 15 lt SP 1 SP lt 5 2 Restores the contents of the stack memory addressed by the SP to the low order 8 bits PC7 0 of the program counter and restores the contents of the stack memory addressed by SP 1 to the high order 8 bits PC1s 8 lt 5 gt Flags affected SK 0 L1 0 L0 0
258. of the program counter loads the contents of the C register into the low order 8 bits PC7 0 and jumps to the address indicated by the BC register pair An effective method is for example to jump using the JB instruction after loading address information into BC by means of the TABLE instruction 5 Flags affected SK lt 0 11 lt 0 10 0 313 CHAPTER 14 INSTRUCTION SET JR word Jump Relative 1 Operation code jdisp1 lt 2 gt Number of bytes 1 3 Number of states 10 4 4 Function i lt PC 1 jdisp1 Jumps the address obtained by adding the 6 bit displacement value jdisp1 to the start address of the next instruction jdisp1 is handled as signed two s complement data 32 to 31 with bit 5 as the sign bit 15 0 15 654 0 ___5 jdisp1 15 0 Jump address When 5 0 X All O s When 5 1 X All 1 s A jump destination address or label which takes account of the jump range should be directly written as the operand of the JR instruction Thus when a JR instruction is executed at address 1000 for example the possible jump range is from address 969 to address 1032 lt 5 gt Flags affected SK 0 L1 0 L0 0 6 Example i CLWR LXI D 2000H DE 2000H MVI C 7 C27 LOOP COUNTER CLEAR A 98LOOP STAX D DE 0 DE DE 1 99 DCR C C 1 SKIP IF BORROW 100 JR LOOP JUMP TO LOOP RET The loop is executed repea
259. on A rpa 5 Flags affected Z SK HC L1 lt 0 LO 0 CY 6 Example LXI D 4000 DE lt 4000H LXI H 1100H HL lt 4100H LDAX D A lt 4000H LTAX A HL H A HL JMP KORED Memory 4000H 20H 4100H 30H In this example since the contents of A contents of address 4000H 20H are less than the memory contents addressed by the HL register pair contents of address 4100H 30H the LDAX instruction is skipped and the JMP instruction is executed The CY SK and HC flags are set as a result of this subtraction NEAX rpa Not Equal Memory addressed by Register Pair with A 1 Operation code 10 1 1 1 0 0 0 0 lt 2 gt Number of bytes 2 lt 3 gt Number of states 11 8 lt 4 gt Function lt Skip if no zero Subtracts the contents of the memory addressed by the register pair DE DE HL DE HL specified by A2A1Ao 1 to 7 from the contents of the accumulator Skips if the result of the subtraction is no zero lt 5 gt Flags affected Z SK HC L1 0 LO lt 0 CY lt 6 gt Example NEAX B SKIP IF A z BC 268 CHAPTER 14 INSTRUCTION SET EQAX rpa Equal Memory addressed by Register Pair with A 1 Operation code 10 1 1 1 0 0 0 0 1 1 1 1 1 A Ao 2 Number of bytes 2 3 Number of states 11 8 4 Function A rpa Skip if zero Subtracts the contents of the memory
260. on as an output port Therefore all ones should be written to the PA7 to PA4 output latches before specification as an output port 78 18 7 gt 1 Active low output _ PA4 1 63 CHAPTER 4 PORT FUNCTIONS PA Input Output PA Output Latch PA Pin 76543210 76543210 76543210 RESET MA OFFH 11111111 1111 Ov By pull up resistor MVI PA OFOH 11110000 1111 SNNT By pull up resistor MVI A OFH Y MOV 0 00001 179 11110000 1111xxxx i i MVI PA OEFH 11101111 1110 vel MOV A PA A 11101010 Y 117101711 11101010 Te E Input data Pin input data Output latch contents Note Input O Output 64 CHAPTER 4 PORT FUNCTIONS 4 2 Port B PB7 to PBO Like port A port B is an 8 bit input output port with input output buffer and output latch functions see Figure 4 1 Port can be set as an input or output port bit wise using the mode register MB When set to input the pins become high impedance When the corresponding bit of the mode B register is set 1 a port B pin functions as an input port pin and when reset 0 as an output port pin see Figure 4 5 When RESET is input or the hardware STOP mode is set all bits of the mode B register are set and port B functions as an input port high impedance In the uPD78C18 78C1
261. ontrol C register regardless of the mode C register setting When the PCn pin is used for a control signal MCCn 1 the control signal status is ascertained by execution of a port C read instruction or test instruction a When PCn is control signal output When MCn 1 the status of the PCn pin control signal can be read into an accumulator or tested by executing a port C read instruction or test instruction When MCn 0 the internal control signal status can be read into an accumulator or tested by executing a port C read instruction or test instruction see Figure 4 8 67 CHAPTER 4 PORT FUNCTIONS 68 Figure 4 8 Port C Specified as Control Signal Output Control PC Control signal output signal gt Internal bus b When PCn is control signal input 5 When MCn 1 the status of the PCn pin control signal can be read into an accumulator by a port read instruction or tested by a port C test instruction Figure 4 9 Port C Specified as Control Signal Input lt PC Control signal output 1 Internal Y bus Cautions 1 When MCC3 is rewritten INTF2 may be set After rewriting INTF2 should be reset by the SKIT instruction 2 When TO PC4 COO PC6 and CO1 PC7 are used as active low signal outputs the following manipulation is required Since port C is entirely set as an input port high impedance in its initial status after a reset TO COO and CO1 used a
262. ory 48896 x 8 bit 0018H INTEO INTE1 0020H INTEIN INTAD FEFFH INTSR INTST FFOOH On chip 256 x 8 01 8 0028H 5 WY FFFFH 3FFFH Note Can only be used when the RAE bit of the MM register is 1 User s area 0060H SOFT 0080H LOW ADRS 0081H HIGH ADRS 7 0082H LOW ADRS t 1 0083H HIGH ADRS 75 LOW ADRS HIGH ADRS CHAPTER 3 INTERNAL BLOCK FUNCTIONS Figure 3 11 Memory Map uPD78C12A Mode 0000H 0000H On chip EPROM 0004H 8192 x 8 bit 0008H INTTO INTT1 1FFFH 2000H 0010H 2 External memory 57088 x 8 bit 0018H INTEO INTE1 0020H INTEIN INTAD FEFFH FFOOH 4 Note 0028H INTSR INTST FFFFH 0060H SOFT 0080H LOW ADRS 0081 HIGH ADRS i 0082H LOW ADRS t 1 5 0083H HIGH ADRS 5 O LOW ADRS HIGH ADRS User s area 1FFFH Note Can only be used when the RAE bit of the MM register is 1 55 CHAPTER 3 INTERNAL BLOCK FUNCTIOS Figure 3 12 Memory Map uPD78C11A Mode 0000 0000H On chip EPROM 0004H 4096 x 8 bit 0008H INTTO INTT1 O
263. ot given to voltage level where the standby SB flag is set again after the power supply voltage subsequent to entering the software hardware STOP mode The desirable voltage is maintained in a state where 2 5 V operational voltage range Therefore the SB flag cannot be used for a test as to whether the RAM back is normal after releasing software hardware STOP mode Keep the data retention voltage Vpppr over 2 5 V by hardware in the software hardware STOP mode All products In case where a RAM is expanded externally connecting a comparatively speedy SRAM may cause large current to run in the read operation due to collision of address output signal from address data PD7 to PDO with SRAM output signal Figure 15 6 78 18 Read Operation Address Low order tLDR SRAM read cycle Data read Remark Symbols in are SRAM uPD43256A pin names To connect an SRAM insert gates etc between the RD and SRAM OE pins to give a delay to the RD active signal In this case be sure to satisfy the trp specification as given below toe tDELY lt tRD 335 CHAPTER 15 OPERATING PRECAUTIONS Sample Solution 78 18 7 04 Lead to another peripheral 15 11 Restrictions on IE 78C11 M Operation e Target products 1 78 11 Details The 78 11 uses the uPD78C10G 36 as the emulation CPU and includes defects mentioned
264. output The programmable rectangular wave output example outputs a rectangular wave from the COO pin as shown in Figure 6 16 this example the low level width is 200 and the high level width 300 us at 12 MHz operation The operation flow is shown below Timer event counter initialization Port C initialization Count value setting pd Timer event counter mode setting lt d gt Rectangular wave output to CO0 97 CHAPTER 6 TIMER EVENT COUNTER FUNCTIONS a The timer event counter ECNT is cleared and COO output is driven low To drive the COO output low LVO is reset and that level is output to COO Figure 6 17 Timer Event Counter Mode Register Setting Programmable Rectangular Wave Output ECNT Clear COO Output Reset 7 6 5 4 3 2 1 0 SIEXEXENEIZEZEEZEIEX L Clear and stop ECNT 7 6 5 4 3 2 1 0 cee eee Output of LVO contents LVO level inversion enabled LVO reset lt b gt The PC6 pin of port C is set as COO output Figure 6 18 Port C Setting Programmable Rectangular Wave Output PC6 as COO output lt c gt Todetermine the low level width and cycle of the rectangular wave to be output to the pin 00 8 low level 200 us is set in ETMO timer event counter REGO and 01F4H cycle 500 us is ETM1 at 12 MHz operation d Timer event counter operation setting is performed by the timer event counter mode register ETMM Settings are as follows
265. pins they function as digital input pins The format of the zero cross mode register ZCM which controls self bias for zero cross detection of the INT1 and INT2 TI pins is shown in Figure 3 15 Figure 3 15 Zero Cross Mode Register Format INT1 pin O No self bias generation Self bias generation INT2 TI pin O No self bias generation Self bias generation When the ZC1 and ZC2 bits of the zero cross mode register are set to to 0 a self bias for zero cross detection of each pin is not generated and each pin responds as a normal digital input When the ZC1 and ZC2 bits are set to 1 self bias is generated and AC input signal zero cross can be detected by connecting a capacitor to each pin Each pin with ZC1 and ZC2 bits set to 1 can be directly driven without the use of an external capacitor In this case each pin responds as a digital input However an input load current is necessary and an external circuit output driver must be considered Thus when no zero cross detection is executed and each pin is used simply as an interrupt input or timer input the ZC1 and ZC2 bits of the zero cross mode register should be set to 0 RESET input sets both the ZC1 and ZC2 bit to 1 and a self bias is generated When the PC3 INT2 TI pins is in port mode no self bias is generated regardless of the ZCM register setting Cautions 1 Unlike other CMOS circuits a supply current is always present in the ze
266. port output latch For input mode pins the result of the operation with the pin external status is transferred to the output latch Instruction Arithmetic operation Logical operation Comparison Match detection Test Caution 3 applies only to the arithmetic operations and logical operations in Table 4 4 Port output latch initialization should be performed by a transfer instruction MOV 73 MEMO 74 CHAPTER 5 TIMER FUNCTIONS 5 1 Timer Configuration The timer system the uPD78C18 consists of two 8 bit interval timers TIMERO and TIMER1 and a timer F F Timer operation and square wave output is controlled by the timer mode register TMM Each interval timer TIMERO and TIMER1 consists of an 8 bit upcounter 8 bit comparator and 8 bit timer REGO 1 TMO and 1 1 2 3 4 Upcounter This counts up using the input clock specified by the timer mode register TMM Timer REGO 1 0 1 These 8 bit registers used to set the interval time Comparator The comparator compares the upcounter contents with the timer REGO 1 contents and if they match clears the upcounter and generates an internal interrupt INTTO INTT1 Timer F F This F F is inverted by a TIMERO TIMER1 match signal or the internal clock The output of this timer F F can be output to the TO pin dual function as PC4 The timer F F output can be used irrespective of the
267. r uPD78CP14CW 78CP14DW 78CP18CW 78CP18DW PA 78CP14GF For uPD78CP14GF 3BE 78CP18GF 3BE PA 78CP14GO For uPD78CP14G 36 78CP14R 78CP18GO 36 PA 78CP14KB For uPD78CP14KB 78CP18KB PA 78CP14L For uPD78CP14L Software PG 1500 controller Connects PG 1500 and host machine via a serial and parallel interface and controls the PG 1500 on the host machine Host Ordering code machine OS Supply medium Product name MS DOS 3 5 inch 2HD LS5A13PG1500 Ver 3 10 PC 9800 series 1 Ver 5 00ANote BOS 3 5 inch 2HD uS7B13PG1500 Ver 3 1 5 inch 2HC 57 10 61500 5 2HD HS5A10PG1500 IBM PC AT Note Ver 5 00 5 00A are provided with a task swapping function but this software cannot use the function Remark Operation of PG 1500 controller is guaranteed only on the host machines and operating systems quoted above 350 APPENDIX B DEVELOPMENT TOOLS Debugging Tools An in circuit emulator IE 78C1 1 M is available as a program debugging tool for 87AD series products The system configuration is shown below Hardware IE 78C11 M The IE 78C1 1 M is an in circuit emulator for the 87AD series The 78 11 is used alone for a plastic QUIP or in conjunction with the conversion Socket for a plastic shrink DIP Efficient debugging is possible by connection to a host machine EV 9001 64 Conversion socket for use with a plastic shrink DIP Used in co
268. ransfer to from an accumulator is also possible 71 CHAPTER 4 PORT FUNCTIONS 2 Expansion mode Port F input output pins PF7 to PFO can be used as address outputs corresponding to the size of external expansion memory as shown in Table 4 2 This setting is performed by means of the memory mapping register Pins not used as address outputs are set to port mode Table 4 2 Operation of PF7 to PFO uPD78C18 78C14 78C14A 78C12A 78C11A 78CP18 78CP14 External Address Space Up to 256 bytes Up to 4K bytes Up to 16K bytes Up to 31K 48K 56K 60K Note 31K uPD78C18 48K uPD78C14 78C14A 56K 78 12 60K uPD78C11A The operation of the LPD78CP18 and 78CP14 differ depending on the setting of bits MM5 to of the memory mapping register 78 17 78 10 These pins function as address outputs corresponding to the size of externally installed memory according to the MODEO and MODE pin settings Pins which are not used as address outputs can be used as general purpose input output port pins which have the same port functions as port A with input output setting performed by the mode F register Table 4 3 Operation of PF7 to PFO uPD78C17 78C10A External Address Space AB11 AB10 AB8 4K bytes AB11 AB10 AB8 16K bytes Setting prohibited 11 10 AB9 AB8 63K 64K bytesNote Note
269. register SMH Receive data is input on the rising edge of SCK Two kinds of receive operations are available in the synchronous mode and can be controlled by the SE bit of the serial mode high register SMH When the SE bit is set 1 the search mode is set Each time one bit is sent to the MSB of the serial register from the RxD pin the serial register contents are transferred to the receive buffer register and a serial reception interrupt INTSR is generated Since the uPD78C18 is not provided with a circuit for detecting synchronization characters by hardware it is necessary to detect the synchronization characters by software When a synchronization character is detected and reception is synchronized the SE bit is reset 0 Resetting 0 the SE bit sets the character reception mode Each time 8 bit data is received the serial register contents are transferred to the receive buffer register and a serial reception interrupt INTSR is generated Serial reception interrupts are disabled by setting 1 the MKSR bit of the interrupt mask register MKH The maximum data transfer rate in reception is 625 kbps when an internal clock is used as SCK and 1 25 Mbps when an external clock is used at 15 MHz operation CHAPTER 7 SERIAL INTERFACE FUNCTIONS 7 3 3 interface mode In the I O interface mode synchronization is implemented by the controlled serial clock as with the serial data transfer method of the 7801 uPD78C064 etc
270. rformed if A is less than the L register LTA A Less Than 1 Operation code 10 1 1 0 0 0 0 0 0 0 1 1 1 Ri Ro 2 Number of bytes 2 3 Number of states 8 8 4 Function i Skip if borrow Subtracts the contents of the accumulator from the contents of the register r V A B C D E H L specified by R2RiRo 0 to 7 Skips if a borrow is generated as a result of the subtraction r A 5 Flags affected Z SK HC L1 lt 0 LO lt 0 CY 6 Example LTA H A H A A skip is performed if the H register is less than A 260 CHAPTER 14 INSTRUCTION SET NEA A r Not Equal Register with A 1 Operation code 10 1 1 0 0 0 0 2 Number of bytes 2 3 Number of states 8 8 lt 4 gt Function A r Skip if no zero Subtracts the contents of the register r V A B C D E H L specified by R2R1Ro 0 to 7 from the contents of the accumulator Skips if the result of the subtraction is not zero A z r 5 Flags affected Z SK HC L1 lt 0 LO 0 CY 6 Example A B SKIP IFAz B If A B the CY flag is set if A B the Z flag is set NEAr A Not Equal A with Register 1 Operation code 10 1 1 0 0 0 0 0 O 1 1 0 1 R2 Ri Ro 2 Number of bytes 2 3 Number of states 8 8 4 Function Skip if no zero Subtracts the contents of the register r V A B C D E H L specified by R2R1Ro 0 to 7 Skips if the resu
271. rial Interface and Transmission Format Change 330 15 7 Input Voltage to Analog Input 44 244 11 121 330 15 8 Limitations on Hardware STOP 004224422 1 332 159 How to Use Standby Flag rere terree suras E 335 15 10 Interface 335 15 11 Restrictions on IE 78C11 M 336 15 12 Electrostatic Withstand Limit of 2 4 4 enne 336 APPENDIX INTROCUTION TO PIGGYBACK PRODUCT 2222244444121 337 A 1 Pin FUN CEOS ET 340 A 1 1 Lower pins uPD78C11A 78C12A 78C14 QUIP type compatible 340 A 1 2 Upper pins 27C256 27C256A compatible 2 122 2 022 0 000000 342 2 Memory Configuration coiere ropes Eee ERRARE RR E ORRRAR S RDDRR RENE RUFEN RR RR ERE aai 342 Memory Mapping Register 346 AA Interface with 2 lt ERE REX ME GER RR EF SERE 348 APPENDIX DEVELOPMENT 85 0200000422244 349 APPENDIX INDEX OF INSTRUCTIONS ALPHABETICAL ORDER 353 MEMO LIST OF FIGURES 1 3
272. rm timer mode setting unless the timer mode has already been specified Set the port C pins to be used for the serial interface to control mode Enable transmission or reception by manipulating the SMH register 7 3 Serial Interface Operation The 78 18 serial interface has 3 operation modes Asynchronous start stop mode synchronous mode and O interface mode Each of these modes is described below 7 3 1 Asynchronous mode In the asynchronous mode transmission reception is performed by means of start stop bits with data bit synchronization and character synchronization performed by means of the start bit When data transmission reception is performed in this mode the transmission reception parameters character length clock rate number of stop bits odd even parity serial clock transmission reception enabling etc are set in the serial mode register SMH and SML as shown in Figure 7 4 114 CHAPTER 7 SERIAL INTERFACE FUNCTIONS SML Figure 7 4 Serial Mode Register Format in Asynchronous Mode 1 2 6 5 4 3 2 1 0 Clock rate Setting prohibited Setting prohibited 7 bits 8 bits Disable Enable Even parity generation check 0 Odd 1 Even Number of stop bits Setting prohibited 1 bit Setting prohibited 2 bits 115 CHAPTER 7 SERIAL INTERFACE FUNCTIONS Figure 7 4 Serial Mode Register Format in
273. ro A byte 5 Flags affected Z SK HC L1 lt 0 LO 0 CY EQI r byte Equal Immediate with Register 1 Operation code O 1 1 1 0 1 0 0 2 Number of bytes 3 3 Number of states 11 11 4 Function Skip if zero Subtracts the immediate data in the 3rd byte from the contents of the register r V A B C D E H L specified by R2RiRo 0 to 7 Skips if the result of the subtraction is zero r byte 5 Flags affected Z SK HC L1 lt 0 LO lt 0 CY EQI sr2 byte Equal Immediate with Special Register 1 Operation code O 1 1 0 2 Number of bytes 3 lt 3 gt Number of states 14 11 lt 4 gt Function sr2 byte Skip if no zero Subtracts the immediate data in the 3rd byte from the contents of the special register sr2 PA PB PC PD PF MKH MKL ANM SMH EOM TMM specified by 53525150 0 to 3 5 to 9 B D Skips if the result of the subtraction is zero sr2 byte 5 Flags affected Z SK HC L1 lt 0 10 lt 0 CY 282 CHAPTER 14 INSTRUCTION SET ONI A byte On Test Immediate with A 1 Operation code 10 1 0 0 1 1 1 lt 2 gt Number of bytes 2 3 Number of states 7 7 4 Function A byte Skip if no zero Obtains the logical product of the contents of the accumulator and the contents of the immediate data in the 2nd byte and skips if the result is not zero lt 5 gt Flags affected 12
274. ro cross detector because of its operation points This also applies in the standby modes HALT and software hardware STOP modes Thus when the zero cross detector is operated with self bias generation ZCx 1 slightly more current flows than without zero cross detector operation and its effect is greater in the software STOP mode 2 When the PC3 pin is used for zero cross detection in the uPD78C18 78C14A 78C12A 78C11A no pull up resistor should be incorporated In the hardware STOP mode self bias generation is stopped automatically 59 MEMO 60 CHAPTER 4 PORT FUNCTIONS 4 1 Port A PA7 to PAO This is an 8 bit input output port which has input output buffer and output latch functions see Figure 4 1 Port A can be set as to input or output bit wise using the mode A register MA When set to input the pins become high impedance In the uPD78C18 78C144 78C124 78C114 pull up resistors can be incorporated bit wise Figure 4 1 Port A gt O PAn Internal bus O 2 5 RDi 4 When the corresponding bit of the mode A register is set 1 a port A pin functions as an input port pin and when reset 0 as an output port pin see Figure 4 2 When RESET is input or the hardware STOP mode is set all bits of the mode A register are set and port A functions as an input port high impedance Figure 4 2 Mode A Register Format 7 6 5 4 3 2 1 0 wes
275. rol C register they can be set bit wise as input or output port by means of the mode C register MC 2 Control signal input output mode PC7 to PCO can be set bit wise as control pins by means of the mode control C register MCC The functions of the various control pins are shown below a b c d e f g TxD Transmit data Output The serial data transmission pin from which the contents of the serial register are output RxD Receive data Input The serial data reception pin Data on RxD is loaded into the serial register SCK Serial clock Input output The serial input output data control clock Functions as an output when the internal clock is used and as an input when an external clock is used INT2 TI Interrupt request Timer input Input The edge triggered falling edge maskable interrupt input pin and timer external clock input pin Can also be used as the AC signal zero cross detection pin Caution Whenpull up resistors are incorporated in PC3 of the uPD78C18 78C14A 78C12A 78C11A the zero cross function can not be operated correctly TO Timer output Output Outputs a square wave with the timer count time or one cycle of the internal clock 03 as a half cycle CI Counter input Input The timer event counter external pulse input CO1 Counter output Output These pins output a rectangular wave which is programmable by the timer event counter
276. routine Instruction JR execution Vin STOP Vi Hardware STOP mode When executing the power off processing before executing the JR in the NMI routine delay of STOP is required to be larger in proportion to time shortened 333 CHAPTER 15 OPERATING PRECAUTIONS 2 When both RESET and STOP are used During reset period RESET low level STOP input can be acknowledged normally Therefore if the RESET input is activated before entering STOP a normal hardware STOP mode can be expected Figure 15 4 When Both NMI and STOP Are Used 87AD Series Power off detecting signal The operation sequence is as follows a When the power supply off detect signal RESET signal enters the 87AD series is placed in the reset state 0 The RESET signal is caused to be delayed 10 or more to change it to be the STOP signal c The 87AD series enters the hardware STOP mode in the reset state However this method may damage the data memory contents by RESET in other words if the RESET signal is input to the CPU data memory while data is written the relevant data may be undefined Figure 15 5 Control Timing of RESET and STOP RESET RESET status PM 10 us or more STOP Vi Hardware STOP mode 334 CHAPTER 15 OPERATING PRECAUTIONS 15 9 How to Use Standby Flag e Target products 15 10 Bus Interface e Target products All products Assurance is n
277. rp the instruction is written as shown below DCX H HL HL 1 The corresponding operation code is as shown below Operation code 0 0 1 1 0 1 1 221 CHAPTER 14 INSTRUCTION SET 14 4 2 Register indirect addressing With this addressing method the memory to be manipulated is addressed using the contents of the register pair specified by the register pair specification code 2 1 in the instruction as the operand address Register indirect addressing is used when an instruction with the following operand formats is executed Items with auto increment decrement double auto increment base and base index functions are described separately Notation rpa 1 2 222 1 Description Method D H D H D B D H B D H D H D H D byte H A H B H EA H byte D H D H D byte H A H B H EA H byte LDAX rpa2 Operation code As 0 1 0 1 Ao If the BC register pair is selected as rpa2 the instruction is written as shown below LDAX B A lt BC The corresponding operation code is shown below Operation code 0 0 1 0 1 0 O 1 CHAPTER 14 INSTRUCTION SET 14 4 3 Auto increment addressing This is a special mode of register indirect addressing using the HL and DE register pairs in which after the memory to be manipulated is addressed using the contents of the register pair specified by the addressing specification
278. rrupt INTEIN masking is released by means of the interrupt mask register MKL Internal interrupts INTAD with the same priority as INTEIN must be masked by the interrupt mask register MKH Figure 6 22 Interrupt Mask Register Setting Single Pulse Output INTEIN Mask Release INTEIN masking released INTAD masking d Timer event counter operation setting is performed by the timer event counter mode register ETMM The following settings are made in the timer event counter mode register ETMM An internal clock 12 as the ECNT input clock and free running as the ECNT clear mode Timer event counter operation is started by setting the timer event counter mode register 101 CHAPTER 6 TIMER EVENT COUNTER FUNCTIONS Figure 6 23 Timer Event Counter Mode Register Setting Single Pulse Output ECNT Operation Setting 2 0 7 6 5 4 3 Ema DLS ae Oe a ey ECNT input clock Internal clock 012 ECNT clear mode Free running An example of the initialization program is shown below F TIMER EVENT COUNTER INITIALIZATION INIT MVI A 00H B MOV ETMM A Clear timer event counter gt lt a gt MVI EOM 05H Initialize counter output O J MVI A 60H PC5 CI PC6 COO MOV MCC A Set port mode control J ape ANI MKL 7FH INTEIN enable lt gt START MVI A 04H ECNT free running D MOV ETMM A Set timer event counter mode amp start lt d gt 2 After in
279. rrupts NMI It can be set 1 or reset 0 bit wise by an instruction An interrupt request is masked disabled or enabled when the corresponding bit of the mask register is 1 or 0 respectively When RESET is input and in the hardware STOP mode all bits of the mask register are set 1 masking all interrupt requests except non maskable interrupts 155 CHAPTER 9 INTERRUPT CONTROL FUNCTIONS Figure 9 2 Mask Register MKL MKH Format 7 6 5 3 2 1 MKEIN MKE1 MKT1 MKTO MKL TO masking released TO masked T1 masking released T1 masked masking released masked INT2 masking released INT2 masked INTEO masking released INTEO masked INTE1 masking released INTE1 masked INTEIN masking released INTEIN masked 7 6 5 4 3 2 1 0 LT T esr INTAD masking released INTAD masked INTSR masking released INTSR masked INTST masking released INTST masked 156 CHAPTER 9 INTERRUPT CONTROL FUNCTIONS 3 4 5 6 Priority control circuit This circuit controls the 6 priority levels described earlier If two or more interrupt request flags are set simultaneously the interrupt with the highest priority according to Table 9 1 is acknowledged and the remainder are held pending Test control circuit This circuit comes into operation when a skip instruction
280. rry 1 Operation code 10 1 1 1 0 0 0 0 1 1 0 1 0 Ai Ao 2 Number of bytes 2 3 Number of states 11 8 4 Function lt A rpa CY Adds the contents of the memory addressed by the register pair BC DE HL DE HL DE HL specified by 2 1 1 to 7 to the contents of the accumulator including the CY flag and stores the result in the accumulator 5 Flags affected Z SK 0 L1 0 LO 0 CY 6 Example ADCX D lt A DE DE e DE 1 This example adds the contents of the memory addressed by the DE register pair to A and stores the result in A and then increments DE 263 CHAPTER 14 INSTRUCTION SET ADDNCX rpa Add Memory addressed by Register Pair to A Skip if No Carry 1 Operation code 10 1 1 1 0 0 0 0 1 0 1 Ao 2 Number of bytes 2 3 Number of states 11 8 4 Function lt Skip if no carry Adds the contents of the memory addressed by the register pair BC DE DE HL DE specified 1 7 and the contents of the accumulator and stores the result in the accumulator Skips if no carry is generated as a result of the addition lt 5 gt Flags affected Z SK HC L1 lt 0 LO 0 lt 6 gt Example LXI H 4200H HL lt 4200H LXI D 4000H DE lt 4000H MOV A 4100H A lt 4100H ADDNCX D lt A DE
281. rvice routine is being executed Therefore when the El instruction is executed during execution of an interrupt service routine acknowledgement is enabled even for that interrupt request itself or interrupt requests of lower priority In this case too if multiple interrupt requests are generated simultaneously the highest priority request is acknowledged and the lower priority requests are held pending The pending interrupt requests are acknowledged when the El state is subsequently entered if no other interrupt requests of higher priority have been generated Since there are practically no restrictions on the stack area used when an interrupt is generated as long as the memory size is sufficient multiple interrupt levels can also be used without restriction see Figure 9 8 Figure 9 8 3 Level Multiple Interrupts 0010H 0008H El El 18H INTI 0018H INTTO EI El ORI MKH 02H INTEG INTSR Not acknowledged ANI MKH OFDH 0028H RETI RETI EI RETI El RETI Remark f masking is released by the mask register for two interrupt sources of the same priority which of the two interrupt requests is concerned must be determined before executing the El instruction at the start of the interrupt service routine 169 MEMO 170 CHAPTER 10 CONTROL FUNCTIONS 10 1 Standby Functions Three standby modes are available for the wPD78C18 to save power consumption in the program standby state The HALT mode soft
282. s Condition Operation Aso lt 9 A7 4 lt 9 0 lt HC 0 10 CY 1 lt A 01100000 gt 10 A7 4 lt 9 CY 0 A lt A 00000110 HC 0 gt 9 or CY 1 A 01100110 HC 1 A7 4 lt 9 and CY 0 lt 00000110 gt 10 CY 1 A lt 01100110 lt 5 gt Flags affected Z SK lt 0 L1 lt 0 LO lt 0 lt 6 gt Example MVI A 88 ADI A 79H A 01H CY 1 HC 1 DAA A lt A 66H A 67H CY 1 88 79 167 10001000 88H ADI 01111001 79H 00000001 01 DAA Carry HC 01100110 66H 01100111 67H 7 Caution This instruction cannot be used for adjustment after execution of a subtract instruction When decimal BCD data subtraction is performed a complement instruction should be used 304 CHAPTER 14 INSTRUCTION SET STC Set Carry 1 Operation code O 1 0 0 1 000 0 0 1 0 1 0 1 1 2 Number of bytes 2 3 Number of states 8 8 4 Function CY 1 Sets 1 the CY flag 5 Flags affected SK lt 0 11 lt 0 10 lt 0 lt 1 Clear Carry 1 Operation code O 1 0 1 0 0 0 0 0 1 0 1 O 1 0 lt 2 gt Number of bytes 2 3 Number of states 8 8 lt 4 gt Function CY lt 0 Sets 0 the CY flag lt 5 gt Flags affected 65 lt 0 11 lt 0 10 lt 0 lt 0 Negate A 1 Operation code O 1 0 0 1 0
283. s 1 CHAPTER 1 GENERAL DESCRIPTION lines e nput output ports 40 uPD78C18 78CP18 78C14 78C14A 78CP14 78C12A 78C1 1 A 28 uPD78C17 78C10A e Edge detected inputs 4 inputs Zero cross detection function Standby functions e HALT mode e Hardware software STOP mode e Incorporation of pull up resistors can be specified bit wise for port A and port C Note On chip clock oscillator Wide variety of packages Note 78 18 78 14 78 12 78 11 only CHAPTER 1 GENERAL DESCRIPTION 1 2 Ordering Information and Quality Grade 1 2 1 Ordering information 1 uPD78C10A 78C10A A Part number OACW OAGF 3BE 0AGO 36 OAL uPD78C uPD78C uPD78C uPD78C uPD78C uPD78C uPD78C OAGF A 3BE 0AGQ A 36 OAL A 2 uPD78C11A 78C11A A Part number 1ACW xxx 1 AGF xxx 3BE 1 36 1 37 1 AL xxx uPD78C uPD78C uPD78C uPD78C uPD78C uPD78C uPD78C uPD78C 1 AGO A xxx 36 1 AL A xxx 1 AGF A xxx 3BE 64 pin 64 pin 64 pin 68 pin 64 pin 64 pin 68 pin 64 pin 64 pin 64 pin 64 pin 68 pin 64 pin 64 pin 68 pin Remark xxx indicates ROM code number plast plast plast plast plast plast plast plast plast plast plast plast plast plast plast Package ic shrink DIP ic OFP resin thickness 2 7 mm ic QUIP resin thickness 2 7 mm QUIP ic shrink DIP ic
284. s active low have to be raised to the high level with a pull up resistor to make them inactive Also before switching to the control signal output mode by means of the mode control C register 1 must be written to the port C output latch to make the port C output level and output latch contents equal Port C is then switched to the control signal output mode by means of the mode control C register CHAPTER 4 PORT FUNCTIONS uUPD78C18 Be TO PC4 Active low output PC6 1 7 MVI PC OFFH PORT OUTPUT LATCH 1 A OFFH MOV A PORT C CONTROL MODE 69 CHAPTER 4 PORT FUNCTIONS 4 4 Port D PD7 to PDO uPD78C18 78C14 78C14A 78C12A 78C11A 78CP18 78CP14 Port D is an 8 bit special input output port in addition to functioning as a general purpose input output port port mode this port also functions as a multiplexed address data bus Port expansion mode can be specified for port D as a byte unit by means of the memory mapping register see Table 4 1 Table 4 1 Operation of PD7 to PDO uPD78C18 78C14 78C14A 78C12A 78C11A 78CP 18 78CP 14 P MM2 MM1 0 0 MM2 MM1 0 0 PD7 to PDO Port mode Expansion mode Port D is set to port mode when the MM2 and MM1 bits of the memory mapping register are reset 0 and to expansion mode in all other cases see 11 1 1 Memory mapping register MM 70 1 2 Port mode Port D is an
285. s been transmitted itis necessary to check that the serial transmission interrupt request flag INTFST is set 1 and the transmit buffer register is empty before executing the operation RxE bit 3 Controls whether or not a receive operation is performed When the RxE bit is reset 0 data reception is not performed When the RxE bit is set 1 data reception is enabled SE bit 4 Controls whether or not search mode is entered in synchronous mode set by SML When the SE bit is set 1 the serial register contents are transferred to the receive buffer register and a serial reception interrupt INTSR is generated each time a data bit is received When the SE bit is reset 0 the serial register contents are transferred to the receive buffer register and a serial reception interrupt INTSR is generated each time 8 data bits are received IOE bit 5 Controls whether the synchronous mode or I O interface mode is entered in the case of synchronous operation set by SML The synchronous mode is selected when the IOE bit is reset 0 and the I O interface mode is selected when the IOE bit is set 1 TSK bit 6 This bit is used to start the serial clock when is received using an internal clock in the I O interface mode When the TSK bit is set 1 and the serial clock is started this bit is automatically reset 0 CHAPTER 7 SERIAL INTERFACE FUNCTIONS The serial mode high register SMH is reset to OOH by RESET input an
286. s can be tested as it is 157 CHAPTER 9 INTERRUPT CONTROL FUNCTIONS 9 2 External Interrupt Sampling Pins NMI INT1 INT2 and AN7 to AN4 have a noise elimination function to prevent errors due to noise signals 1 2 3 4 158 NMI input This is the falling edge active non maskable interrupt input When the NMI signal is detected to be low for at least a given time by the analog delay circuit it is recognized as a normal signal and the interrupt request flag is set At the end of the instruction INTFNMI is checked and if set the program jumps to the interrupt address for non maskable interrupts regardless of the EI DI state When an interrupt request is acknowledged is automatically reset INT1 input This is the rising edge active maskable interrupt input When the INT1 signal changes from low to high and the high level is detected in 3 or more successive 1 cycle sampling pulses 12 states 2 4 us at 15 MHz the input is recognized as a normal signal and the INTF1 interrupt request flag is set When masking is released in the El state a check is made that the INTF1 is set at the end of the instruction and if there is no other interrupt request of higher priority the INT1 interrupt is acknowledged and the program jumps to the interrupt address Interrupt request flag resetting is described in 9 4 Maskable Interrupt Operation A new INT1 interrupt is detected when the INT1 signa
287. s performed by sampling the center of the subsequent character bits parity bit and stop bit Remark The 1 2 bit timer for each clock rate is as follows x1 1 2 SCK clock pulse x 16 8 5 SCK clock pulse x 64 32 5 SCK clock pulse 119 CHAPTER 7 SERIAL INTERFACE FUNCTIONS 120 When the prescribed data is input from the RxD pin to the serial register data is transferred to the receive buffer register When the receive buffer register becomes full an interrupt request INTSR is generated Serial reception interrupts are disabled by setting 1 the MKSR bit of the interrupt mask register MKH An odd even parity check is made data reception when the PEN bit 1 If there is a mismatch parity error the stop bit is low framing error or the next data is transferred to the receive buffer when the receive buffer is full overrun error the error flag is set However because no error interrupt feature is provided testing must be performed by skip instructions SKIT or SKNIT in the program When an error is generated also an overrun error will be generated again in the next receive operation if the RXB data is not read The maximum data transfer rate in reception is set as shown in Table 7 3 according to SCK and the clock rate at 15 MHz operation Table 7 3 Maximum Data Transfer Rate at Reception SCK Internal Clock External Clock Clock Rate SCK Data Transfer Rate SCK Data Transfer Rate x 1Note 2 625 kHz 625 k
288. set in any memory locations specified by the V register 45 CHAPTER 3 INTERNAL BLOCK FUNCTIOS 46 Figure 3 3 Memory uPD78C18 0000H 0000H On chip ROM 0004H 32768 x 8 bit 0008H INTTO INTT1 7FFFH 8000H 0010H INT1 INT2 External memory 31744 x 8 bit 0018H INTEO INTE1 0020H INTEIN INTAD FBFFH FCOOH On chip RAM 0028H INTSR INTST 1024 x 8 bit Standby area FFFFH User s area Note Can only be used when the RAE bit of the MM register is 1 t 31 0060H SOFTI 0080H LOW ADRS 0081H HIGH ADRS 4 0082H LOW ADRS 28 t R 0083H HIGH ADRS T LOW ADRS OOBFH HIGH ADRS CHAPTER 3 INTERNAL BLOCK FUNCTIONS Figure 3 4 Memory uPD78C17 0000H 0000H 0004H 0008H INTTO INTT1 0010H INT1 INT2 External memory 64512 x 8 bit 0018H INTEO INTE1 0020H INTEIN INTAD Note M E 0028H INTSR INTST E 0060H SOFTI 0080H LOW ADRS 0081 HIGH ADRS 7 o 0082H LOW ADRS 2 P 0083H HIGH ADRS 55 oO OOBEH LOW ADRS HIGH ADRS REM Note Can only be used when the RAE bit of the MM register is 1 47 CHAPTER 3 INTERNAL BLOCK FUNCTIOS 48 Figure 3 5 Memory uwPD78C14 78C14A
289. specific area can be set up externally Addresses 0000H to 7FFFH No mask ROM incorporated Addresses 0000H to 3FFFH Addresses 0000H to 1FFFH Addresses 0000H to OFFFH No mask ROM incorporated CHAPTER 3 INTERNAL BLOCK FUNCTIONS 4 5 6 On chip data memory area 1K byte RAM is incorporated in addresses FCOOH to FFFFH in the uPD78C18 and 256 byte RAM in addresses FFOOH to in the wPD78C14A 78C12A 78C11A 78C10A RAM contents are retained in standby operation Caution When internal RAM is used the RAE bit of the MM register must be set to 1 External memory area The possible area for external memory expansion is shown below This area can be expanded in steps by setting the memory mapping register e uPD78C18 31K bytes addresses 8000H to FBFFH e uPD78C14 78C14A 48K bytes addresses 4000H to FEFFH e pPD78C12A b6K bytes addresses 2000H to FEFFH e uPD78C11A 60K bytes addresses 1000H to FEFFH External memory be expanded in steps in a 63K byte area addresses 0000H to FBFFH for the uPD78C17 and in a 64K byte area addresses OOOOH to FEFFH for the uPD78C10A This setting is performed by the MODEO and MODE1 The external memory is accessed using PD7 to PDO multiplexed address data bus PF7 to PFO address bus and the RD WR and ALE signals Both programs and data can be stored in the external memory Working register area A 256 byte working register area can be
290. ssed by the V register high order 8 bits and the immediate data in the 2nd byte low order 8 bits and skips if a borrow is generated as a result of the decrement lt 5 gt Flags affected Z SK 11 0 10 0 lt 6 gt Example i MVI V 50H DCRW 0 5000H 5000 1 This example decrements the contents of the working register in address 5000H 302 CHAPTER 14 INSTRUCTION SET DCX rp Decrement Register Pair 1 Operation code 10 0 Pi Po 0 1 1 lt 2 gt Number of bytes 1 lt 3 gt Number of states 7 4 lt 4 gt Function rp lt 1 Decrements SP or the contents of the register pair rp BC DE HL specified by 1 0 to 5 Flags affected SK 0 L1 0 L0 0 6 Example DCX H HL e HL 1 DCX EA Decrement EA 1 Operation code 1 0 1 0 1 00 1 2 Number of bytes 1 3 Number of states 7 4 4 Function lt 1 Decrements the extended accumulator lt 5 gt Flags affected SK 0 L1 0 10 0 303 CHAPTER 14 INSTRUCTION SET 14 6 10 Other operation instructions DAA Decimal Adjust A 1 Operation code O 1 1 0 0 0 1 lt 2 gt Number of bytes 1 3 Number of states 4 4 lt 4 gt Function i Determines the contents of the accumulator CY flag and HC flag and performs decimal adjustment as shown below This instruction is only meaningful after execution of an operation between decimal BCD data item
291. st incorporate sufficient safety measures in its design such as redundancy fire containment and anti failure features NEC devices are classified into the following three quality grades Standard Special and Specific The Specific quality grade applies only to devices developed based on a customer designated quality assurance program for a specific application The recommended applications of a device depend on its quality grade as indicated below Customers must check the quality grade of each device before using it in a particular application Standard Computers office equipment communications equipment test and measurement equipment audio and visual equipment home electronic appliances machine tools personal electronic equipment and industrial robots Special Transportation equipment automobiles trains ships etc traffic control systems anti disaster systems anti crime systems safety equipment and medical equipment not specifically designed for life support c Aircrafts aerospace equipment submersible repeaters nuclear reactor control systems life support systems or medical equipment for life support etc The quality grade of NEC devices in Standard unless otherwise specified in NEC s Data Sheets or Data Books If customers intend to use NEC devices for applications other than those specified for Standard quality grade they should contact NEC Sales Representative in advance Anti radioactive design is not imp
292. ster 1 Operation code 10 1 0 0 1 1 0 1 1 1 Ss 54 52 Si So lt 2 gt Number of bytes 2 lt 3 gt Number of states 10 7 lt 4 gt Function i sre A Transfers the accumulator contents to the special register sr PA PB PC PD PF MKH MKL ANM SMH SML EOM TMM MCC MB MC MF TXB TM1 ZCM specified by 555453525150 0 to 3 5 to D 10 to 14 17 18 1A 1B 28 5 Flags affected SK 0 L1 0 L0 0 6 Example MOV PA A Transfer A to port A latch MOV A sr1 Move Special Register to A 1 Operation code 10 1 0 0 1 1 0 0 1 1 Ss 54 52 Si So lt 2 gt Number of bytes 2 lt 3 gt Number of states 10 7 lt 4 gt Function lt sr1 Transfers the contents of the special register sr1 PB PD PF MKH MKL ANM SMH CRO CR2 specified by 555453525150 0 to 3 5 to 9 D 19 20 to 23 to the accumulator lt 5 gt Flags affected SK 0 L1 0 L0 0 6 Example i MOV A TMM Transfer timer mode register contents to A 234 CHAPTER 14 INSTRUCTION SET MOV r word Move Memory to Register 1 Operation code 0 1 1 1 0 0 0 0 0 1 1 0 1 R2 Ri Ro Low address High address 2 Number of bytes 4 3 Number of states 17 14 4 Function r lt word Transfers the contents of the memory addressed by the 3rd byte Low address and 4th byte High address to t
293. struction RESET input resets all bits to 0 1 2 3 4 5 6 Figure 3 2 PSW Configuration 7 6 5 4 3 2 1 0 2 sk fee j o Z Zero When the operation result is zero this flag is set 1 In all other cases it is reset 0 SK Skip When the skip condition is satisfied this flag is set 1 If the condition is not satisfied it is reset 0 HC Half carry If an operation generates a carry out of bit 3 or a borrow into bit 3 this flag is set 1 In all other cases it is reset 0 L1 When MVI A byte instructions are stacked this flag is set 1 In all other cases it is reset 0 10 When MVI L byte LXI H word instructions are stacked this flag is set 1 In all other cases it is reset 0 CY Carry When an operation generates a carry out of or a borrow into bit 7 or 15 this flag is set 1 In all other cases it is reset 0 When one of 35 types of ALU instructions a rotation instruction or a carry manipulation instruction is executed various flags are affected as shown in Table 3 2 42 CHAPTER 3 INTERNAL BLOCK FUNCTIONS Operation Table 3 2 Flag Operations reg memory immediate ADDNCW SUBNBW GTAW LTAW ADDNCX SUBNBX GTAX LTAX EQA DNE DEQ INR DCR INRW DCRW DAA RLR RLL SLR SLL DRLR DRLL DSLR DSLL SLRC SLLC STC CLC A byte MVI L byte LX
294. t HL 1 This example obtains the logical product of A and the memory contents addressed by the HL register pair and stores the result in A and then decrements HL ORAX rpa Or Memory addressed by Register Pair with A 1 Operation code O 1 1 1 0 0 0 1 0 0 1 1 Ao 2 Number of bytes 2 3 Number of states 11 8 4 Function Av Obtains the logical sum of the contents of the accumulator and the contents of the memory addressed by the register pair BC DE HL DE HL DE HL specified by A2A1Ao 1 to 7 and stores the result in the accumulator lt 5 gt Flags affected 2 5 lt 0 11 lt 0 10 0 lt 6 gt Example ORAX D A lt Av DE 266 CHAPTER 14 INSTRUCTION SET XRAX rpa Exclusive Or Memory addressed by Register Pair with A 1 Operation code 10 1 1 1 0 0 0 0 1 0 0 1 0 Az Ao lt 2 gt Number of bytes 2 lt 3 gt Number of states 11 8 lt 4 gt Function i Obtains the exculsive logical sum of the contents of the accumulator and the contents of the memory addressed by the register pair DE HL DE HL DE HL specified by A2A1Ao 1 to 7 and stores the result in the accumulator 5 Flags affected Z 5 lt 0 1160 10 0 lt 6 gt Example LXI H 4000H HL lt 4000H MVI A lt A8H XRAX H A lt AHL SK Z SKIP IF ZERO STAX D DE JMP KORED Memory 10
295. t D F operation mode from port mode to expand mode and vice versa from input port to output port and vice versa and expansion space change cannot be emulate by an emulator Relevant register MM register to MM2 MEF register e Remedy Once a mode is set never the same mode again 15 3 Timer Timer Event Counter Compare Register Setting e Target products All products Details When the compare register value setting competes with compareter match the latter takes preference over the former Therefore match interrupt occurrence and output control are disabled Table 15 1 lists compare register match signal and match interrupt of each timer Table 15 1 Compare Register Match Signal and Match Interrupt of Each Timer Timer and Timer Event Counter Compare Register Match Signal Match Interrupt TIMERO Timer REGO TMO TIMER1 Timer REG1 TM1 Timer event counter Timer event counter REGO ECNT ETMO Timer event counter REG1 ETM1 e Remedy When setting the compare register value do not allow the set value to compete with the comparator match signal 328 CHAPTER 15 OPERATING PRECAUTIONS 15 4 Restrictions on Serial Interface and Asynchronous Modes Target products uPD78C10 1 2 3 78C11 78C14 Standards K and E 78C14A 78CG14 Details When the serial data reception is made in the asynchronous mode using external clock SCK signal the ER fla
296. t in uilt in CST10 0MTW uilt in uilt in CSA6 00MG 30 30 CST6 00MG uilt in Built in FCR12 0MC uilt in Built in 185 CHAPTER 10 CONTROL FUNCTIONS Table 10 5 Recommended Ceramic Resonator 2 2 Recommended C1 pF C2 pF uPD78CG14 Murata Mfg Co Ltd CSA15 0MX3 22 22 CSA12 0MT 30 30 CST12 0MT Built in Built in Product Name Manufacturer Part Name uPD78CP14 Murata Mfg Co Ltd CSA12 0MT 30 30 CST12 0MTW Built in Built in CSA10 0MT 30 30 CST10 0MTW Built in Built in CSA8 00MT 30 30 CST8 00MTW Built in Built in uPD78C17 Murata Mfg Co Ltd 5 15 00 001 22 22 78 18 CST15 00MXW001 Built in Built in CSA10 0MT 30 30 CST10 0MTW Built in Built in CSA8 00MT 30 30 CST8 00MTW Built in Built in FCR15 0MC Built in Built in FCR10 0MC Built in Built in FCR8 0MC Built in Built in Remark Use of crystal and ceramic resonator Generally speaking the oscillation frequency of a crystal is extremely stable and it is therefore ideal for high precision time management for example in clocks and watches measuring instruments etc The oscillation frequency stability of a ceramic resonator is not as high as that of a crystal but it offers three advantages a fast oscillation start up time small size and low cost It is therefore suitable for general applications in which high precision tim
297. tch can be output to the external pin and loaded into the accumulator when the bit is switched to output port mode Since input data is not latched stable input is necessary when executing a data transfer instruction or a bit test etc Figure 4 4 Port A Specified as Input Port Internal bus CHAPTER 4 PORT FUNCTIONS 3 Port A manipulation Actual execution of an instruction which manipulates port A is performed as an 8 bit unit If a port A read instruction MOV A PA is executed the input line contents of the port specified for input and the output latch contents of the port specified for output are loaded into an accumulator When a port A write instruction MOV PA A is executed data is written to the output latch of both ports specified for input and output but the output latch contents of a port specified as input are not output to an external pin Here the data input output manipulation is described when the high order 4 bits PA7 to PA4 of port A are used as an active low output port and the low order 4 bits PA3 to PAO are used as an input port Since the initial status of PA7 to PAO after a reset is the input port status high impedance the PA7 to PA4 output port pins used as active low have to be raised to the high level with a pull up resistor to make them inactive Also since the output latch contents are undefined after a reset the active level low may be output at the point of specificati
298. ted as a result of the subtraction 5 Flags affected ZL SK HC L1 lt 0 LO 0 CY 6 Example WORK EQU WORK E0H LOCA EQU 0 LOCA 00H MVI V WORK V lt EOH SUBNBW LOCA A lt A E000H When this instruction is executed the upper 8 bit address of the area to be accessed must be loaded beforehand into the V register which specifies the 256 byte working register area Next the lower 8 bit address is selected by the value of the SUBNBW instruction operand and then the processing is performed ANAW wa And Working Register with A 1 Operation code 10 1 1 1 0 1 0 0 1 0001 0 0 0 lt 2 gt Number of bytes 3 lt 3 gt Number of states 14 11 lt 4 gt Function A A V wa Obtains the logical product of the contents of the accumulator and the contents of the working register addressed by the V register high order 8 bits and the immediate data in the 3rd byte low order 8 bits and stores the result in the accumulator 5 Flags affected ZSKc 0 L1 0 L 0 287 CHAPTER 14 INSTRUCTION SET ORAW wa Or Working Register with A 1 Operation code O 1 1 1 0 1 0 0 2 Number of bytes 3 lt 3 gt Number of states 14 11 lt 4 gt Function amp Obtains the logical sum of the contents of the accumulator and the contents of the working register addressed by the V register high order 8 bits and the immediate data in the 3rd byte low ord
299. tedly by means of the JR instruction until the 8 addresses starting at memory address 2000H i e addresses up to the including address 2007H have been cleared Since the displacement value is this case is 3 the actual operation code is as follows 1 111 1 1 1 0 1 Two s complement of 3 314 CHAPTER 14 INSTRUCTION SET JRE word Jump Relative Extended 1 Operation code O 1 0 0 1 1 1 2 Number of bytes 2 3 Number of states 10 7 4 Function PC PC 2 jdisp When 5 20 X All O s When 5 1 AI 1 s Jumps to the address obtained by adding the 9 bit displacement value jdisp to the start address of the next instruction jdisp is handled as signed two s complement data 256 to 255 with bit 8 bit O of the 1st byte as the sign bit A jump destination address or label which takes account of the jump range should be directly written as the operand of the JRE instruction Thus when a JRE instruction is executed at address 1000 for example the possible jump range is from address 746 to address 1257 5 Flags affected SK 0 L1 0 10 0 JEA Jump EA indirect 1 Operation code 10 1 1 0 0 1 0 1 0 0 0 2 Number of bytes 2 3 Number of states 8 8 4 Function PC EA Loads the contents of the high order 8 bits EAH of the extended accumulator into the high order 8 bits 15 8 of the program counter loads the low order 8 bi
300. ter r2 A C specified by RiRo 1 to 3 and stores the quotient in the extended accumulator and the remainder in register r2 If r2 0 0 divisor FFFFH is stored in EA and the contents of the low order 8 bits of EA prior to execution of the instruction are stored in r2 lt 5 gt Flags affected SK 0 L1 0 10 0 300 CHAPTER 14 INSTRUCTION SET 14 6 9 Increment decrement instructions INR r2 Increment Register 1 Operation code 10 1 0 0 0 R Ro 2 Number of bytes 1 3 Number of states 4 4 4 Function r2 lt r2 1 Skip if carry Increments the contents of the register r2 A B C specified by 1 to 3 and skips if a carry is generated as a result of the increment 5 Flags affected Z SK 11 lt 0 10 lt 0 lt 6 gt Example INR A lt 1 INRW wa Increment Working Register 1 Operation code 10 0 1 0 0 0 0 0 2 Number of bytes 2 lt 3 gt Number of states 16 7 lt 4 gt Function V wa V wa 1 Skip if carry Increments the contents of the working register addressed by the V register high order 8 bits and the immediate data in the 2nd byte low order 8 bits and skips if a carry is generated as a result of the increment lt 5 gt Flags affected Z SK HC L1 lt 0 106 0 lt 6 gt Example MVI V INRW OFFH FFFFH lt FFFFH 1 This example increments the contents of the working register in addr
301. termined by the contents of the program counter PC and is normally incremented by one for each byte automatically according to the number of instruction bytes fetched each time an instruction is executed However when an instruction associated with a branch is executed the jump address information is loaded into the PC in accordance with the addressing methods shown below and a jump is performed 14 3 1 Register addressing The contents of the BC register pair or the EA accumulator are loaded into the PC and a jump is performed This is performed when the following instructions are executed JB CALB 7 07 0 Y 15 87 0 JEA 216 CHAPTER 14 INSTRUCTION SET 14 3 2 Immediate addressing The immediate data in the 2nd and 3rd bytes of the instruction is loaded into the PC and a jump is performed This is performed when the following instructions are executed JMP word CALL word CALF word In the case of the CALF instruction the immediate data in the low order 3 bits of the 1st byte and the 2nd byte is loaded into the PC CALL or JMP Low address High address 217 CHAPTER 14 INSTRUCTION SET 14 3 3 Direct addressing The contents of the memory addressed by the immediate data in the low order 5 bits of the operation code are loaded into the PC and a jump is performed This is performed when the following instruction is executed CALT word 7654 0 15 8765 10 Effecti
302. terrupt enabled disabled EI DI state When the HALT mode is released by a maskable interrupt operation after release differs depending on whether the El or DI state is set CHAPTER 10 CONTROL FUNCTIONS i ii El state The instruction following the HLT instruction is not executed and the program jumps to the corresponding interrupt address Figure 10 2 HALT Mode Release Timing In El State CPU Interrupt Interrupt operation HLT routine OSC 111111 4111 INTFx DI state Execution restarts with the instruction following the HLT instruction without jumping to the interrupt address Since the interrupt request flag used for release remains set it should be reset by a skip instruction when required Figure 10 3 HALT Mode Release Timing In DI State Execution of next CPU instruction operation HLT 173 CHAPTER 10 CONTROL FUNCTIONS 10 1 3 Software STOP mode When the STOP instruction is executed the software STOP mode is set unless the interrupt request flag for an unmasked external interrupt is set In the software STOP mode all clocks stop When this mode is set program execution stops and the contents of all registers on chip RAM and flags except FTO and FT1 just before stoppage are retained the timer upcounter is cleared to OOH Only the NMI and RESET signals used to release the software STOP mode are
303. the mask register for two types of interrupt requests are both set to 0 In this case the interrupt request is the logical sum of the two interrupt request flags If an interrupt request is acknowledged in accordance with the interrupt operation as a result of setting one or both interrupt request flags having the same priority and the program jumps to the interrupt address the interrupt request flag is not reset Therefore the interrupt request is identified by executing a skip instruction which tests the interrupt request flag at the beginning of the interrupt service routine and the interrupt request flag is reset The priority of interrupt requests with the same priority can be freely decided by the user by determining which of the two is first subject to execution of the skip instruction The interrupt servicing sequence when both INT1 and INT2 are unmasked is shown in Figure 9 6 Figure 9 6 Interrupt Servicing Sequence Masking released for both INT1 and INT2 0010H Save registers INT1 interrupt service program or INT2 INT2 interrupt service program l Restore registers El RETI Remark In this example masking is released for both INT1 INT2 interrupt requests which have the same 164 priority CHAPTER 9 INTERRUPT CONTROL FUNCTIONS 2 When one type is unmasked For two types of interrupt requests having the same priority the corresponding bit of the mask
304. the operand displacement value Base addressing is used when an instruction with the following operand formats is executed The immediate data displacement value is handled as a non negative number Notation rpa2 rpa3 Example 226 1 Description Method D byte H byte D byte H byte STAX rpa2 Operation code 0 1 1 1 Ao If base addressing is selected using the sum of the HL register pair and 10H as rpa2 the instruction is written as shown below STAX 10H HL A Operation code te OS 1 2 21 1 1 2 CHAPTER 14 INSTRUCTION SET 14 4 7 Base index addressing This is a special mode of register indirect addressing using the HL and DE register pairs in which the memory to be manipulated is addressed using as the operand address the sum of the contents of the register pair base register specified by the addressing specification code AsA2A1Ao 2 1 in the instruction and a register A B EA Base index addressing is used when an instruction with the following operand formats is executed The register A B data is handled as a non negative number Notation rpa2 1 Description Method H A H B H EA H A H B H EA LDAX rpa2 Operation code As 0 1 0 1 Ao If base index addressing is selected using the sum of the HL register pair and the register as rpa2 the instruction is written as shown below LDAX H B A
305. the prescribed data is received The operation flow of the interrupt service routine is shown below INTSR lt a gt Error processing lt b gt lt c gt Y CTS 1 lt gt Disable reception lt e gt Set interrupt mask register lt f gt i ii RETI a receive data is checked for errors if an error is found control passes to the error handling routine Caution If the RXB datais not read out when an error is generated an overrun error will be generated again when the next receive operation is performed 134 CHAPTER 7 SERIAL INTERFACE FUNCTIONS lt b gt lt C gt lt d gt lt e gt lt f gt The receive data is stored in the memory A check is made to see if the data buffer is full if it is not control returns to the main routine PC7 output is set to 1 inactivating CTS and uPD71051 data transmission is stopped The RxE bit of the serial mode high register SMH is reset 0 and the receive operation is stopped The MKSR bit of the interrupt mask register MKH is set 1 disabling INTSR internal interrupts The interrupt service routine is shown below Either this interrupt service routine must be stored starting at the INTSR interrupt address 0028H or else a JMP instruction must be stored in that address RECV EXA Save accumulator EXX Save register SKNIT ER Test ERflag skip if ER 0 JMP ERROR Jump ERROR routine
306. tion instructions Register ADD A r Add Register to A 1 Operation code 10 1 1 0 0 0 0 1 1 0 0 0 R2 Ri 2 Number of bytes 2 3 Number of states 8 8 4 Function Adds the contents of the register r V A B C D H L specified by R2RiRo 0 to 7 to the contents of the accumulator and stores the result in the accumulator 5 Flags affected Z SK 0 HC L1 0 LO 0 CY 6 Example C Add A and C registers and store result A ADDr A Add A to Register 1 Operation code 10 1 1 0 0 0 0 0 0 1 0 0 0 Rz Ri Ro 2 Number of bytes 2 3 Number of states 8 8 4 Function rertA Adds the contents of the accumulator to the contents of the register r V A B C D E H L specified by R2RiRo 0 to 7 and stores the result in the specified register lt 5 gt Flags affected Z SK 0 L1 0 LO 0 lt 6 gt Example ADD B A Add and A registers and store the result in ADC A r Add Register to A with Carry 1 Operation code O 1 1 0 0 0 1 1 0 1 0 R2 Ri Ro 2 Number of bytes 2 3 Number of states 8 8 4 Function Adds the contents of the register r V A B C D H L specified by R2RiRo 0 to 7 to the contents of the accumulator including the CY flag and stores the result in the accumulator 5 Flags affected Z SK 0 L1 lt 0 LO lt
307. to 144 CHAPTER 8 ANALOG DIGITAL CONVERTER FUNCTIONS 8 3 4 Input voltage and conversion results Relationship between the analog input voltage input to the analog input pin ANO to AN7 and the A D conversion results a value stored in CRO to CR3 is shown in the following expression CRO to INT x 256 0 5 VAREF Or CRO to CR3 0 5 x 2 lt Vin lt CRO to 0 5 x 256 Remark A function which returns an integer in parentheses VIN Analog input voltage VAREF pin voltage CRO to CR3 CRO to CRG register value Relationship between the analog input voltage and the A D conversion results is shown in Figure 8 7 Figure 8 7 Relationship Between Analog Input Voltage and A D Conversion Results 255 254 A D conversion 253 results 1 3 2 qe Reb nis Te sms ad o 0 12 1 1 1 do 1 1 1 3 2 5 3 507 254 509 255 511 512 256 512 256 512 256 512 256 512 256 512 Input voltage Vaner 145 CHAPTER 8 ANALOG DIGITAL CONVERTER FUNCTIONS 8 3 5 Example of analog digital converter program The example of an analog digital converter program given here stores the A D conversion values for pins ANO to AN7 in the memory area from 4000H to 403FH shown in Figure 8 8 Figure 8 8 Memory Map S
308. to the address at which the interrupt was acknowledged First registers flags etc other than the PSW which have been saved are restored Next a RETI instruction is executed to restore the previously saved return address and PSW in the order lower PC byte upper PC byte PSW Caution If the skip condition is satisfied by the instruction arithmetic or logical operation increment decrement shift skip or RETS instruction immediately before the SOFTI instruction the SOFTI instruction is executed and not skipped When SOFTI instruction is executed the SK flag of the PSW is saved as set 1 to the stack area Thus when the return is made from the SOFTI service routine the PSW SK flag remains set and the instruction following the SOFTI instruction is skipped Note that the 87AD series SOFTI instruction differs from that of the 87 in that the address contents saved to the stack memory are the start address of the next instruction 167 CHAPTER 9 INTERRUPT CONTROL FUNCTIONS 9 6 Interrupt Wait Time The time required from acknowledgement by the CPU of an asynchronously generated external interrupt until execution of the first instruction of the relevant interrupt service routine begins the interrupt wait time is the sum of time components II and 11 shown in Table 9 2 This interrupt wait time varies depending on the kind of instruction being executed when the interrupt occurs and the instruction timing at which the interrupt
309. tore Example of A D Conversion Result 8 9 A B F 0 1 2 3 4 5 6 7 4000H lt ANO 4008H lt AN1 4010H lt AN2 4018H lt AN3 4020H lt ANA 4028H lt AN5 4030H lt ANG 4038H lt In this programming example the A D converter is set to the scan mode First four A D conversion operations are performed on pins ANO to AN3 and the ANO to AN3 conversion results are stored in areas 4000H to 4003H 4008H to 400BH 4010H to 4013H and 4018H to 401BH respectively Next four A D conversion operations are performed on pins AN4 to AN7 and the AN4 to AN7 conversion results are stored in areas 4020H to 4023H 4028H to 402BH 4030H to 4033H and 4038H to 403BH respectively Then conversion is performed again on pins ANO to AN3 and the ANO to AN3 conversion results are stored in areas 4004H to 4007H 400CH to 400FH 4014H to 4017H and 401CH to 401FH respectively Finally conversion is performed on pins AN4 to AN7 and the AN4 to AN7 conversion results are stored in areas 4024H to 4027H 402CH to 402FH 4034H to 4037H and 403CH to 403FH respectively An example of a program which repeats the above operations show below First the operation flow for initialization is shown in the following flowchart 146 CHAPTER 8 ANALOG DIGITAL CONVERTER FUNCTIONS Set memory address P HL lt 4000H Set counter b Set A D channel mode register lt c gt Reset INTFAD lt
310. trol pin 2 1 14 Analog The A D converter power supply supply pin 28 CHAPTER 2 PIN FUNCTIONS 2 1 15 AVss Analog Vss The A D converter GND pin 2 1 16 STOP Stop control input The hardware STOP mode control pin oscillation is stopped when this pin is driven low 2 1 17 1 X2 Crystal Crystal connection pins for internal clock oscillation When the clock is supplied from off chip the clock should be input to X1 and the inverted X1 clock to X2 2 1 18 RESET Reset Input The low level active reset pin 2 1 19 positive power supply pin 2 1 20 Vss GND potential 2 1 21 ICNote Internally connected pin Leave open Note OFJ package only 29 CHAPTER 2 PIN FUNCTIONS 2 2 EPROM Mode The EPROM mode can only be specified for the uPD78CP18 78CP14 2 2 1 A14 to AO Address Input The 15 bit address input pins for an EPROM wvrite verify or read operation The on chip EPROM of the 78 14 is 16K bytes in size and is therefore addressed by the lower 14 bits A13 to AO PF6 should be fixed low 2 2 2 O7 to 00 Data Input output The 8 bit data input output pins for an EPROM wvrite verify or read operation 2 2 3 CE Chip enable Input The Chip Enable signal input pin 2 2 4 OE Output enable Input The Output Enable signal input pin 2 2 5 MODE1 MODEO Mode Input The MODE1 pin should be set to 0 low level the MODEO pin to
311. ts 15 8 of the program counter and loads the contents of the C register into the low order 8 bits PC7 0 and jumps to the address indicated by the BC register lt 5 gt Flags affected SK 0 L1 0 10 0 316 CHAPTER 14 INSTRUCTION SET CALF word Call Subroutine in Fixed Area lt 1 gt lt 2 gt lt 3 gt lt 4 gt lt 5 gt Operation code 10 1 1 1 1 Number of bytes 2 Number of states 13 7 Function 5 1 PC 215 8 5 2 PC 27 0 SP lt 5 2 PCi5 11 00001 PCi0 0 lt fa Stores the high order 8 bits of the start address of the next instruction in the stack memory indicated by 5 1 and stores the low order 8 bits in the stack memory indicated by 5 2 then loads 00001 into the high order 5 bits PC15 11 of the program counter and loads the 11 bit immediate data fa into the low order 11 bits 0 and jumps to the address indicated by the immediate data A label or number from 800H to FFFH 2K byte range should be directly as the operand of the CALF instruction Flags affected SK 0 L1 0 L0 0 CALT word Call Table Address lt 1 gt lt 2 gt lt 3 gt lt 4 gt Operation code 1 0 0 Number of bytes 1 Number of states 16 4 Function SP 1 PC 115 8 5 2 lt PC 17 0 SP 5 2 PC7 0 lt 128 2ta PCis 8 lt 129 2ta 15 8765 10 0000000010 ta 0 Effective address Effective address High ad
312. ts EAL of the extended accumulator into the low order 8 bits PC7 0 and jumps to the address indicated by the extended accumulator 5 Flags affected SK 0 L1 0 L0 0 315 CHAPTER 14 INSTRUCTION SET 14 6 13 Call instructions CALL word Call subroutine direct 1 Operation code O 1 0 0 0 0 0 0 High address 2 Number of bytes 3 3 Number of states 16 10 4 Function 5 1 lt PC 315 8 5 2 lt 37 SP lt 5 2 lt word Stores the high order 8 bits of the start address of the next instruction in the stack memory indicated by 5 1 and stores the low order 8 bits in the stack memory indicated by 5 2 then loads the immediate data in the 2nd byte into the low order 8 bits PC7 0 of the program counter and loads the immediate data in the 3rd byte into the high order 8 bits 15 and jumps to the address indicated by the immediate data lt 5 gt Flags affected SK 0 L1 0 10 0 CALB Call subroutine BC indirect 1 Operation code O 1 0 0 1 0 0 0 2 Number of bytes 2 lt 3 gt Number of states 17 8 lt 4 gt Function SP 1 PC 215 8 SP 2 PC 27 0 SP lt 2 PCis 8 B PC7 0 lt Stores the high order 8 bits of the start address of the next instruction in the stack memory indicated by SP 1 and stores the low order 8 bits in the stack memory indicated by SP 2 then loads the B register into the high order 8 bi
313. ts of the immediate data in the 2nd byte and skips if the result is zero 5 Flags affected 12 5 116 0 1060 OFFI byte Off Test Immediate with Register 1 Operation code 10 1 1 1 0 1 0 0 2 Number of bytes 3 lt 3 gt Number of states 11 11 lt 4 gt Function rAbyte Skip if zero Obtains the logical product of the contents of the register V A B C D E H L specified by RzR1Ro 0 to 7 and the immediate data in the 3rd byte and skips if the result is zero 5 Flags affected ZSK11 0 L0 0 OFFI sr2 byte Off Test Immediate with Special Register 1 Operation code 10 1 1 1 0 0 2 Number of bytes 3 3 Number of states 14 11 4 Function sr2 Abyte Skip if zero Obtains the logical product of the contents of the special register sr2 PA PB PC PD PF MKH MKL ANM SMH EOM TMM specified by 53525150 0 to 3 5 to 9 D and the immediate data in the 3rd byte and skips if the result is zero lt 5 gt Flags affected 12 5 116 0 1060 284 CHAPTER 14 INSTRUCTION SET 14 6 6 Working register operation instructions ADDW wa Add Working Register to A 1 Operation code 10 1 1 1 0 1 0 0 1 1 0 0 0 0 0 lt 2 gt Number of bytes 3 lt 3 gt Number of states 14 11 lt 4 gt Function A V wa Adds the contents of the working register addressed by the V register high order 8 bits and the immediate data
314. uding the SOFTI instruction are divided into 6 groups each of which is assigned a different priority The interrupt addresses for the 6 interrupt request groups and the SOFTI instruction are fixed and are shown in Table 9 1 Table 9 1 Priorities and Interrupt Addresses 2 Internal Interrupt Address Priority Interrupt Request External Decimal Hexadecimal External Falling edge non maskable interrupt Internal Match signal from TIMERO Match signal from TIMER1 External Rising edge Falling edge Internal Match signal from timer event counter Match signal from timer event counter Cl pin or TO fall signal A D converter interrupt Serial reception interrupt Serial transmission interrupt SOFTI instruction 153 CHAPTER 9 INTERRUPT CONTROL FUNCTIONS 9 1 Interrupt Control Circuit Configuration The interrupt control circuit consists of a request register a mask register a priority control a test control an interrupt enable F F F F and a test flag register Figure 9 1 Interrupt Control Circuit Block Diagram Test Skip control control LE Mask SOFTI 4 register T Interrupt INTAD IE F F generation INTST Priority control z m e Request register OV ER Test flag SB register 7 4 Internal bus 1 Request register Th
315. uld be connected as shown in Table 13 3 Table 13 2 PROM Programming Modes 6 2 Operating Mode Program Program verify Program inhibit Read Output disable Standby Notes 1 These pins correspond to the uPD27C256A 2 uPD78CP14 only Caution When is set to 12 5 V and to 6 V driving CE and OE low is inhibited Table 13 3 Recommended Connection of Unused Pins In PROM Programming Mode Pin Name Recommended Connection Connect to Vss X1 ANO to AN7 VAREF AVss Pins other than the above Connect to Vss individually via a resistor 2 Leave open 208 CHAPTER 13 PROM WRITE AND VERIFY OPERATIONS uPD78CP18 78CP14 ONLY 13 2 PROM Writing Procedure The procedure for writing data to the PROM is as shown below allowing high speed writing Connect unused pins to Vss with a pull down resistor Supply 6 V to the pin and 12 5 V to the VPP pin 2 Supply initial address 3 Supply write data 4 Supply a 1 ms program pulse active low to the CE pin b Verify mode If written go to 7 if not written repeat 3 through 5 If not written after 25 repetitions go to 6 6 Halt write operation due to defective device 7 Supply write data and supply times repeated in 3 through 5 x x 3 ms program pulse additional write 8 Increment address 9 Repeat
316. upt requests masked by the mask register are not checked If two or more interrupt request flags have been set simultaneously their priorities are checked The interrupt with the highest priority is acknowledged and the others are held pending When an interrupt request is acknowledged the interrupt request is automatically reset If two types of interrupt requests with the same priority have both been unmasked by the mask register the interrupt request flag is not reset This is because the two types are identified by software at a later stage When an interrupt request is acknowledged the IE F F is reset and all interrupts except non maskable interrupts and the SOFTI instruction are placed in the disabled state DI state The PSW upper PC byte and lower PC byte are saved to the stack memory in that order The program jumps to the interrupt address These interrupt operations are automatically carried out in 16 states The pending interrupt requests are acknowledged if there are no other interrupt requests of higher priority when interrupts are enabled by execution of the El instruction With maskable interrupts there are two types of interrupt requests with the same priority and same interrupt address Unmasking both types unmasking one type or masking both kinds can be selected by setting the mask register 163 CHAPTER 9 INTERRUPT CONTROL FUNCTIONS 1 When both types are unmasked The corresponding bits of
317. ut makes it possible to differentiate between a power on start and a start due to release of the software STOP mode see Figure 10 5 A set 1 SB flag indicates a power on start and a reset 0 SB flag indicates a start due to release of the software STOP mode 175 CHAPTER 10 CONTROL FUNCTIONS Figure 10 5 SB Flag Operation E RESET SB flag CPU operation Software STOP mode Notes 1 Execution of address 0 instruction 2 Execution of SKIT SB or SKNIT SB instruction 3 Execution of STOP instruction 2 Release by NMI pin input 176 When the non maskable interrupt request flag is set i e when the NMI pin input changes from high to low in the software STOP mode the software STOP mode is released and simultaneously clock oscillation starts When clock oscillation starts the timer upcounter starts counting up from OOH in accordance with the setting before execution of the STOP instruction CPU operation is started by a match signal wait time taking account of the oscillation stabilization time from the TIMER1 upcounter In this case the upcounter match signal does not set the interrupt request flag The timer mode register of the timer after generation of the match signal is set to FFH and timer operation is stopped After the elapse of the oscillation stabilization time the program jumps to the interrupt address 0004H irrespective of the interrupt enabled disabled EI DI state an
318. ve address 00000000 10 ta 0 Memory Effective address Low address Effective address 1 High address PC 14 3 4 Relative addressing The result of adding the immediate data displacement value jdisp1 in the low order 6 bits of the operation code to the start address of the next instruction is loaded into the PC and a jump is performed The displacement value is handled as signed two s complement data 32 to 31 with bit 5 as the sign bit This is performed when the following instruction is executed JR word Operation code jdisp1 15 0 T 15 654 0 Lo xXx s I jdisp1 15 0 5 0 O s 5 1 AI 1 s 218 CHAPTER 14 INSTRUCTION SET 14 3 5 Extended relative addressing The result of adding the 9 bit immediate data displacement value jdisp in the instruction to the start address of the next instruction is loaded into the PC and a jump is performed The displacement value is handled as signed two s complement data 256 to 255 with bit 8 bit O of the 1st byte of the operation code as the sign bit This is performed when the following instruction is executed JRE word 0100111 jx 0 X AII O s 1 X2 All 1 s 219 CHAPTER 14 INSTRUCTION SET 14 4 Operand Address Addressing There are several methods addressing methods as described below for specifying the register memory etc to be manipulated when executing an instruction 14 4 1 Register addressing With this address
319. vel RD signal is output from midway through T1 to the beginning of T3 External device write timing see Figure 11 15 The data write machine cycle when an external device reference instruction is executed consists of 3 states T1 to T3 The address outputs AB15 to AB8 and AD7 to ADO and the ALE signal are the same as for the read timing machine cycle The write data is output to AD7 through ADO from the beginning of T2 to the end of T3 To enable writing to the addressed device a low level WR signal is output from midway through T1 to the beginning of T3 When PD7 to PDO are set as the multiplexed address data bus AD7 to ADO and PF7 to PFO as the address bus AB15 to AB8 both the RD signal and the WR signal become high in machine cycles in which the external device is not accessed However the ALE signal is output and the contents of the internal address bus are output directly to port D and port F 201 CHAPTER 11 EXTERNAL DEVICE ACCESSES AND TIMINGS Figure 11 13 OP Code Fetch Timing T1 T2 T3 frequency ALE 15 8 7 0 AD7 0 ncs PD7 0 dress lower OP code RD Address upper Figure 11 14 External Device Read Timing T1 T2 T3 frequency ALE 1 8 Address PF7 0 ress upper AD7 0 PD7 0 Address lower j Readdaa RD NN Figure 11 15 External Device Write Timing T1 T2 Oscillator
320. ware STOP mode and hardware STOP mode 10 1 1 HALT mode When the HLT instruction is executed the HALT mode is set unless the interrupt request flag of the unmasked interrupt is set In the HALT mode the CPU clock stops and program execution also stops However the contents of all registers and on chip RAM just before the stoppage are retained In the HALT mode the timer timer event counter serial interface A D converter and interrupt control circuit are operational Table 10 1 shows the status of the uPD78C18 output pins in the HALT mode Cautions 1 Table 10 1 Output Pin Statuses Output Pin Single ChipNote 1 External Expansion PA7 to PAO Data retained Data retained PB7 to PBO Data retained Data retained PC7 to PCO Data retained Data retained PD7 to PDO Data retained High impedance PF7 to PFO Data retained Next address retainedNote 2 Data retainedNote 3 WR RD High level High level ALE High level High level Notes 1 78 18 78 14 78 14 78 12 78 11 78 18 78 14 2 Address output pin 3 Port data output pin Because an interrupt request flag is used to release the HALT mode HLT instruction execution does not set the HALT mode if even a single interrupt request flag for an unmasked interrupt is set Thus when setting the HALT mode when there is a possibility that an interrupt request flag may have been set when there is a pending interrupt one of the following proc
321. with input output specifiable bit wise Address data bus Functions as multiplexed address data bus when external memory is used PF7 to PFO AB15 to AB8 340 O output Port F 8 bit input output port with input output specifiable bit wise Address bus Functions as address bus when external memory is used APPENDIX A INTRODUCTION TO PIGGYBACK PRODUCT Pin Name WR Write strobe Input Output Function Strobe signal output for external memory write operations High level except in external memory data write machine cycles Becomes high impedance output when RESET signal is low or in hardware STOP mode RD Read strobe Srtobe signal output for external memory read operations High level except external memory data read machine cycles Becomes high impedance output when RESET signal is low or in hardware STOP mode ALE Address latch enable Strobe signal output for external latching of lower address information output to pins PD7 to PDO to access external memory Becomes high impedance output when RESET signal is low or in hardware STOP mode MODEO MODE1 Mode Set MODEO pin to 0 low level MODE1 pin to 1 high level Nete When MODEO and MODE pins are both set to 1 Nete control signal is output in synchronization with ALE NMI Non maskable interrupt Edge triggered falling edge non maskable interrupt input pin INT1 Interrupt request Edge
322. without performing any operation lt 5 gt Flags affected 5 lt 0 116 lt 0 1060 El Enable Interrupt lt 1 gt Operation code 122400 dO 7 010 lt 2 gt Number of bytes 1 lt 3 gt Number of states 4 4 lt 4 gt Function Sets the interrupt enabled state Interrupts are actually enabled after execution of the instruction return instruction etc located after the El instruction and excess stack space is not used for subsequently occurring interrupts Non maskable interrupts and the SOFTI instruction can be executed at all times without regard to the El instruction lt 5 gt Flags affected SK 0 L1 0 L0 0 lt 6 gt Example PUSH B A PUSH D Interrupt generation Interrupts disabled Next interrupt enabled POP D POP B Y El Y RETI 323 CHAPTER 14 INSTRUCTION SET Disable Interrupt 1 Operation code 1 0 1 1 1 010 2 Number of bytes 1 3 Number of states 4 4 4 Function Sets the state in which all interrupts except non maskable interrupts and interrupts generated by the SOFTI instruction are disabled Execution of the DI instruction sets the interrupt disabled state during execution of the DI instruction lt 5 gt Flags affected SK 0 L1 0 L0 0 lt 6 gt Example CALL JYUYO Interrupts enabled v JYUYO PUSH PUSH PUSH PUSH DI Interrupts enabled lt

Download Pdf Manuals

image

Related Search

Related Contents

Manual de usuario  isoslim  Oregon BA900H User's Manual  D.05.002 Titel - Migros  qPCRsoft Software for REAL-TIME PCR Thermal  Istruzioni per l`uso SCHICK – Set per fresare le ceramiche  STR-V333ES/V444ES  Calderas de leños KWB Classicfire 20-50kW  ! AVERTISSEMENT - Napoleon Products  manual de instruções maestro 18 / 36 sws  

Copyright © All rights reserved.
Failed to retrieve file