sending file to VXM without COSMOS

344 views
Skip to first unread message

rob....@thermofisher.com

unread,
Jun 20, 2013, 10:54:49 AM6/20/13
to velmex-...@googlegroups.com
Hello, I'm working on a rather unique use-case.  I have been tasked to automate the script creation for my company's VXM, which drives a Bi-slide and some other equipment.

At this point in time, we don't have the resources to completely drive the VXM in the preferred Interactive Mode, with a LabView or LabWindows front end GUI.  So we are relying on the VXM's logic I/O in the on-line mode, downloading scripts to it for program running.

However, my operators are having to edit these scripts nearly daily.  Enter my work on automation.  I have created a very simple GUI and scripting backend with a free tool called AutoHotkey.  It's a tool that primarily is used for automating Windows keystrokes, mouse movement, and such.  But it also has support for self-contained DLLs.  It's also a very small footprint runtime, single EXE compiled file, no DLLs or drivers, no installation executable.

I now have my application sending strings of ASCII command characters onto a com port to the VXM successfully.  EXE weighs in at 800K!

The only problem I'm having is that when I send an entire script file, line at a time, to the VXM, it must be erroring out.  If I send a small script, single line, no comments, the VXM accepts it.

I'm wondering if there's some magic that I should be doing to send a complete file?

Cliff

unread,
Jun 20, 2013, 11:44:10 AM6/20/13
to
Hi Rob,
There is no magic to it.... It just accepts the text given and executes it.
However if you send something like the following
F,C,I1M1000,R                ;<---- Line 1
F,C,I1M-1000,R                ;<---- Line 2
all at once then what the control sees is Line 1 and starts running it, and as Line 2 comes in it gets tossed out because Line 1 is already executing.

Cliff



rob....@thermofisher.com

unread,
Jun 20, 2013, 12:05:45 PM6/20/13
to velmex-...@googlegroups.com
Cliff, thanks for the help.  So, if I'm not mistaken, sending something like this shouldn't result in a problem:

;*********************************************************************************************
E,                ;bring the VXM controller on-line
C,                ;clear previous progam from memory
IA1M16900,
P2,
S1M300,        ;set the x motor movement speed
IA1M16500,
S1M6000,
IA1M5500,    ;move x motor to the end
U14,U4,        ;sets O1=HIGH, sets O1=LOW
P2,            ;pause
U5,U4,        ;sets O2=LOW,
U15,            ;sets O2=HIGH
U5,U15,        ;sets O1=HIGH, sets O2=HIGH,

R

Cliff

unread,
Jun 20, 2013, 12:10:09 PM6/20/13
to
Hi Rob,
I do not see any problems with the code, all the comma's and comment characters are in the right place.

Cliff


rob....@thermofisher.com

unread,
Jun 21, 2013, 8:39:08 AM6/21/13
to

Cliff, after some more experiments, it would appear that any comment character in my test script will “crash” my VXM.  After I send one 0d59 (0x3B), I can’t recover the VXM with my app.

At that point, I then have to close the port, open up COSMOS, and simply execute an absolute position change (or other command).  Then the VXM is “back to life” again.  It’s as if the COSMOS is sending some magic packets that are undocumented.

Another question: does the COSMOS somehow format the comment character (semicolon) differently when it sends scripts?



Mitchel Evans

unread,
Jun 21, 2013, 8:39:48 AM6/21/13
to
I am guessing the script does not contain a carriage-return at the end of each line to satisfy the end of comment.


Mitch


VelmexControls

unread,
Jun 21, 2013, 8:44:04 AM6/21/13
to velmex-...@googlegroups.com
Rob,
I was discussing this with a colleague and when I said something out loud about color formatting code (for a different issue) that the idea hit me.

Can you send me an actual "Auto-It.ahk" file that opens the port and sends your script?
I have a good idea where your problem is, and if I am right then I may be able to figure out a way around it.

Cliff.

rob....@thermofisher.com

unread,
Jun 21, 2013, 2:09:04 PM6/21/13
to velmex-...@googlegroups.com
Mitch, you were correct.  I had thought I was sending the CR, but in fact I was not.  I had to prove it to myself by sending my string out one of my PC com ports and receive back into another, to see for myself.

So I fixed that and now all is well.  Apparently, the VXM must receive a CR to terminate an opening comment character, otherwise every remaining character is just ignored (treated as comments, I suspect).

Cliff, I'm happy to send you my files still.

Cliff

unread,
Jun 21, 2013, 2:10:39 PM6/21/13
to velmex-...@googlegroups.com, rob....@thermofisher.com
--
You received this message because you are subscribed to the Google Groups "Velmex Controls" group.
To unsubscribe from this group and stop receiving emails from it, send an email to velmex-contro...@googlegroups.com.
To post to this group, send email to velmex-...@googlegroups.com.
Visit this group at http://groups.google.com/group/velmex-controls.
For more options, visit https://groups.google.com/groups/opt_out.
 
 


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

rob....@thermofisher.com

unread,
Jun 21, 2013, 2:28:01 PM6/21/13
to
I would just add one caveat to anyone else interested in using the AHK method of control interface.  The serial library I used (***) had some unexpected behavior with how it output certain characters.  For instance, I was using a variable containing a line's worth of string characters, terminated by a true CR and LF.  Yet, the serial output function would refuse to output the literal CR.  So the solution was to just force output that character.


carriage_return := 13 ;CR - 0x0D

Loop
{
   
FileReadLine read_line, %output_script_file%, %A_Index%
   
if ErrorLevel    ;break when reached end of file
       
break
   
Loop Parse, read_line        ;now send the lines, one byte at a time
   
{
        ascii_byte
:= Asc(A_LoopField)
       
Bytes_Sent := Serial_Write(COM_Handle, ascii_byte)
   
}
   
Bytes_Sent := Serial_Write(COM_Handle, carriage_return)    ;send a carriage return at end of line! (comment strings without CRs will corrupt script load)
}



***NOTE:
I've attached the serial port library that was created by some folks on the AHK forums.  This is the library I used in my AHK script to successfully write to a com port and control my VXM.



serial.ahk
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages