首页 > 学院 > 开发设计 > 正文

串口通信设置

2019-11-11 06:51:28
字体:
来源:转载
供稿:网友
串口通信,一般是指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复制代码

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表