|
||
May 7, 1998Circuit translates A law to m lawRolando Herrero, Instituto Tecnológico de Buenos Aires, Argentina
Alternatively, with m law, also included in Figure 2, all but the first segments have a wider dynamic range and thus more spaced quantization levels (for 4 bits) compared with A law. Instead of 12 bits, 13 bits imply a wider dynamic range but a worse resolution for low input levels. Figure 2 also illustrates the loss of resolution when converting the output A of A law to output A' of m law. Depending on the law, either 8 bits (A law) or 4 bits (m law and higher quantization levels) represent the value, therefore, the transitions occur faster around output A than around output A'. For the A to A' translation, the slope of A law is twice the slope of m law. Although information loss occurs during the conversion of value A, the same is not true for B. For B, the A law and m law slope are the same, and the quantization level is the same. Thus, the difference between B and B' involves only a translation and a change of segment (B in S4, B' in S3). A simple comparison shows that the A value suffers a translation and a loss of information but remains in the same segment after conversion. The design of the encoder must take into account the A law signal's segment and offset value, as does the following algorithm for which the A law input signal is PSD, and the m law output signal is QRE, for which P,Q=polarity (1 bit), S,R=segment (3 bits) and D,E=value (4 bits): If S=0, then Q=P, R=S, and E=D. According to this algorithm, the conversion requires both addition and subtraction, depending on S and D. You can express each subtraction as an addition to implement both in the same circuit. Thus, you can express the algorithm as follows, where CO=Carry out: If S=2 and D<8, then Q=P, R=S1, Z=8, and E=D+Z (CO=0). The value of Z depends on S: Z=25S. Once you define Z, the algorithm performs the same D+Z operation for each S. The carry-out (CO) signal determines whether R is equal to S or S1. Therefore, this implementation simultaneously solves two problems. Furthermore, the same technique applies for S=6 and S=7, when Z=0. In Figure 1, a 3x8 decoder, IC1, converts S to Z, which IC2 adds to D. If the CO is a 1, E is (D+Z)/2; otherwise, R is S1. To choose between both options, the circuit uses the CO signal to control data selectors IC4 and IC5. These devices select between two possible outputs: S or S1 and D+Z or (D+Z)/2, respectively. A second adder, IC3, implements S1 by summing the S inputs with 15. The circuit derives (D+Z)/2 by shifting D+Z into the inputs of data selector IC5. Additional logic ensures that no conversion occurs when S=0 and that E=D/2 when S=1. The 8-bit input is P0/S2/S1/S0/D3/D2/D1/D0, and the 8-bit output is P0/R2/R1/R0/E3/E2/E1/E0. The schematic doesn't show P0 because this parameter's value doesn't change. The circuit was tested with a Motorola (www.mot.com) MC145554 m law PCM codec-filter and an 8TR641 (AT&T, www.att.com) E1 multiplexer. (DI #2192) MCS-51 endows MicroLan-like protocol to UARTsSK Shenoy, NPOL, Kochi, India
When the master wishes to transmit a block of data to a slave, it first sends an address byte that identifies the slave. All data and address bytes are nine bits long. An address byte differs from a data byte in that its ninth bit is one (for a data byte it's zero). The communication subsystem normally initializes in a mode where the serial-port interrupt activates only when the ninth bit is one. Thus, no slave receives an interrupt from a data byte. An address byte, however, interrupts all slaves, which then examine the received byte. Next, the addressed slave switches to a mode in which data bytes also receive interrupts, while other slaves go about their business uninterrupted by the data transfer. The address bytes thus control the data flow into a particular node. Indication of the end of a data block can come from either sending a data-length field at the beginning of the block or from the receipt of another slave or reserved address.
A global variable, Receive_Count, initialized to zero, handles frame reception. Initially, the protocol enables only receive-error interrupts. Each time the routine detects a break, the UART raises a receive-error interrupt, and the ISR (interrupt service routine) then enables the receive-data interrupts. On subsequent receive interrupts, if Receive_Count is zero, the ISR checks if the first address byte matches the station's address. If not, the receiver goes back to the initial waiting state, with the receive-error interrupts enabled and the receive-data interrupts disabled, such that the routine ignores the subsequent data bytes. If an address match occurs, the ISR stores the subsequent incoming data bytes in the receive buffer, with Receive_Count as index. If Receive_Count is nonzero when the break interrupt occurs, it is an end-of-frame break. Then the routine calls the frame-processing function, Receive_Count resets to zero, and the receiver again reverts to the initial waiting state. To transmit a break, the protocol sets bit 6 (set break) of the line-control register to one. The UART then takes its transmission line low until bit 6 receives a zero. To make the duration of the break equal to one character-transmission delay, the routine transmits a null (00 hex) character. Bit 6 of the line-control register (transmit machine status) indicates when this delay is over; the break bit then resets. To enable detection of the break, bit 2 of the interrupt enable register (interrupt on receive error condition) sets during UART initialization. Bit 0, set to one, enables receive data interrupts. In the ISR, bits 1 and 2 of the interrupt-identification register indicate the interrupt type. In this scheme, no CPU overhead is wasted examining each character to detect addresses/packet boundaries. Also, a slave must process only three interrupts per data packet transmitted on the bus, and blocks of data not addressed to the slave do not disturb it. Because the break is not a legitimate data character, it is data transparent; you can use it for binary-data exchange. The packet-boundary detection is immune to data errors. You can make it even more robust by including data-length and check-sum fields in the frame to enable error detection. You can also use parity error detection. Note that the method can support broadcast/multicast message transfer by designating some addresses for these purposes. You can also implement any-node-to-any-node communication by polling the master, as in the SDLC protocol. (DI #2193) Voltage monitor prevents deep discharge of batteryRoger Kenyon, Maxim Integrated Products, Sunnyvale, CA
IC1 is a voltage monitor with an open-drain latched output. Normally high, the output latches low when the battery voltage drops below VTH. Once triggered, the output remains low even when the now-unloaded battery voltage rebounds to a level above VTH. This behavior prevents the oscillation that would otherwise occur as connect/disconnect action causes the battery voltage to fluctuate. To reset the latch, the CLEAR input must go high for a minimum of 1 m sec.
To set a different value of VTH, choose a convenient value for R1, and then calculate R2: R2=R1xVTH/(1.2041). IC2 limits its switch current at a level that the value of R4 determines: ILIMIT=1240/R4, where R4 is in ohms and ILIMIT is in amperes, with a maximum of 1A. For the R4 value in Figure 1, this limit is 500 m A. (DI #2191) Add switch-and-LED I/O to DSP's serial portStan Sasaki, Twenty-First Designs, Lake Oswego, OR
A single instruction reads the switches or writes to the LEDs. For example, the instruction AR=RXn transfers the last switch value from the receiver of serial port n into the 16-bit accumulator, AR. Note that n can be either 0 or 1, depending on which on-chip serial port you use. Similarly, the instruction TXn=AR transfers the 16-bit value in AR to the transmitter of serial port n, and on to the LEDs. You must configure the serial port to operate with the frame-sync types and signal polarities the circuit expects. In this case, the 16-bit value you must write to the serial port n control register is 6FCF. Because 16 LEDs can draw more than 100 mA, you may need to provide external power if the circuit under test cannot supply the necessary current. Because HC parts operate at 3 and 5V, this circuit works for both 3 and 5V ADSP devices. However, for 3V operation you may need to lower the SCLK speed to meet HC performance. (DI #2196) DSO-triggering scheme is cheap and efficientRobert Perrin, Z-World, Davis, CA
The flash IC serves as a decoder. The entire address space is filled with zeros, except for a single one at the address that corresponds to the mP bus state of interest. The DSO can trigger on the D0 line of the flash chip, and begin recording events at the bus cycle of interest. Shorting blocks, used with JP0 through JP16, configure the address pins corresponding to the trigger condition. The mP bus signals required to detect the trigger condition attach to the open address lines in the flash IC. You can program multiple bus conditions to generate a trigger on the same data line. Other data lines can generate additional trigger conditions. The design in Figure 1 uses a 70-nsec flash chip. The
speed is actually irrelevant, because DSOs can acquire and display pretrigger information.
The absolute timing of the trigger is arbitrary. The relative timing of the bus signals is
the parameter of interest. The DSO displays pretrigger and posttrigger data properly. As a
result, you'll have a solid picture of the bus signals for evaluation. Piezo device generates buzz, beep, or chimeDennis Eichenberg, Parma Heights, OH
The circuit in Figure 1a produces a true buzzer sound. The addition of an F336HD flashing LED (part number 276-036 at Radio Shack) in Figure 1b changes the alarm to a beeper, and it also provides a visual alarm. The LED produces a constant pulse of light at approximately 1 Hz without the addition of a time-constant capacitor. The LED starts immediately when you apply power, and it's insensitive to temperature variations. The addition of a 35-mF capacitor in parallel with the buzzer (Figure 1c) changes the audible alarm to a pleasing chime. The value of the capacitor is not critical; you can obtain various sound effects by varying it. (DI #2194) |
||
| EDN Access | Feedback | Table of Contents | |
||
| Copyright © 1997 EDN Magazine, EDN Access. EDN is a registered trademark of Reed Properties Inc, used under license. EDN is published by Cahners Publishing Company, a unit of Reed Elsevier Inc. | ||