10-17-2012 04:49 PM
Hi There,
I am new to the board and somewhat of a novice in the DASYLab realm. However, I have searched this forum and the web extensively for a resolution to my issue and have not found anything. So here it goes...
I am trying to use the Read Data module to read a simple ascii file which is connected to an RS232 output module that is used to send the commands in the ascii file to a motor driver.
Every time I try to run the worksheet I get the following error for the Read Module: "The set block size is larger than the number of lines in the ASCII file." This message occurs no matter what I set my block size to in the Read Module - I believe the block size should be 1.
I can successfully send the command strings to the motor driver via the RS232 Input and RS232 Output modules.
I can also successfully use the Read Data module to send an ASCII file generated by DASYLab to hyperterminal of another computer using the RS232 Output module.
I'll attach my ASCII file and the DASYLab worksheet here for anybody that is willing to take a look and lend me a hand. I'm sure that I am doing something completely wrong, but any help is truly appreciated.
Thanks in advance!
10-18-2012 08:36 AM
You can't read in this list of strings...
s r0x24 31\r\n
s r0xc8 2\r\n
s r0xca -1\r\n
s r0xcb 10000\r\n
s r0xcc 13360\r\n
s r0xcd 13360\r\n
s r0x24 31\r\n
t 1\r\n
DASYLab is data oriented, and the Read Data module only reads numbers, not strings.
Tell me more about the device, and what the strings mean... is 0xcd an indicator for hex? DASYLab indicates hex using \xcd.
One way to do this is with DASYLab Full... store these strings into Global Strings, and then send them using the Action module.
If you could explain what the strings mean, it may be possible to construct them however, my initial impression is that we won't be able to construct them.
10-18-2012 09:46 AM
Thank you very much for the reply CJ.
The device is Copley Controls Stepnet motor driver. The syntax of the command strings is: [ optional node ID] <command code> <memory bank><variable ID> <value>...]<CR>
I'll try to explain the string meanings. For s r0xcd 13360\r\n:
s - this is the command code for "set" i.e. to set acceleration, velocity, deceleration etc.
r - this is the RAM memory...you can also set f for flash memory
0xcd - you are correct that this is in hex, and this is the variable ID for deceleration rate
13360 - this is the value set for the deceleration rate...13360 counts/second
Unfortunately, I'm using DASYLab Basic and do not have the Action module. I had researched the Action module for other control portions of my project and realized that I didn't have it.
Thanks,
Ian
10-18-2012 10:24 AM
Ok then.... the next option is to hard code the module, with a channel for each output string. Make sure that you change the hex encoding to the DASYLab notation. Each channel is configured for command and enable the control input for each channel.
Now you have a module with 8 inputs. The input is looking for a rising edge (0-->5) to send the command string.
Create a TTL Pulse Generator module, and configure it with 1 channel. Configure the High/Low phase to set up the timing that you want to send the commands.
Create a Delay module with 8 inputs, and branch the TTL Pulse Generator output to these 8 inputs. Set each channel's delay so that you get a TTL High. To make it precise, add a trigger to reduce the TTL High to one sample.
And then the control pulse will look like this, and repeat. You can turn off the repeat in the TTL Pulse Generator.
10-18-2012 10:38 AM
The preceeding setup allowed me to send the commands as shown in PORTMON. (HEX)
Here's the plain ascii, where the unprintable characters are shown with .
10-18-2012 03:06 PM
CJ, thank you so much!
Your solution worked and allowed me to send those commands as well as a stop condition on a 9th channel.
Of course it brought about another question when I started thinking further down the line at full system operation. Essentially, I need to be able to use the solution you provided in a feedback control system where another parameter will need to feed back into the motor control to accelerate, decelerate, stop or start the motor.
Will it be possible to change the value of the string in one of the channels on the RS232 Output module during operation?
Thanks,
Ian
10-18-2012 03:21 PM
I think that takes us back to using the Action module and Global strings.
That means that you'd have to upgrade to DASYLab Full.
10-18-2012 04:06 PM
Ok, that is what I figured. I'll explore that option.
Thank you so much again for your help - I truly appreciate it.
Ian
10-31-2012 08:04 AM
So, after some discussions amonst my peers, I decided to purchase an upgrade to DASYLab Full and now have the Action module.
CJ, would it be possible to explore the global string and Action module solution?
Thanks,
Ian