IEC60601-1-8 Audible Alert Generator
NXP has published an application note (AN10875) on the generation of audible alert signals that comply with the IEC60601-1-8 standard. The application note provides example code for the LPC1768. The algorithm generates tone sequences consisting of a basic frequency and 4 harmonics. Each note has a rising and falling amplitude slope.
There are 8 basic alarms in high and medium priority modes. In addition a general low priority alarm is also available. The high priority alarms consist of a 5 tone sequence that is repeated twice. The medium priority alarms consist of 3 tones that are repeated only once.
The tones are not stored samples, but they are generated on the fly using the Goertzel algorithm. The samplerate is 25 KHz and the DAC output (p18) provides the analog soundoutput.
Code Port to mbed
The original code was written in 'C'. I ported the code to C++ and modified it to use the mbed libs. Summary of changes:
- Ported number of separate files to the new IEC60601 Class.
- Replaced low level timer interrups with mbed Ticker class
- Replaced low level serial port functions with mbed Serial class
- Replaced some hardcoded ints with enum types
- Replaced some ints used as booleans with bool type
- Cleaned up the command handler to test the audio alerts
This was a relatively straighforward process. The main issues were some problems with some variables defined as 'unsigned chars' that actually needed to be declared as 'int' or 'short int' since the range was larger that 255. Must have been due to the original compiler that probably mapped a 'char' onto 'int'.
The tone sequences sound pretty good. The application notes show some spectral analysis plots of the basic frequency and the harmonics. I measured the approximate processor load of the algorithm. The interrupt is called every 40 us (25 KHz) and takes about 0.25us when the tonegenerator is idle. That increases to 2.5us when a tone is being generated. One in every 25 interrupts (1 ms) takes a bit longer because the sequencer kicks in to decide on the next tone and to adapt the envelope when needed. The testsoftware takes about 30kB flash and 1kB RAM.
As explained in the application note, you need to add a low-pass filter on the DAC output (p18). I also used a 1uF series capacitor to remove the DC component before connecting the output to a headphone or amplifier.
The code can be easily modified to generate other or more alert sequences. You can define new tones (basic frequency and harmonics), pure tones (only basic frequency), tone sequences (controlling start-stop times and envelopes) as you like. The tones are defined in tables '_FreqArray' and '_TuneSequence'. A sequencer using a simple switch defines the start-stop times for each tone using a 1 ms resolution. See for example '_HighPriSequence()'.
- NXP Application Note AN10875 http://www.nxp.com/documents/application_note/AN10875.pdf
- NXP Documentation http://ics.nxp.com/support/design/microcontrollers/iec.alarm/pdf/documentation.pdf
- NXP Source Code http://ics.nxp.com/support/design/microcontrollers/iec.alarm/
- Example sounds http://itee.uq.edu.au/~cerg/misc/alarms.htm
The mbed version is here http://mbed.org/users/wim/programs/mbed_audio_alert/ma955e
Have fun !
1 comment on IEC60601-1-8 Audible Alert Generator:
Please log in to post comments.
Recently, I have ported this code into a PIC32CM microcontroller. Unfortunately, the tones are quite rough with a correct melodies. I wonder if I run the main clock and the DAC kind of slow