Skip to content

Instantly share code, notes, and snippets.

@jmparatte
Last active March 19, 2023 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmparatte/7ba55a6aabbf4b0d1ed16226cd3c73e0 to your computer and use it in GitHub Desktop.
Save jmparatte/7ba55a6aabbf4b0d1ed16226cd3c73e0 to your computer and use it in GitHub Desktop.
通信协议_EN - 3200_5200 communication protocol.docx
3200/5200 communication protocol
I. Overview:
The control command generally adopts the command line method, and the communication rate is 57600. The command is issued by the PC, analyzed and executed by the machine, and then the result is returned to the PC. The end character of each command is a newline character, which is represented by \n in C language (hexadecimal representation is 0x0a), and the different commands are explained below.
Two instruction categories:
1. s command: the function is used to set parameters
The command format is as follows:
English colon (:) + s + channel number (1 or 2) + command
The following command formats take 1-channel operation as an example
(1) :s1f command: set the output frequency of CH1 channel
Such as: s1f100000+line break This command is to set the output frequency of CH1 channel to 1000Hz
Such as: s1f10 + newline character This command is to set the output frequency of CH1 channel to 0.01Hz
:s1w command: set the output waveform type of CH1 channel
:s1w0+line break Set CH1 channel output waveform to sine wave
:s1w1+line break Set CH1 channel output waveform as square wave
:s1w2+line break Set CH1 channel output waveform to sine wave
:s1w3+line break Set the CH1 channel output waveform as rising sawtooth
:s1w4+line break Set the output waveform of CH1 channel to drop sawtooth
:s1w (100-115) + line break Set CH1 channel output waveform 0-15 groups of arbitrary waveforms
:s1a command: set the amplitude of the output waveform of CH1 channel
For example: s1a 0500+line break: set the output waveform amplitude of CH1 channel to 5.00V in 0dB state, and set the output waveform of CH1 channel to 0.500V in -20dB state.
(4): s1d command: set the duty cycle of the CH2 channel output waveform
For example: s1d999+line break: Set the duty cycle of the CH1 channel output waveform to 99.9%
(5): :s1o command: set the offset of the CH1 channel output waveform
For example: s1o240+line break to set the offset of the CH1 channel output waveform to 120%
For example: s1o120+line break to set the offset of the CH1 channel output waveform to 0%
For example: s1o0+line break to set the offset of the CH1 channel output waveform to -120%
(6): s1p command: set the phase of the output waveform of CH1 channel
Such as: s1p180++ newline character set CH1 channel output waveform phase to 180 degrees
(7) Attenuation control command
Switch measurement selection function command
:s0m+line break Select frequency measurement function
:s1m+line break Select counting function
:s2m+line break Choose a test cycle
:s3m+newline Select the measuring pulse width
:s4m+newline Select negative pulse width
:s5m+line break Select duty cycle
(9): s1t command: set sweep time
For example: s1t100+line break to set the sweep period to 100S
(10): s3f command: set frequency sweep start frequency
For example: s3f100000+line break to set the sweep start frequency to 1KHz
(11): s4f command: set frequency sweep stop frequency
For example: s4f200000+line break to set the frequency sweep stop frequency to 2KHz
(12) Gate time setting command
:s1g0+line break Set the frequency measurement time to 1 second
:s1g1+line break Set the frequency measurement time to 10 seconds
:s1g2+line break Set the frequency measurement time to 0.01 seconds
:s1g3+line break Set the frequency measurement time to 0.1 seconds
(13) Operation function command
:s1b0+line break close output
:s1b1+line break turn on output
:s2b1+line break Select CH1 channel
:s2b2+line break Select CH2 channel
:s3b0+line break turn off tracking
:s3b1+line break Turn on tracking
:s4b0+line break Select Ext.IN as the input port
:s4b1+line break Select TTL.IN as the input port
:s5b0+line break counter reset on
:s5b1+line break Counter reset off
:s6b1+line break counter run
:s6b0+line break counter stop
:s7b0+line break Linear sweep
:s7b1+line break Log Sweep
:s8b0+line break Sweep operation
:s8b1+line break Sweep pause
:s9b0+line break power output off
:s9b1+line break power output on
:sab0+line break CH1 reverse close
:sab1+line break CH1 reverse open
:sbb0+line break CH2 reverse close
:sbb1+line break CH2 reverse open
:scb0+line break burst off
:scb1+line break burst on
Parameter storage and recall commands
1. :sv+call address (00-15)+line break
Such as: sv+01+newline character to call out the storage position 1 parameter
2. :su+call address (00-15)+line break
For example: su+01+newline character stores the parameter in position 1
2. r command: the function is to read the parameter value
English colon (:) + r + channel number (1 or 2) + command
The following command formats take 1-channel operation as an example
:r1f + newline character to read the output waveform frequency of CH1 channel
Such as return: r1f100000 CH1 channel waveform output frequency is 1KHz
(2) :r1w+line break to read the output waveform type of CH1 channel
:r1a + newline character to read the amplitude of the CH1 channel waveform output
:r1d + newline character to read the duty cycle of the CH1 channel output waveform
:r1o + newline character reads the offset of the output waveform of the CH1 channel output waveform
:r1p + newline character to read the phase of the CH1 channel output waveform
Read machine related parameters
(
(9) :r0e+newline character read measurement parameter instruction
1. Measured values are counted values
For example, the returned data: the count value read by r0e12345 is 12345
2. The measured value is the period
For example, return data: r0e123 read cycle is 0.000123ms
3. The measured value is pulse width
For example, the returned data: the pulse width time read by r0e63 is 0.000063ms
4. Measuring Duty Cycle
If the data is returned: re509 reads a duty cycle of 50.9%
5. Measurement frequency
If return data bit: r0e100000
G_Time = 1s 100000Hz
G_Time = 10s 100000Hz
G_Time =0. 1s 100000*(10)Hz
G_Time = 0.01s 100000*(100)Hz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment