您当前的位置:五五电子网电子知识单片机-工控设备DSP/FPGA技术由PC串口实现简单IR数据转换 正文
由PC串口实现简单IR数据转换

由PC串口实现简单IR数据转换

点击数:7467 次   录入时间:03-04 11:53:18   整理:http://www.55dianzi.com   DSP/FPGA技术

  通过从 PC串口 传输适当的十六进制值到一对 IR LED,遥控IR接收器能够实现38.4 kHz的数据传输。

  经常需要在没有直接电缆连接的情况下,传输一对位或字节的数据到微处理器。实现这个目标的简单方法是使用普遍采用的IR接收器,例如TV和VCR IR遥控使用的Vishay公司TSOP17xx或相似接收器。由于不需要外部器件,这些设备容易实现。它们通常与38kHz脉冲载波一起使用,包括放大器、自动增益控制和解调器。

  简单应用的主要问题是建立发射机,需要一个38kHz的间歇振荡器,附加供电电压和毫秒或低于毫秒级的调制脉冲。这些因素对PC操作系统而言很难控制。另一方面,PC的串口以38,400 bps的标准传输速率产生38.4kHz数据的精确脉冲,带有简单频率加倍装置和两个IR LED(图1)。当传输字节为交互的0/1类型时(十六进制55),每十六进制55个字节产生一个18脉冲噪声,增加起始和终止位,并且连续的字节产生更长的脉冲。

PC的串口以38,400 bps的标准传输速率产生38.4kHz数据的精确脉冲,带有简单频率加倍装置和两个IR LED

  接收器需要10到70个脉冲序列,脉冲之间间歇近似相等;这种设置容易满足需求。虽然由于起始和终止位,每两个脉冲传输一个字节,但是可以通过发 送十六进制的0字节产生短停顿。然而,接收器消除了这些脉冲。停止传输一段时间会产生更长的脉冲。必须依靠使用的接收器,偶尔插入更长的停顿。可以通过使用短和长脉冲和合适的协议,实现数据传输。

  如图1电路形成带串口和电容输出阻抗的高通滤波器。正脉冲驱动一个IR LED;负脉冲驱动另一个IR LED。两个LED都应指向接收器。PC端口通常提供最大5到20 mA电流和±15V电压,因此输出电阻小于千欧级。限流电阻通常不是必需的。大多数情况下,1到10nF电容值就可以工作了。接收器是有余量的。对非PC端口,如有低阻抗的微处理器,需要调整电容值。实际应用中,如果将LED指向接收器,用最小5mA的高LED电流可靠地实现2到4米的输出距离。简单的PC编程是可用的。

  英文原文:

  Achieve simple IR-data transmission from a PC’s serial port

  By transmitting appropriate hex values from a PC's serial port to a pair of IR LEDs, a remote-control IR receiver CAN enable 38.4-kHz data transmission.

  Andreas Grün, Wedemark, Germany; Edited by Charles H Small and Fran Granville -- EDN, 10/11/2007

  Often, you need to transmit a couple of bits or bytes of data to a mICrocontroller without a direct cable connection. One simple way to achieve this goal is to use a widely available IR receiver, such as a TSOP17xx or similar receiver from Vishay that finds use in IR-remote-control applications, such as TVS and VCRs. These devices are easy to implement because they require no external parts. These receivers usually work with a pulsed 38-kHz carrier and include an amplifier, automatic gain control, and a demodulator.

  The main problem for simple applications is building the transmitter, which requires a 38 kHz start-stop oscillator, additional supply voltage, and modulating pulses in the millisecond and submillisecond range. These factors are difficult to control with PC operating systEMS. On the other hand, a PC’s serial port at a standard transmission rate of 38,400 bps can generate precise bursts of 38.4-kHz data with a simple Frequency doubler and two IR LEDs (Figure 1). When transmitting bytes with an aLTErnating zero/one pattern (hex 55), each hex-55 byte generates a burst of 18 pulses, adding the start and stop bit, and consecutive bytes can generate longer pulses.

www.55dianzi.com

  The receiver needs pulse trains ranging from 10 to 70 pulses with approximately equal pauses between them; you CAN eaSILy meet these requ IR ement s with this setup. You can generate short pauses by sending hex-0 bytes, although two pulses will transmit for each byte because of the start and stop bits. However, the receiver eliminates these pulses. StopPINg the transmission for a time can generate longer pauses. You must oCCasionally insert longer pauses, depending on the receiver you use. You can achieve data transmission by using short and long bursts and an appropriate protocol.

  The circuit in Figure 1 forms a highpass fiLTEr with the output impEDAnce of the serial port and the caPACitor. The positive pulses drive one IR LED; the negative pulses drive the other. Both should point to the receiver. PC ports usually provide a maximum current of 5 to 20 mA and a voltage of ±15V, thus having an output resistance in the low-kilohm range. A current-limiting resistor is usually not necessary. A value of 1 to 10 nF for the capacitor works in most cases. The receiver is tolerant. You need to adjust the capacitor’s value for non-PC ports, such as the mICrocontroller, which have lower impedance. In practical applications, you can reliably achieve a transmission distance of 2 to 4m with a peak LED current as low as 5 mA if you point the LEDs at the receiver. A sample program for the PC is available.

  英文原文地址: http://www.edn.com/article/CA6486028.html




本文关键字:暂无联系方式DSP/FPGA技术单片机-工控设备 - DSP/FPGA技术

《由PC串口实现简单IR数据转换》相关文章>>>