RS232

来源:互联网 发布:五十音图 软件 编辑:程序博客网 时间:2024/05/21 22:41

RS232的最大的传输速率大约10KBytes/s。

全双工工作方式,异步。数据是8位作为一块来发送的,先发送最低位,最后发送最高位。

在232通信中:

  1. Both side of the cable agree in advance on the communication parameters (speed, format...). That's done manually before communication starts.
  2. The transmitter sends "idle" (="1") when and as long as the line is idle.
  3. The transmitter sends "start" (="0") before each byte transmitted, so that the receiver can figure out that a byte is coming.
  4. The 8 bits of the byte data are sent.
  5. The transmitter sends "stop" (="1") after each byte.

通信中有关时钟速率能不能设置成任意速率的问题,答案是不能,只能设置特定的速率。

  • 1200 bauds.
  • 9600 bauds.
  • 38400 bauds.
  • 115200 bauds (usually the fastest you can go).
At 115200 bauds, each bit lasts (1/115200) = 8.7µs. If you transmit 8-bits data, that lasts 8 x 8.7µs = 69µs. But each byte requires an extra start and stop bit, so you actually need10 x 8.7µs = 87µs. That translates to a maximum speed of 11.5KBytes per second.

At 115200 bauds, some PCs with buggy chips require a "long" stop bit (1.5 or 2 bits long...) which make the maximum speed drop to around 10.5KBytes per second.


就是说在115300的波特率下,有的电脑最大的速度可能是11.5KBytes/s或者10.5KBytes/s.

电压所代表的值:

  • "1" is sent using -10V (or between -5V and -15V).
  • "0" is sent using +10V (or between 5V and 15V).

为了最容易的产生波特率1.8432Mhz的晶振是个好的选择,当除以16就是115200hz。

有关波特率的计算方法:

假如,手上的板子上晶振2M,想要115200的波特率,那在FPGA上的实现方法是先计算出tick多少次,2000000/115200次,这个式子表示的就是分频多少次(从2M变成115200要进行多少分频,就是原先的时钟变换多少次,现在的始终才变换一次)。然后简化出1024/59次,出现1024后较方便实现。

reg [10:0] acc;   // 11 bits total!

always @(posedge clk)
  acc <= acc[9:0] + 59; // use only 10 bits from the previous result, but save the full 11 bits

wire BaudTick = acc[10]; // so that the 11th bit is the carry-out

在用上位机打开串口的时候,发送端会有1.5s的低电平,然后恢复成高电平。


0 0
原创粉丝点击