1 introduction of holtek ht-46 series mcu. 2 content family of a/d type mcu 1. cost-effective a/d...

60
1 Introduction of Holtek HT-46 series MCU

Upload: adam-pitts

Post on 17-Dec-2015

239 views

Category:

Documents


9 download

TRANSCRIPT

Page 1: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

1

Introduction of Holtek HT-46 series MCU

Page 2: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

2

ContentFamily of A/D Type MCU

1. Cost-Effective A/D type MCU2. A/D type MCU3. A/D with LCD type MCU4. A/D with VFD type MCU5. A/D with OPA type MCU

Detail of HT46R241. Features of HT46R242. Block Diagram3. Function Description(ROM, RAM, Interrupt, I/O, Timer,

Buzzer, Oscillator, ADC, I2C, PWM, ….)

Page 3: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

3

Cost-Effective A/D Type MCU

Page 4: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

4

A/D Type MCU

Page 5: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

5

Features of HT46R24

Page 6: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

6

Block Diagram

Page 7: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

7

HT46X24 Pin Assignment

Page 8: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

8

Program ROM and Interrupt Vector

Page 9: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

9

RAM MAPPINGSpecial Purpose Data Memory General Purpose Data Memory

00h IAR0 10h TMR1L 20h HADR

01h MP0 11h TMR1C 21h HCR

02h IAR1 12h PA 22h HSR

03h MP1 13h PAC 23h HDR

04h BP 14h PB 24h ADRL

05h ACC 15h PBC 25h ADRH

06h PCL 16h PC 26h ADCR

07h TBLP 17h PCC 27h ACSR

08h TBLH 18h PD 28h PF

09h N.A. 19h PDC 29h PFC

0ah STATUS 1ah PWM0

0bh INTC0 1bh PWM1

0ch TMR0H 1ch PWM2

0dh TMR0L 1dh PWM3

0eh TMR0C 1eh INTC1

0fh TMR1H 1fh N.A.

2ah

.

.

.

.

3fh

N.A.

40h

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

ffh

BANK 0

40h

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

ffh

BANK 1

Page 10: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

10

Arithmetic ADD, SUB…

Increment & Decrement INC, INCA, DEC…

Logic Operation AND, OR, XOR…

Rotate RR, RRC, RL…

Data Move MOV…

Bit operation SET, CLR…

Table Read TABRDC, TABRDL

Branch JMP, SZ, RET, RETI…

Miscellaneous NOP, SWAP, HALT…

63 Instructions

Page 11: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

11

Arithmetic

Page 12: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

12

Logic, Increment, Decrement

Page 13: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

13

Rotate, Data Move, Bit Operation

Page 14: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

14

Branch

Page 15: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

15

Table Read ,Miscellaneous

Page 16: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

16

Indirect addressing Register: IRA0,IRA1.

Memory Pointers: MP0,MP1.

Indirect Addressing

Page 17: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

17

Status Register

Page 18: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

18

I/O Structure

Page 19: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

19

InterruptInterrupt has priority issue.

Once an interrupt subroutine is serviced, all the other interrupts will be block ( by cleaning the EMI flag).

After the subroutine set the “RETI”, the EMI will be set again.

Page 20: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

20

Interrupt control register

Page 21: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

21

Interrupt Scheme

Page 22: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

22

Timer/Event Counter 0

Page 23: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

23

Timer/Event Counter 1

Page 24: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

24

Timer Control Register 0

Page 25: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

25

Timer Control Register 1

Page 26: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

26

3 modes available for the Timer/Counter

1. Timer Mode

2. Event Counter Mode

3. Pulse Width Mode

Page 27: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

27

4 steps to setup in the Timer Mode

1. Set to Timer Mode by writing 10 to TM1, TM0

2. Set the initial timer TMR value

3. Enable the corresponding interrupt by setting the ETI and EMI bit

4. Start the Timer by setting the TON bit of the TMRC

Page 28: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

28

5 steps to setup in the Even Counter Mode

1. Set to Event Counter Mode by writing 01 to TM1, TM0 2. Select TE=1 to count on the falling edge or TE=0 to count on the

rising edge 3. Set the Timer initial value into TMR 4. Enable the corresponding interrupt by setting the ETI and EMI bits 5. Start the Timer by setting the TON bit in the TMRC register

Page 29: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

29

5 steps to setup in the Pulse Width Measurement Mode

1. Set to Pulse Width Mode by writing 11 to TM1, TM0

2. Select TE=1 to measure a High Pulse Width and TE=0 to measure a Low Pulse Width

3. Set the Timer initial value, TMR, usually set to 0H for Pulse Width Measurements 

4. Enable the corresponding interrupt by setting the ETI and EMI bits

5. Start the Timer by setting the TON bit in the TMRC

Page 30: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

30

PFD and BuzzerPFD is programmable frequency divider.PFD is pin shared with PA3(selected via configuration optional).Clock source of PFD is come from timer0 or timer1 overflow signal (selected via configuration optional).PFD output is controlled by switch on/off PA3.

Page 31: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

31

Watchdog TimerThe watchdog timer is provided to prevent program uncontrollable .3 clock sources can be selected as watchdog timing source: (by configuration) T1(fsys /4) , 32KHz RTC, WDT OSC output. At HALT, only WDT OSC or RTC oscillator is still running.

Page 32: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

32

Watchdog RegisterIf watchdog timeout ,the system will be reset. The status bit “TO” will be set.There are two method of using software to clear watchdog timer (selected by configuration) : One instruction : CLR WDT Two instruction : CLR WDT1, CLR WDT2

Page 33: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

33

PWM

PWM is Pulse Width Modulator.

There are two modes 6+2 or 7+1 selected by configuration.

User can change the duty cycle by software by writing data to PWM0~PWM3 special data

register.

PWM function can be controlled On/Off by software. Enable PWM output : SET PD0 Disable PWM output : CLR PD0

Page 34: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

34

PWM 6+2 Mode

Page 35: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

35

PWM 7+1 Mode

Page 36: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

36

Analog to Digital Converter

The HT46R24 has a 10-bit ADC. ADC can be disabled by software.Max. 4 or 8 channels can input to the ADC. Channels set in ADCR by software

ADC channels are pin-shared with Port B. As ADC input or Port B set in ADCR by software

Input range is from 0 to VDD.Min. ADC clock period is 1 us.ADC sampling time is 32 ADC clocks.ADC convert time is 76 ADC clocks.Max. INL ± 1 LSB.

Page 37: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

37

ADC Convert Data Register

ADRL/ADRH are two registers to store the ADC convert data.

Page 38: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

38

A/D Convert Control Register

Page 39: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

39

A/D Convert Clock Source Register

Page 40: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

40

A/D Convert Timing Diagram

Page 41: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

41

I2C Bus Interface

I2C bus is a bidirectional 2-wire serial interface. SCL : serial clock pin. SDA : serial data pin.

I2C output is of open drain . An external pull high resistor is needed.HT46 series I2C bus is only operates in Slave mode. For Master mode , user can implement by software.

Page 42: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

42

Data transfer on the I2C-bus

Page 43: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

43

I2C relative Registers

I2C Slave Address Register - HADRI2C Input/Output Data Register – HDRI2C Control Register –HCR.I2C Status Register – HSR.

Page 44: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

44

HADR Register

Page 45: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

45

HDR Register

Page 46: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

46

HCR Register

Page 47: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

47

HSR Register

Page 48: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

48

I2C Bus Communication

STEP1 Write the slave address of

the microcontroller to the HADR.

STEP2 Set the HEN(bit7 of HCR)

to 1 to enable the I2C bus.

STEP3 Set the EHI(bit2 of INTC1)

to 1 to enable I2C interrupt

Page 49: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

49

I2C Bus ISR Flow Chart

Page 50: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

50

HALT

The system oscillator will be turned off.All of the I/O ports and RAM remain unchanged.The WDT will be cleared and resume counting if the WDT clock source is selected to come from the WDT oscillator.The PDF is set and the TO is cleared.

Page 51: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

51

How to wake up from HALT mode

External Reset

External Interrupt

Falling edge signal on port A

WDT overflow

Page 52: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

52

RESET

Power on reset

Reset pin reset

Low Voltage Reset

WDT reset

Page 53: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

53

Power on Reset

Page 54: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

54

Low Voltage Reset

Page 55: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

55

Register Initial Status (1)

Page 56: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

56

Register Initial Status (2)

Page 57: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

57

Register Initial Status (3)

Page 58: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

58

Application Circuit

Page 59: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

59

Configuration Options

Page 60: 1 Introduction of Holtek HT-46 series MCU. 2 Content Family of A/D Type MCU 1. Cost-Effective A/D type MCU 2. A/D type MCU 3. A/D with LCD type MCU 4

60

Q & A