2 may
2021

Why my serial-port instrument reads a query response returning the same query command?

community,

I'm using a Win 7 system with a Matlab R2015 with Instrument Control installed. And, a Tektronix TDS1012 oscilloscope connected to my computer via a USB-to-SERIAL connector. The device is connected and recognized by the PC and the Instrument Control.

If I send a program message, the instrument accepts it. On the other hand, when doing query requests, it reads the previous program message sent as the response messages. Example:

fprintf(deviceObj, '*IDN?')
fscanf(deviceObj)
ans = 
*IDN?

Moreover, if I sent a program message as *RST by doing, the instrument would reset, but also it outputs the same program message

fprintf(deviceObj, '*RST') #This Line
fscanf(deviceObj)
ans =
*RST

QUESTION: What do I am missing here? Could be my Usb-to-Serial Cable?

PS: here is the Oscilloscope Configuration (it matchs with the instrument configuration)

default_val = 

              BaudRate: 9600
     BreakInterruptFcn: ''
             ByteOrder: 'littleEndian'
        BytesAvailable: 0
     BytesAvailableFcn: ''
BytesAvailableFcnCount: 48
 BytesAvailableFcnMode: 'terminator'
         BytesToOutput: 0
              DataBits: 8
     DataTerminalReady: 'on'
              ErrorFcn: ''
           FlowControl: 'none'
       InputBufferSize: 512
                  Name: 'Serial-COM5'
      ObjectVisibility: 'on'
      OutputBufferSize: 512
        OutputEmptyFcn: ''
                Parity: 'none'
             PinStatus: [1x1 struct]
          PinStatusFcn: ''
                  Port: 'COM5'
         ReadAsyncMode: 'continuous'
          RecordDetail: 'compact'
            RecordMode: 'overwrite'
            RecordName: 'record.txt'
          RecordStatus: 'off'
         RequestToSend: 'on'
                Status: 'closed'
              StopBits: 1
                   Tag: ''
            Terminator: 'LF'
               Timeout: 10
              TimerFcn: ''
           TimerPeriod: 1
        TransferStatus: 'idle'
                  Type: 'serial'
              UserData: []
        ValuesReceived: 0
            ValuesSent: 0
>> default_val.PinStatus = 

CarrierDetect: 'off'
  ClearToSend: 'on'
 DataSetReady: 'on'
RingIndicator: 'off'

COMENTARIOS

DEJA TU COMENTARIO

© 2017 website by Rubit Corporation