高分急寻 SPCOMM 怎样中途改变校验方式(200分)

  • 主题发起人 主题发起人 roc2002
  • 开始时间 开始时间
R

roc2002

Unregistered / Unconfirmed
GUEST, unregistred user!
用SPCOMM 在不关闭串口的前提下实现
1。 Parity=Space;
发送数据
2。Parity= mark 发送数据
3.Party=space 等待接收数据
光设置PARTY 串口状态不会改变呀,是不是应该还有个命今呀
用API时有个SETCOMMSTATE() 可SPCOMM里没有呀
 
从spcomm的readme上抄的
ParityCheck : Boolean
Specifies whether parity checking is enabled. If this member is TRUE,
parity checking is performed and errors are reported
(to OnReceiveError handler).
You can change this value when the comm is open.
Parity : ( None, Odd, Even, Mark, Space )
Specifies the parity scheme to be used. This member can be one of the
following values:
Value Meaning
------- ---------------------
None No parity
Odd Sum of logic '1' bits (data bits and parity bit) is odd
Even Sum of logic '1' bits (data bits and parity bit) is even
Mask Parity bit is always in logic '1'
Space Parity bit is always in logic '0'
You can change this value when the comm is open.
看来应该是可以在打开串口的状态下设置 Parity 的。要注意的是收发两个程序要同步设置Parity 和ParityCheck 。
 
我们代码是这么写的,直接改就可以了吧?
Comm1.StopComm;//先停止
Comm1.StartComm;
Comm1.BaudRate:= 9600;
Comm1.Parity:=None;
 
后退
顶部