Frequently Asked Question
In CipherLab 8 Series terminals, beep value in C programming and on Basic programming are different. In BASIC program, you can just set beep frequency, but in C program, you need to calculate the value. You can find the formula and example below:
Basic ProgramCompiler
- Syntax : BEEP(freq, duration)
- “freq” is an integer variable, indicating the value of beep frequency (Hz)
- “duration” is an integer variable, indicating the value of beep duration, which is specified in units of 10 milliseconds.
Example | ON READER(1) GOSUB BcrDATA_1 ... BcrData_1: BEEP(-1, 1)' Set Low BEEP(2000, 10, 0, 10, 2000, 10) BEEP(-2, 1)' Play A:\WAV\1.wav ... RETURN |
C Program
- Syntax : void on_beeper (const int *sequence);
- *sequence : Pointer to a buffer where a beep sequence is stored.
Example | const int two_beeps [] = {19, 10, 0, 10, 19, 10, 0, 0}; on_beeper(two_beeps); |
Before we use the buzzer function in C program, we need to know the following concept first.
Beep Sequence
A beep sequence is an integer array that is used to instruct how the buzzer is activated. It
comprises a number of pairs of beep frequency and duration. Each pair is one beep.
Beep Sequence = Beep Frequency, Beep Duration
**On C Compiler, You need to set the two values to enable the buzzer.
**You can find the Beep Frequency information below, the Beep Duration is specified in units of 10 milliseconds.
Beep Frequency
A beep frequency is an integer that is used to specify the frequency (tone) of the buzzer when it is activated. However, the value of the beep frequency is not the actual frequency that the buzzer generates. It is calculated by the following formula:
Beep Frequency = 76000 / Actual Frequency Desired
For example, if a frequency of 4 KHz is desired, the value of beep frequency
should be 19.
76000 / 4000 = 19