The PC on the PWG system can accept commands from another PC, called the Remote Host. The Remote Host can be used to run waveforms and collect data from the PWG system.
To Remotely control the PWG system you'll need to connect the two computer's serial ports together, and write a program that allows you send or receive serial data from the PWG system.
To connect the Remote Host to the PWG's P.C. you'll need a "null modem" cable. The cable needs only three wires: TxD to RxD, RxD to TxD, and Gnd to Gnd.
Start by determining the connectors used by your PWG P.C. and your Host P.C. (they should be either a 9 Pin male or a 25 Pin male connector). Then use the information provided here to make the cable.
Note: * indicates required connections. Standard Null Modem Connections Computer connector pin outs PWG PC Remote Host __________ Txd - Rcd * (1........5) 9 Pin Rcd - Txd * \ 6....9 / Male Gnd - Gnd * `------' "AT Style" CTS - RTS RTS - CTS _________________ DTR - DSR (1..............13) 25 Pin DSR - DTR \14...........25/ Male DTR - DCD `-------------' "XT Style" DCD - DTR Note: DTR often goes to the other computers' DSR and DCD Pin out of computer connectors. Pin # 9 Pin Signal Pin # 25 Pin Signal 1 DCD 2 TxD x 2 RxD * 3 RxD x 3 TxD * 4 RTS 4 DTR 5 CTS 5 GND * 6 DSR 6 DSR 7 GND x 7 RTS 8 DCD 8 CTS 20 DTR 9 RI Note: you'll need a 9 or 25 Pin female connectors to build the cable. The connections you need for the common cables configurations: 9 Pin -- 25 Pin 25 Pin to 25 Pin 9 Pin to 9 Pin Pin 2 Pin 2 Pin 2 Pin 3 Pin 2 Pin 3 Pin 3 Pin 3 Pin 3 Pin 2 Pin 3 Pin 2 Pin 5 Pin 7 Pin 7 Pin 7 Pin 5 Pin 5
Be cautious and double check your equipment grounding before connecting the cable. Start by making sure both P.C's are connected to the same wall outlet. Then use a volt meter to measure the voltage from the Remote Host case ground to the PWG P.C. case ground. The voltage should be less than 0.5 volts (measured on both AC and DC settings).
If the voltage is too large, one of the P.C's is not grounded properly, there is a large AC magnetic field source within a few feet of your location or the P.C's are not connected to the same outlet. Fix the problem before proceeding.
To control the PWG system you need to know the COM port settings, how to put the PWG P.C. in "remote mode," how to send commands and how to receive data.
The PWG P.C. expects to communicate over COM1 at 19200 baud with 8 bit characters, no parity and one stop bit (19200, 8N1).
The process of entering remote mode helps make sure your Host P.C. and the PWG P.C. are syncronized. When things work, here's what happens. You (the host) send $03 to the PWG P.C., then you receive $03. You send $02, you receive $02. You send $01, you receive $01. Then you receive the character 'P'. You are now in Remote Mode.
This sequence can be used at any time to ensure you are in remote mode. If you don't receive what you expected - or the receive timed out (a 50 mSec timeout should work well) then restart the sequence. If you've sent more than about 10 characters and you are still not syncronized then something is wrong and you should alert your operator.
Pseudocode for entering remote mode: Note - SendChar() sends an RS-232 character ReceiveChar() receives an RS-232 character Initialization CurrentChar = $03 SendCounter = 10 Main loop while (CurrentChar is not equal to $00) and (SendCounter is not equal to 0) SendChar(CurrentChar) decrement SendCounter RecChar = ReceiveChar() */note: use a 50 mSec timeout if not timed out and RecChar equal SendChar then decrement SendChar otherwise SendChar = $03 end-while if SendChar equals 0 then you probably made it to remote mode so PassFailChar = ReceiveChar() if PassFailChar equal 'P' then you are now in remote mode so this routine is done otherwise inform the user that you can't gain control of the PWG system or try again.
You send commands to the PWG PC. The commands are actually just script file commands. The same line of text that would appear in a script file is what gets sent over the serial port to the PWG PC.
A command is a string of printable characters that is terminated with a carrage return character (ascii character number 13). Here's how a simple command works: You send each character of the command string, then you receive a "W" character signalling the PWG system is working on the command. The command is performed. You receive a "P" signaling the command finished sucessfully.
A command sequence follows these definitions:
Command sequences: A Command: String of printable characters terminated with Carrage Return [CR]. Example : "Create lin 4.0 4.0 0.1\m" where "\m" means [CR] A Command response: Two or three parts: 1) Parser Response Character (? or W or D) 2) Data Block(s) (only present if Parser Response Char was D) 3) Command response character (P or B) Parser Response Characters: ? (Unknown command) Parser didn't understand the command's keyword (in this case the command response will always be B) W (Working) Parser understood keyword and passed the command string to the command routine - this command doesn't return data D (Data) Parser understood the keyword, passed the command string to the command routine AND you will be receiving a data block Command Response Characters: P (Passed) Command was performed (it finished okay). B (Bye) The PWG P.C. has exited remote mode. You'll need to go back into remote mode to send a command Data Block: A Data Block: BlockHeader character (really a byte) Block data (0 to 127 bytes) BlockHeader: A byte, the upper bit is a flag that alerts you if more Data Blocks will follow this block in the transmittion, the remaining 7 bits tell you how many bytes are in this block (0 to 127). MoreToFollow = BlockHeader upper bit; if MoreToFollow = 1 then more blocks follow this block in the transmittion - you need to read them all if MoreToFollow = 0 then this is the last Data Block in this command. Length = BlockHeader with the upper bit masked off; Length is in the range 0 to 127. If Length is 0 then there are no bytes in the block. If length is 1 then the block has one byte (and you should read it now). Command process: You send the command string You receive ? or W or D If you received ? then the command wasn't understood and you'll be getting a B character. If you received W the command is being processed. If you received D then Data Blocks will be sent - read them all. To read all the blocks: ResultArray = an array where the incoming data will be stored clear the ResultArray repeat BlockHeader = ReadChar() MoreToFollow = (BlockHeader and $80) equals $80 Length = MoreToFollow and $7F while (Length > 0) Put ReadChar() in the ResultArray; decrement Length end-while until not MoreToFollow Done reading the blocks you receive P or B If you received P then everything completed okay If you received B then an error occured and the PWG P.C. exited Remote Mode and is displaying the error.
Return to Tech-Support Request page