thnng Posted January 31, 2012 Share Posted January 31, 2012 HI, I AM NEW TO DAQ FACTORY PRO.... TRYING TO GET THE COMM MONITOR TO TALK TO MY ADAM 4000 UNITS ON 485 NETWORK. WHEN USING WINDOWS HYPER-TERMINAL tx AND rx ALL OK TO EACH ADDRESSABLE UNIT, RETURNING DATA AS REQUESTED. UNABLE TO GET DAQFACTORY MONITOR TO TALK TO UNITS!! SUGGESTIONS TRULY WELCOME... THANKS Link to comment Share on other sites More sharing options...
AzeoTech Posted January 31, 2012 Share Posted January 31, 2012 The DAQFactory monitor is designed to handle binary data as well as text data. Hyperterminal is really text only, making it impossible to do binary protocols. As a text terminal, it will generate a carriage return when you hit the enter key. In the DAQFactory monitor, only what you type is sent. Hitting the carriage return simply activates the Send button, and does not add the carriage return character. So, if you want to send out "GIVE ME DATA", you would likely put: GIVE ME DATA\013 Link to comment Share on other sites More sharing options...
thnng Posted February 1, 2012 Author Share Posted February 1, 2012 Thanks for this. Monitor is now sending and receiving. Now.... Trying to create a poll protocol to get data from the ADAM devices. The monitor syntax used to get data from channel 1 of unit with address 1 is "#01113" How do I incorporate this into the suggested poll expression example given in the manual: return(StrToDouble(Poll("D"+chr(13),13))) ? Thanks in anticipation. thnng Link to comment Share on other sites More sharing options...
AzeoTech Posted February 1, 2012 Share Posted February 1, 2012 Well, first, I typically do not recommend creating user protocols unless you are going to reuse it across multiple documents, and if you do create a user protocol, you should script it as sequences first, then migrate. However, if the protocol is dead simple like the ADAM, and it sounds like you already made some progress, you might continue on it. As to your specific question, the output would be: "#011" + chr(13) (the forum often strips backslashes, and I'm assuming there was only one backslash in the monitor syntax) Link to comment Share on other sites More sharing options...
thnng Posted February 2, 2012 Author Share Posted February 2, 2012 FANTASTIC. THANKS AGAIN Link to comment Share on other sites More sharing options...
thnng Posted May 10, 2012 Author Share Posted May 10, 2012 HI, I have lots of good data now, but I need to use DaqFactory to control outputs on ADAM4000 units. Having problems getting the syntax correct when setting up I/O types in Protocol Configuration part of Serial device configuration. The syntax below I use to get data from the AI units, and this works well. private string dataout = "#09" + DoubleToStr(Channel) + Chr(13) private string datain = Poll(dataout,13) return(StrToDouble(Mid(datain,1,10))) However, what I need to do is to control digital out and Analog out. I am not sure how to write a protocol to do this. The command for the ADAM module (4150) is: #AABB Name Digital Data Out Description The command either sets a single digital output channel or sets all digital output channels simultaneously. Syntax #AABB(data)(cr) # is a delimiter character. AA (range 00-FF) represents the 2-character hexadecimal address for the output. BB is used to indicate whether a single channel or all the channels will be set. In the last character of BB also indicates which channel it is. 1. Writing to all channels (write a byte): both characters should be equal to zero (BB=00). 2. Writing to a single channel (write a bit): First character is 1, and the second character indicates channel number, which can range from 0 to B. (data) is the hexadecimal representation of the digital output value(s). If I use the monitor and enter: #081201\013 I can turn on channel 2 at address 08..... Then off with this... #081200\013 How can I write these into a device I/O protocol and also adapt for use as a toggle on/off switch in DaqFactory? ... Also, .any help with Analog out would be great (below). Thanks in anticipation. S. Thnng ADAM4024. #AA Name Analog Data Out Description Send a value to the addressed analog output module. Upon receipt, the analog output module will output this value. Syntax #AA(data)(cr) # is a delimiter character. AA (range 00-FF) represents the 2-character hexadecimal address of an analog output module. (data) is the value that has to be output through the analog output module. Range and value depend on the module’s configured data format. Possible formats are: engineering units, % of FSR or hexadecimal. #AA Example command: #3315.000(cr) response: >(cr) The command sends the value 15 mA to the analog output module at address 33h that is configured for engineering units. The analog output module responds that the command was valid. Its output value will be 15 mA. Link to comment Share on other sites More sharing options...
thnng Posted May 14, 2012 Author Share Posted May 14, 2012 Hi, FIRSTLY-I CURRENTLY USE DEVICE I/O PROTOCOLS TO READ DATA FROM MY ADAM 4000 UNITS AND USE THE FOLLOWING FUNCTION private string dataout = "#06" + DoubleToStr(Channel) + Chr(13) private string datain = Poll(dataout,13) return(StrToDouble(Mid(datain,1,10))) THIS WORKS WELL. HOWEVER; i WOULD LIKE WRITE A PROTOCOL TO SEND DATA (ON/OFF) TO AN ADAM DEVICE USING A PROTOCOL FUNCTION SO THAT I CAN USE THE TOGGLE FEATURE IN A BUTTON. IS THIS POSSIBLE? THANKS THNNG Link to comment Share on other sites More sharing options...
AzeoTech Posted May 15, 2012 Share Posted May 15, 2012 Depends where you are doing this. It looks like you are doing this in an actual user protocol since you are using the Poll command. If so, you should be able to create a new I/O type, specify that its an output, and then still use the poll() function just like you did before. Typically, however, you'll simply want to return the OriginalValue variable. It might look like this: private string dataout = "#08" + format("%02X",Channel) + format("%02X", SetToValue) + Chr(13) private string datain = Poll(dataout,13) return(originalValue) Link to comment Share on other sites More sharing options...
thnng Posted May 15, 2012 Author Share Posted May 15, 2012 Hi, Thanks for the reply. Yes I am using user protocols. I tried your suggestion but to no avail. I also tried: private string dataout = “#081” + DoubleToStr(Channel) + DoubleToStr(SetToValue) + Chr(13) private string datain = Poll(dataout,13) return(originalValue) //ADAM4000 Syntax //#AABB //command: #081201(cr) //response: >(cr) //An output bit with value 1 is sent to channel 2 of a digital //I/O module at address 08h. Channel two of the digital I/O //module is set to ON. Still no joy...... Link to comment Share on other sites More sharing options...
thnng Posted May 15, 2012 Author Share Posted May 15, 2012 This might help: #AABB Name Digital Data Out Description The command either sets a single digital output channel or sets all digital output channels simultaneously. Syntax #AABB(data)(cr) # is a delimiter character. AA (range 00-FF) represents the 2-character hexadecimal address for the output. BB is used to indicate whether a single channel or all the channels will be set. In the last character of BB also indicates which channel it is. 1. Writing to all channels (write a byte): both characters should be equal to zero (BB=00). 2. Writing to a single channel (write a bit): First character is 1, and the second character indicates channel number, which can range from 0 to B. (data) is the hexadecimal representation of the digital output value(s). :)Thanks in anticipation. Link to comment Share on other sites More sharing options...
AzeoTech Posted May 16, 2012 Share Posted May 16, 2012 Drop the 1, and you have to use the format() not doubleToStr() to ensure you have two characters: private string dataout = "#08" + format("%02X",Channel) + format("%02X", SetToValue) + Chr(13) I'm assuming the address is 08. Link to comment Share on other sites More sharing options...
thnng Posted May 16, 2012 Author Share Posted May 16, 2012 SORTED..... MANY THANKS FOR YOUR GUIDANCE. CHEERS STEVE Link to comment Share on other sites More sharing options...
AzeoTech Posted May 16, 2012 Share Posted May 16, 2012 You might consider replacing the 08 with deviceNumber: private string dataout = "#" + format("%02X",deviceNumber) + format("%02X",Channel) + format("%02X", SetToValue) + Chr(13) Then you can fully specify the channel details right in the channel table. The ID would be the D# of the channel. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.