15
BA45FH0082 + HT45F2020 Networked Encoded Sound and Light Alarm Application AN0513E V1.00 1 / 15 February 12, 2019 BA45FH0082 + HT45F2020 Networked Encoded Sound and Light Alarm Application S/NAN0513E Overview Holtek’s BA45FH0082 Flash MCU and Sound Effect Generator Flash MCU, the HT45F2020, are used for fire protection system terminal devices and products with custom sound effects. This application example illustrates the functions and features of these two devices. It demonstrates how the power supply line data communication receiving/transmitting operation is implemented to generate sound effects using the sound platform. Audible and light alarms are an indispensable feature of fire protection system. Their main purpose is that when the detector senses an environmental abnormality, the host will send a start command to the sound and light alarm, after which a warning signal is sent to warn people of the danger using sound and light. The sound and light alarm can be divided into two types, a non-coding type and an encoding type. As the name implies, the encoding type has a communication function and its own address, so that each optical alarm can be given different addresses via an electronic encoder. When compared with non-encoding light and sound alarms, encoded alarms have the advantages of being able to use signals to interrogate the alarms to eliminate faults, as well as being able to activate groups of alarms in specific areas. Basic Characteristics BA45FH0082 Full power-line data transceiver function Input Voltage Range: 7~42V Fully integrated low voltage dropout regulator, comparator Open drain NMOS driver Oscillator Types Internal High Speed 4MHz RC – HIRC (Accuracy ±3% @ -40°C ~ 85°C) Internal Low Speed 32kHz RC – LIRC Flash Memory: 2K×15

BA45FH0082 + HT45F2020 Networked Encoded Sound and Light

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: BA45FH0082 + HT45F2020 Networked Encoded Sound and Light

BA45FH0082 + HT45F2020 Networked Encoded Sound and Light Alarm Application

AN0513E V1.00 1 / 15 February 12, 2019

BA45FH0082 + HT45F2020 Networked Encoded Sound and Light Alarm Application

S/N:AN0513E

Overview

Holtek’s BA45FH0082 Flash MCU and Sound Effect Generator Flash MCU, the

HT45F2020, are used for fire protection system terminal devices and products with

custom sound effects. This application example illustrates the functions and features of

these two devices. It demonstrates how the power supply line data communication

receiving/transmitting operation is implemented to generate sound effects using the

sound platform.

Audible and light alarms are an indispensable feature of fire protection system. Their

main purpose is that when the detector senses an environmental abnormality, the host

will send a start command to the sound and light alarm, after which a warning signal is

sent to warn people of the danger using sound and light. The sound and light alarm can

be divided into two types, a non-coding type and an encoding type. As the name implies,

the encoding type has a communication function and its own address, so that each optical

alarm can be given different addresses via an electronic encoder. When compared with

non-encoding light and sound alarms, encoded alarms have the advantages of being able

to use signals to interrogate the alarms to eliminate faults, as well as being able to

activate groups of alarms in specific areas.

Basic Characteristics

BA45FH0082 Full power-line data transceiver function

Input Voltage Range: 7~42V

Fully integrated low voltage dropout regulator, comparator

Open drain NMOS driver

Oscillator Types

Internal High Speed 4MHz RC – HIRC (Accuracy ±3% @ -40°C ~ 85°C)

Internal Low Speed 32kHz RC – LIRC

Flash Memory: 2K×15

Page 2: BA45FH0082 + HT45F2020 Networked Encoded Sound and Light

BA45FH0082 + HT45F2020 Networked Encoded Sound and Light Alarm Application

AN0513E V1.00 2 / 15 February 12, 2019

RAM Data Memory: 128×8

True EEPROM Memory: 64×8

Watchdog Timer

8 External Channel 12-bit A/D Converter

2 Timer Module (STM)

Dual Time Base Functions can provide fixed time interrupt signals

Low Voltage Detector and Low Voltage Reset Functions

Multiple Operating Modes: NORMAL, SLOW, IDLE and SLEEP

Package Types: 16-pin NSOP and 20-pin SSOP

HT45F2020 Input Voltage Range: 8V~16V

Internal Shunt regulator output: 5V

Operating Voltage: 2.2V~5.5V

Oscillator Types

Internal High Speed RC – HIRC

Internal Low Speed 32kHz RC – LIRC

Multiple Operating Modes: NORMAL, SLOW, IDLE and SLEEP

Flash Memory: 1K×15

RAM Data Memory: 32×8

Watchdog Timer

1 Timer Module (PTM)

Single Time Base Function can provide fixed time interrupt signals

Package Types: 6-pin SOT23 and 8-pin SOP

Functional Description

Fig. 1. Internal Block Diagram

Page 3: BA45FH0082 + HT45F2020 Networked Encoded Sound and Light

BA45FH0082 + HT45F2020 Networked Encoded Sound and Light Alarm Application

AN0513E V1.00 3 / 15 February 12, 2019

Networked sound and light alarms include the functions of communication, addressing,

fault detection, illumination and audible alarms. For such solutions Holtek has the

BA45FH0082 and HT45F2020 devices. When compared with traditional solutions, which

require external buck and communication circuits, the Holtek solution fully integrates

these functions. This makes this solution suitable for other products which require power

bus communication, ADC detection, simple control and sound effects.

The BA45FH0082 includes a high 7V~42V input voltage range linear regulator (LDO), a

power bus communication receive and return code circuit, EEPROM storage, a 10-bit and

a 16-bit Timer Modules, multi-channel 12 -bit ADC, low power HIRC as well as many

other functions. In sound and light alarm systems, the main function is to manage the

Master to the Slave voltage modulation signals and the current modulated return signals.

The MCU can then determine whether to store the return signals or to take appropriate

alarm action.

The HT45F2020 includes an integrated Shunt Regulator and a 10-bit multi-function timer

to provide timing, pulse, PWM and complementary outputs. This can manage the sound

and light driving in the sound and light alarm system. Also provided is a software voice

development platform, which not only reduces the need for additional external

components but also allows for more flexible and rapid product development.

Fig. 2. Networked sound and light alarm finished product

Page 4: BA45FH0082 + HT45F2020 Networked Encoded Sound and Light

BA45FH0082 + HT45F2020 Networked Encoded Sound and Light Alarm Application

AN0513E V1.00 4 / 15 February 12, 2019

Hardware Description

Since the networked encoded sound and light alarm is a slave, if it is not controlled by a

master device, it will not be able to execute its required function. Therefore, this

application example uses an electronic encoder to act as a master to communicate with

the slave networked sound and light alarm. In this way the master can setup the control

requirements. The following shows the two hardware sections.

Fig. 3. Networked sound and light alarm circuit diagram

Fig. 1. Encoder Circuit Diagram

Page 5: BA45FH0082 + HT45F2020 Networked Encoded Sound and Light

BA45FH0082 + HT45F2020 Networked Encoded Sound and Light Alarm Application

AN0513E V1.00 5 / 15 February 12, 2019

Introduction to Power Bus Communication Principles

The communication method used by most products in fire protection products is power

bus communication transmission. It has the following communication features:

1. Power is supplied via the bus without requiring additional power connections

2. Strong anti-interference ability.

3. Long communication distances of 1000m~1500m

4. Non-polarity wiring using a bridge circuit at the slave end

5. Flexible wiring

In the data transmission mode, the master terminal uses voltage signal modulation for the

slave terminal to send commands, and the slave terminal uses current modulation for the

master terminal return message. This provides reliable communication for multi-point

slaves over long distances thus avoiding complicated wiring systems.

This application provides a simple master-slave transceiver format as shown.

v

tLogic = 1

v

tLogic = 0

1Time Constant = 80µs1Bit Time = 6×80µs = 480µs

Fig. 2. Slave reception logic level determination

The master will adjust the voltage level using the two lines of the power bus

communication. The slave will measure the length of the positive and negative half cycles

to determine the logic level. When the time in six time constants is less than 3 time

constants then the logic level is deemed to be 1, and when it is greater than 3 time

constants it is deemed to be 0.

1 Time Constant = 500µs1 Bit Time = 2×500µs = 1ms

v

tLogic = 1

v

tLogic = 0

(current reading interval)

Slave does not return code VM VM

Slave returns code

VHVH

Fig. 3. Master reception logic level determination

When the slave returns a current modulated return code, the master will adjust the

voltage to the VM voltage, and then check using a circuit detector to see whether the

slave has returned a current. The logic level is determined during the current reading

Page 6: BA45FH0082 + HT45F2020 Networked Encoded Sound and Light

BA45FH0082 + HT45F2020 Networked Encoded Sound and Light Alarm Application

AN0513E V1.00 6 / 15 February 12, 2019

interval. If the voltage remains at the VM voltage for a period of time then this is deemed

to be a logic 1, otherwise it will be deemed to be 0 when the voltage during the reading

range is lower than VM for a period of time.

Introduction to the Application Communication Protocol

The master terminal encoding format is a 4 Bit Command + 8-bit Address + 4-Bit

Checksum. The checksum calculation method is to add the instruction to the address and

then take the lower four bits. For example, if the instruction is 0000 and the address is

0x55 (01010101) then the checksum would be 0101. The slave terminal sends back a

4-bit Yes/No code. If the slave terminal determines that the code is correct, it will reply

with a Yes to the host by sending 1010. Any non-1010 bit combination will be taken as a

No. The delay time is set to be 6ms due to the maximum EEPROM write time of 6ms.

The following describes the application communication protocol of each function.

4 Bit Yes/No

8 Bit 00000000Listening

4 Bit Command

8 Bit Address

t

V

Master Delay 6ms Listening

t

V

Slave Delay 6ms

4 BitChecksum

4 BitChecksum

Fig. 4. Writing the address to the slave terminal

4 Bit Yes/NoListening

4 Bit 0001

8 Bit 00000000

t

V

Master Delay 6ms Listening

t

V

Slave Delay 6ms

4 BitChecksum

8 Bit Address

4 BitChecksum

Fig. 5. Reading the address from the slave terminal

4 Bit Yes/NoListening

4 Bit 0010

t

V

Master Delay 6ms Listening

t

V

Slave Delay 6ms

4 BitChecksum

8 Bit 00000000

4 BitChecksum

8 Bit Address

Fig. 6. Multicast Alarm/Unicast Alarm

12 Bit ADC ValueListening

4 Bit 0100

t

V

Master Delay 6ms Listening

t

V

Slave Delay 6ms

4 BitChecksum

4 BitChecksum

8 Bit 00000000

Fig. 7. Read Slave Terminal ADC Value

Page 7: BA45FH0082 + HT45F2020 Networked Encoded Sound and Light

BA45FH0082 + HT45F2020 Networked Encoded Sound and Light Alarm Application

AN0513E V1.00 7 / 15 February 12, 2019

Software Description

Networked encoder sound and light alarm S/W flow chart

● Main Program

Initialisation

N

Y

Check if 16-bit received code is

complete

Check if received code exceeds

100ms

Y

N

Get low timer value from indirect addressing

Check if greaterthan 240µs

Y N

Shift left 1 into received code

variable

Shift left 0 into received code

variable

Obtain 16-bit

Y

N

Check high 4-bit instruction

A/D conversion

Instruction=4

Save A/D value and checksum to return

code variable

Same address

Check if checksumis correct

Y

N

Sound light alarmOn/Off

Save 1010 and checksum to return

code variable

Instruction=2

Instruction=1

Obtain address from EEPROM

Save 1010 address checksum to return

code variable

Instruction=0

Save address to EEPROM

Save 1010 checksum to return

code variable

Set return code Flag=1 Initialise Variables

Initialise Variables

Y

N

Set return code send

Flag=1

Set return code send

Flag=1

Set return code send

Flag=1

Set return code send

Flag=1

Set return code send

Flag=0

Initialise Variables

START

Page 8: BA45FH0082 + HT45F2020 Networked Encoded Sound and Light

BA45FH0082 + HT45F2020 Networked Encoded Sound and Light Alarm Application

AN0513E V1.00 8 / 15 February 12, 2019

● Interrupt Subroutine

START

Received/Return code Flag=1?

RX interrupt vector rising/falling edge will both

generate interrupt

Y(Received code)

N(Return code)

RX rising edge ?

Y

Save low timer value using indirect

addressing

Stop Timer Start Timer

N

Send 1-bit return code variable

RX Low?

Y

Delay100µs

Check if 16-bit return code is sent

completely

Return code correctFlag=1?

Y

Initialise Variables

Y

N

N

RETI

N

Networked coded sound and light alarm program description

When the MCU is powered on, all the program registers are initialised, and the data

memory is cleared. The system then waits for communication from the master. When the

master sends a falling edge signal, the program will enter the interrupt. After entering the

interrupt, the program will first examine the receive/return flag. If the flag indicates a

receive code, it will enter the receive data flow. As either a rising edge or falling edge will

trigger the interrupt, examining the flag can determine which one it is. When a falling edge

triggers the interrupt, the timer is started. When a rising edge triggers the interrupt, the

timed value is stored in the data through indirect addressing. In the memory, when the

count is stored as 16-bit data, it indicates that the code is completed and it will enter the

decoding process. First is checked if that the time from the first falling edge to reception of

the 16-bit data is greater than 100ms. If it does exceed 100ms, then the data will be

discarded and await the next code. Otherwise it will enter the decoding stage. Firstly the

data previously stored indirectly will be retrieved, to determine whether it is exceeds

Page 9: BA45FH0082 + HT45F2020 Networked Encoded Sound and Light

BA45FH0082 + HT45F2020 Networked Encoded Sound and Light Alarm Application

AN0513E V1.00 9 / 15 February 12, 2019

240μs. If it does exceed 240μs, then it will be deemed to be logic 0, otherwise it will be

read as 1. The value read will be stored as the variable, and the variable will be decoded

by calculation and the master requested instruction will be executed. After the execution

has completed, a return code will be activated after which it will await a falling edge signal

from the master. Each falling edge returns 1 bit of data and a total of 16 bits of current

modulated return codes are returned.

Encoder Software Flowchart ● Main Code

Initialise

Start Timer

Timer return to zero

Scan for key press

Timer is 15s

Switch offPower supply

Battery voltage check

Battery voltage sufficient

Display change battery

Y

YNExecute correspondingkey action and display

Pressed keysame as last one

N

Y

N

Y

Generate key sound

N

START

Page 10: BA45FH0082 + HT45F2020 Networked Encoded Sound and Light

BA45FH0082 + HT45F2020 Networked Encoded Sound and Light Alarm Application

AN0513E V1.00 10 / 15 February 12, 2019

● Corresponding Key Function and Display

Corresponding key action and display

Determine level

LCM displayHOLTEK Encoder

1.Write 2.Read

Level=0 Level=1

Setup level=1

Key 1 or 2is pressed?

Y

N

Key 1 is pressed?

LCM displayWrite Address:

000(3 digits)

LCM displayRead Address:

Setup level=2Setup

instruction=0x00

Setup level=2Setup

instruction=0x01

Key 0~9 pressed?

Level=2

According to key update LCD 2nd row number

(total 3 digits) which is the address

Enter key is pressed?

N

N

Send instruction, address and checksum

Y

N

Determineif return code is

correct

N

Update LCM 2nd row display with received 3 digit address

"???" (3 digits) Error!

Y

Send instruction, address and checksum

Input mode?

Update LCM 2nd row display with updated

return code value??? (3 digits)

Return Keyis pressed?

Y

N

END

Setup level=0Initialise variables

LCD displayHOLTEK Encoder

1.Alarm 2.A/D

Setup level=4

Select1Pressed?

Determineif 3 digits

N

Update LCM 2nd row display with updated

return code value???? (4 digits)

N

Y

Y

N

Y

Y

Y

N

Determine if 3 digits received

Determineif return code is

correct

Y

N LCM 2nd row displayError!

Update LCM 2nd row displaywith received 3 digit address+1

"???" (3 digits) OK!

Page 11: BA45FH0082 + HT45F2020 Networked Encoded Sound and Light

BA45FH0082 + HT45F2020 Networked Encoded Sound and Light Alarm Application

AN0513E V1.00 11 / 15 February 12, 2019

Determine level

Level=4

Key 1 or 2is pressed?

Y

N

Key 1 is pressed?

LCM displayAlarm:

1.Broad 2.Uni

LCM displayRead A/D Value:

Setup level=5

Setup level=2Setup

instruction=0x04

N

Y

Key 1 or 2is pressed?

Y

Key 1 is pressed?

LCM displayBroadcast:

LCM displayUnicast:

000(3 digits)

Setup level=2Setup

instruction=0x02

N

Y

Return Keyis pressed?

Y

N

END

Setup level=0Initialise variables

LCD displayHOLTEK Encoder

1.Alarm 2.A/D

Setup level=4

Select1Pressed?

Level=5

Y

N N

Setup auto readON/OFF

Key 1 is pressed?

Y

N

Setup level=2Setup

instruction=0x02

Setup auto pollON/OFF

Key 1 is pressed?

Y

N

Corresponding key action and display

Encoder Software Description

The encoder functions include encoder battery voltage detection, LCD display, power

saving mode, key press sound, slave address assignment, reading the slave address,

reading the slave ADC value and activating the slave alarm.

When the MCU is powered on and enters the main program, the registers will be

initialised to detect whether the battery capacity is enough to provide communication and

then start a 15 second count. If there is no key press within 15 seconds, the MCU power

will be switched off and the power saving state entered. When a key press is detected,

the corresponding key action and display subprogram are entered. The subprograms are

divided into five levels, where level 2 is responsible for all key inputs, LCD display control

and slave communication receiving/transmitting code. All are executed within level 2. All

other levels are used to setup the corresponding function parameters after which it

returns to level 2 for execution.

Page 12: BA45FH0082 + HT45F2020 Networked Encoded Sound and Light

BA45FH0082 + HT45F2020 Networked Encoded Sound and Light Alarm Application

AN0513E V1.00 12 / 15 February 12, 2019

HT45F2020 Sound Generation Flow

Holtek has introduced the HT45F2020/HT45F2022 in response to the demand for custom

sound effects for a range of products. With its multi-programming features, customers can

program and create their own unique sound effects in response to their unique audio

requirements. The MCU also has a range of functions and features to help generate

custom audio effects. Holtek also provides a sound effect development platform, known

as the Sound Effect Generator Wizard, which can be downloaded on the Holtek website.

The platform contains 70 types of sound effects and according to the configuration

options (load, output, drive, trigger) and recommended application circuits, can provide

customer with a choice of programming selections. For operating flow details, the

question mark icon, , on the bottom right side of the platform can be selected.

Operating Description

The function display of the networked coded sound and light alarm needs to be controlled

and displayed via communication between the master and the slave. The following is

displayed through the LCD screen to show how it should be operated.

Press key 1

POWER ON

Press key 2

Write successAddress auto increase+1

Write error

Press Enter

Read success Read error

Battery capacity insufficient(6V)

Input 085, press Enter

Fig. 8. Function display (read/write address) writes address 085 to the slave and reads

Page 13: BA45FH0082 + HT45F2020 Networked Encoded Sound and Light

BA45FH0082 + HT45F2020 Networked Encoded Sound and Light Alarm Application

AN0513E V1.00 13 / 15 February 12, 2019

Press key 1

POWER ON

Press key Select1

Alarm successAddress auto+1

Alarm error

Input 085, press Enter

0~255 auto poll alarm

Press key 1(On/Off)

0~255 manual+1 alarm

Press Enter(Address+1)

Press key 1

Press key 2

Fig. 9. Function display (alarm) to make the slave address 085 alarm

Press key 2

POWER ON

Press key Select1

Auto read A/D value

Press key 1(On/Off) Press Enter

Read success Read error

Manual read A/D value

Fig. 10. Function Display (read slave terminal A/D value) – slave terminal Bandgap

= 1.2V, VDD=3.3V

Page 14: BA45FH0082 + HT45F2020 Networked Encoded Sound and Light

BA45FH0082 + HT45F2020 Networked Encoded Sound and Light Alarm Application

AN0513E V1.00 14 / 15 February 12, 2019

Application Specification Network encoder sound and light alarm specification

Operating Voltage Signal main line: 16V~28V Power main line: 20V~28V

Monitoring current ≤ 0.8mA Alarm current ≤ 55mA Operating environmental temperature -10°C~+50°C Flash frequency 1~2Hz

Sound level ≥ 85dB~120dB In front 3m level (A weighting)

Line system Dual bus (4 lines)

Conclusion

The BA45FH0082 + HT45F2020 combination has provided a flexible development

environment compared to traditional solutions by using a high level of functional

integration. The BA45FH0082 includes integrated power line data transmission, using

code and code return functions, eliminating many external components. The MCU has a

low power consumption mode and will power down with a current ≤ 1μA. There is also an

integrated LDO input voltage range of 7V~42V, reducing the need for an external LDO, as

well as a fully integrated oscillator and an ADC.

The HT45F2020 includes an integrated Shunt Regulator which eliminates the need for

external buck components. It has a software controlled fade-in function to meet the

requirements for gradual volume change. The small package types are easy to integrate

into space-limited products and a single device offers both sound and light functions. With

reduced costs, complementary output buzzer driver, the need for an external transistor

and inductor are eliminated. This combination of features, make it very suitable for home

based products, and its software development platform greatly assists users with their

product development.

Reference Material

Reference documents: BA45FH0082, HT45F2020 Datasheets.

For more information consult the Holtek website: www.holtek.com.

Version and Modification Information Date Author Issue Release and Modification

2018.11.13 楊竣崴 First version

Page 15: BA45FH0082 + HT45F2020 Networked Encoded Sound and Light

BA45FH0082 + HT45F2020 Networked Encoded Sound and Light Alarm Application

AN0513E V1.00 15 / 15 February 12, 2019

Disclaimer

All information, trademarks, logos, graphics, videos, audio clips, links and other items

appearing on this website ('Information') are for reference only and is subject to change at

any time without prior notice and at the discretion of Holtek Semiconductor Inc.

(hereinafter 'Holtek', 'the company', 'us', 'we' or 'our'). Whilst Holtek endeavors to ensure

the accuracy of the Information on this website, no express or implied warranty is given

by Holtek to the accuracy of the Information. Holtek shall bear no responsibility for any

incorrectness or leakage.

Holtek shall not be liable for any damages (including but not limited to computer virus,

system problems or data loss) whatsoever arising in using or in connection with the use of

this website by any party. There may be links in this area, which allow you to visit the

websites of other companies. These websites are not controlled by Holtek. Holtek will

bear no responsibility and no guarantee to whatsoever Information displayed at such sites.

Hyperlinks to other websites are at your own risk.

Limitation of Liability

In no event shall Holtek Limited be liable to any other party for any loss or damage

whatsoever or howsoever caused directly or indirectly in connection with your access to

or use of this website, the content thereon or any goods, materials or services.

Governing Law

The Disclaimer contained in the website shall be governed by and interpreted in

accordance with the laws of the Republic of China. Users will submit to the non-exclusive

jurisdiction of the Republic of China courts.

Update of Disclaimer Holtek reserves the right to update the Disclaimer at any time with or without prior notice,

all changes are effective immediately upon posting to the website.