20-151-0178 Rabbit Semiconductor, 20-151-0178 Datasheet - Page 80

CABLE CONVERTER RS-232 TO USB

20-151-0178

Manufacturer Part Number
20-151-0178
Description
CABLE CONVERTER RS-232 TO USB
Manufacturer
Rabbit Semiconductor
Datasheet

Specifications of 20-151-0178

Accessory Type
USB to RS232 Adapter
Product
Microcontroller Accessories
For Use With/related Products
Rabbit-based Boards
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
Other names
20-151-0178
316-1181
This function simply activiates the tone driver. Once enabled, it consumes about 10-20% of the system’s
processor time while running. Therefore, in a real program, you might want to activate and shutdown
(using flexToneShutdown()) the tone driver when needed.
The next section of code simply builds the waveforms for the five different tones and then displays a menu
of choices to the user. We will skip down to the next RabbitFLEX-related section of code.
This section of code begins with a while loop that checks for user input. Note in particular the
flexToneLoad() call—this loads the given tone and begins playing it. The “repeat” parameter is used
to indicate how many times the tone will be repeated ( 128 means to repeat indefinitely). Following the
above section are a number of other “case” statements that load other tones and implement other com-
mands. We will skip them.
Finally, after the user has chosen to exit the program, the
called. This disables the tone driver and frees the processor for handling other tasks.
6.4.2 Extending speaker_tone.c
speaker_tone.c shows how to use the tone driver, but can we combine it with some of the other Rab-
bitFLEX I/O functionality? In this section, we will add the ability to select the tone to play via a digital
input switch, and light up a corresponding digital output LED when we select a tone.
To implement this sample, we need appropriate digital inputs and outputs. We will use the demo board
from the RabbitFLEX toolkit. We will use each of the four switches and LEDs. We will connect the
switches directly to 1.4V TTL Threshold digital inputs, and the LEDs directly to 100mA sinking driver,
40V max digital outputs.
74
// Activate the tone system
flexToneActivate();
// Continue until the user requests to exit the program
while (!request_exit) {
// Turns off the tone system. This frees up the processor for other
// tasks, but in this case, we're just exiting the program.
flexToneShutdown();
ch = getchar();
// Perform the user command
switch (ch) {
case '0':
// Play the raspy tone
flexToneLoad(tones[0], tone_len[0], repeat);
break;
www.rabbit.com
flexToneShutdown()
Applications Programming
function is

Related parts for 20-151-0178