|
|||||||||||
|
Technical Support On-Line Manuals µVision User's Guide |
Impulse PatternsThe following Signal Function generates a signal impulse pattern as it is typical in many embedded systems. In this case it is the input of a DTMF receiver as they are common in telecom applications.
//
// Generate Input Signal Pattern from a DTMF Receiver
//
signal void SendDtmf (unsigned char digit) {
if (digit == 0) digit = 10;
PORT2 = (PORT2 & 0x07) | (digit << 4);
swatch (0.06);
PORT2 |= 0x8;
}
signal void Send (void) {
SendDtmf (12); // send digit 12 = '*'
swatch (0.12);
SendDtmf (7); // send digit 7
swatch (0.12);
SendDtmf (2); // send digit 2
swatch (0.12);
SendDtmf (11); // send digit 11 = '#'
}
The above Signal Function generates the following input pattern on Port 2.
| ||||||||||
|
|||||||||||