DASYLab

cancel
Showing results for 
Search instead for 
Did you mean: 

Output a global variable to RS232 module

Hello!

I am new in using DASYLab and I find it very interesting, though I have this problem: I want to control the velocity of a stepper motor by ajusting the value  of a global variable and send it to the RS232 output module. The problem is that I dont know the output format of this variable. How is the sintax of the output?

Many thanks

Miguel Neto



0 Kudos
Message 1 of 14
(11,259 Views)
You define the syntax. The RS232 Output module supports both ASCII and Binary data formats. You need to understand what format your motor requires, then specify that format in the RS232 Output module.

If you can tell me what the data command is, I can set up a quick example for you.

Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.
0 Kudos
Message 2 of 14
(11,252 Views)
I have programmed a PIC that reads commands from the RS232 port. One of these commands controls the velocity of a stepper (i. e. command STEP_1= [1...255]). So, I need to output this value to the RS232 port via the RS232 output module. But this value will vary during the experiment from 1 to 255. To do this I've defined a global variable cauled STEP_1 connected to a control module from 1 to 255. I want to know the sintax to output this variable to the RS232 module.
Thanks
0 Kudos
Message 3 of 14
(11,245 Views)
To send the global variable as ASCII, use the following command. I am assuming that you need a <CR> at the end of the command.

STEP_1=[a]\r

The [a] is the placeholder for the data value. It tells DASYLab to convert a number to ASCII and put the characters in that place in the command.

To replace the placeholder Change the setting for the module to be "Asynchronous Command" -- and DO NOT check the "With Control Input" setting. The module will not have any inputs.

Use an Action module configured as: Receiver = Serial Out mdoule, Action = Send Global Variable, Parameter = STEP_1

Note == not ${STEP_1} !!

The Event can be anything that you want.

If you need a specific output format, then modify the [a] to be [ax.y] where x is the total length of the number string, including sign and decimal, and y is the number of decimal places. x must always be at least 2 higher than y.  I suspect, from your description that you want [a3.0]. 3 characters, no decimal places.

Hope this helps. You didn't give me much to work with. This is all described in the Help, under RS232 Input and Output: Output Data Format

Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.
0 Kudos
Message 4 of 14
(11,230 Views)

Hi

How can i send string in serial port RS232?

I need to send the command ":OUT1;"

thenk's

 

0 Kudos
Message 5 of 14
(7,922 Views)

For a fixed string, use the RS232 Output module configured to simply send UT1;\r\n  (<CR> <LF appended)

Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.
0 Kudos
Message 6 of 14
(7,908 Views)

Attached you can find a "complex" example: The worksheet controls via RS232 a small electric engine. The engine understands three commands with format "<cmd><number>", eg. "F500" (set frequency to 500Hz), "D100" (set duty cycle to 10%), and "V450" (set voltage to 4.5V). That "450" means "4.5V" was hardcoded into the hardware.

 

Note how the values from the sliders are send indirectly to the hardware: first, the value is stored in a global variable. The value are now modified "behind the scenes" by calculating a global string (see attached image). If that string content changes, the action modules send that string via RS232 output module to the hardware.

The calculation of the string is necessary to get rid of the decimals after the comma.

 

 

Rename the file rs232_example._zip to rs232example.zip (remove underscore), because the NI forum is unable to recognize the ZIP file created with 7zip app... 😕

Download All
0 Kudos
Message 7 of 14
(7,898 Views)

Hi

i need to send command to power supply see link

 

http://www.us.tdk-lambda.com/ftp/Manuals/zup_usermanual.pdf

 

first command                                     :ADR01;

second command                                :OUT1;

I build this simple porgram

 

0 Kudos
Message 8 of 14
(7,884 Views)

Hi

i need to send command to power supply see link

 

http://www.us.tdk-lambda.com/ftp/Manuals/zup_usermanual.pdf

 

first command                                     :ADR01;

second command                                :OUT1;

I build this simple porgram

 

Download All
0 Kudos
Message 9 of 14
(7,883 Views)

The manual suggests that you don't need a CR LF at the end of the command, and you can put both commands on the same line.

 

What are you trying to do? Did you see the detailed example that HolWo posted? 

 

Please note that DASYLab V6 is very very old, and may not have some of the features of DASYLab 13. V6 shipped in 2001.

 

2015-01-20_PrintScreen-0000.png

 

 

Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.
0 Kudos
Message 10 of 14
(7,855 Views)