首页
IT
登录
6mi
u
盘
搜
搜 索
IT
串口通信设置
串口通信设置
xiaoxiao
2021-03-26
60
串口通信,一般是指RS232、RS422之间的通信。matlab中有专门的serial函数来创建串口对象。设串口ID号为COM1,则创建方法为: >>scom = serial('com1');
复制代码
创建完串口对象后,一般需要设置串口对象的属性,否则,串口不会相互通信。 >> get(scom) ByteOrder = littleEndian BytesAvailable = 0 BytesAvailableFcn = BytesAvailableFcnCount = 48 BytesAvailableFcnMode = terminator BytesToOutput = 0 ErrorFcn = InputBufferSize = 512 Name = Serial-COM1 ObjectVisibility = on OutputBufferSize = 512 OutputEmptyFcn = RecordDetail = compact RecordMode = overwrite RecordName = record.txt RecordStatus = off Status = closed Tag = Timeout = 10 TimerFcn = TimerPeriod = 1 TransferStatus = idle Type = serial UserData = [] ValuesReceived = 0 ValuesSent = 0 SERIAL specific properties: BaudRate = 9600 BreakInterruptFcn = DataBits = 8 DataTerminalReady = on FlowControl = none Parity = none PinStatus = [1x1 struct] PinStatusFcn = Port = COM1 ReadAsyncMode = continuous RequestToSend = off StopBits = 1 Terminator = LF
复制代码
转载请注明原文地址: https://ju.6miu.com/read-663658.html
技术
最新回复
(
0
)