10-15-2019 01:46 PM
Hello,
I would like to send triangular waveform on a serial port say at 30ms period. what should be best option to do this. Can we use simulate signal vi and then wiring this directly to serial write VI .
or should we must place inside a while loop and place wait until next ms vi to control the sample period .
the objective is to tight ms period in between data points.
regards,
10-15-2019 01:51 PM
What do you mean by a triangular waveform to a serial port?
To me a triangular waveform is an analog waveform of varying voltages.
A serial port is a digital interface.
If you want to output a triangular waveform, you need to connect an analog output device.
10-15-2019 02:12 PM
Did you figure out your protocol yet? (serial port read and write : executing link establish once)
Are you continuously sending the samples? Are you sending 1 sample at a time or as a block of samples? How deterministic does this actually need to be?
10-27-2019 08:51 AM - edited 10-27-2019 08:55 AM
10-27-2019 10:35 AM
That VI doesn't contribute anything to the conversation.
What is the device at the other end of the serial line? What message protocol does it expect the data to be in?
10-27-2019 11:50 AM
Your question makes absolutely no sense.
As has been said, as a first step you need to research what commands the device at the other end of the serial cable supports. For example if it is an arbitrary signal generator, it might be sufficient to send a command for "Triangle wave (amplitude, frequency, duration)". Other devices might allow you to write a waveform to a internal buffer to be looped on demand, while simpler devices might just expect a scalar value at timed intervals in proper syntax.
Do you have the manual of whatever box connects to the other end of the serial cable? Start there!
10-27-2019 12:28 PM
On the other side device expects a 14 byte frame at 30ms interval.
2 of the bytes are for waveform signal 2 for timer 30ms interval. Others are static
10-27-2019 01:12 PM
OK, this has nothing to with a triangle wave, just with updating an output value of a dumb device by sending a properly formed frame of data containing the new value.
I assume you can properly format the 14 byte frame and the problem is reduced to generating the new value and timing, both fully controlled from within your LabVIEW program.
Is this LabVIEW running on a PC or LabVIEW RT? You cannot guarantee any timing on a PC. What is the max allowable jitter in the output? Do you need to be able to turn the wave on and off? Do you need to maintain phase?
How many points are in one period of the waveform? I tend to generate a waveform once and then loop through the indexes (e.g. using the remainder of dividing the iteration could by N of the wave using quotient and remainder), thus simplifying the inner code as follows.
10-27-2019 01:30 PM
Thanks it solved 50% of my issue .
I am using a PC , one sample point at 30ms .
on the other hand if i want to use same code for piece wise linear like using "Arbitrary signal"
0 0
30ms 10
60ms 20
etc
and its effect on loop rate.
10-27-2019 02:26 PM - edited 10-27-2019 02:30 PM
The output signal is fully defined by the discrete points you are sending. If you want linear interpolation, you just need to generate the interpolation points and increase the update rate accordingly (e.g. double the rate to send one additional interpolated value halfway between points, e.g. 45ms, 15V). However, you will quickly get into limits of timing accuracy if you go much faster.
How many bits/value characterize the D/A converter?
What is involved in the communication? Are you just blindly sending frames or do you e.g. need to wait for a "ready" signal before sending the next frame?