I prefer not to use a C program when I can do it in an I/A block relatively
easy. Using the MAIN block would allow me to keep my strings in a logical
grouping.
How would you do it in an IND block? From what I read in B0193AV you can't
"AND" integers (for masking purposes) in an IND block. This is easily done
with a calc block as follows:
Assume I have two characters 'A' and 'B' (in that order) in the register
connected to RI01 of the CALC block. Therefore the register contains 0x41
and 0x42.
To get character 'A' the steps look like this:
IN RI01
IN 255 //in decimal (0x00FF)
ANDX
OUT RO01 //=0x41 or ASCII 'A'
To get character 'B' the steps look like this:
IN RI01
IN 65280 //in decimal (OxFF00)
ANDX
DIV 256 //in decimal, has the effect of shift 8 bits to the right
OUT RO02 //=0x42 or ASCII 'B'
-----Original Message-----
From: Jones, Charles R. (Chuck) [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 23, 2001 4:46 PM
To: 'Foxboro DCS Mail List'
Subject: RE: ASCII Characters in 16 bit registers
I agree with Kevin about using MAIN blocks. Another way to accomplish this
result depends on your knowledge of C. Once the values are in I/A (via MAIN
blocks), you could write a C program* to do the parsing and return a string.
But if you are going to use an IND block to receive the strings, there is no
need to complicate things with a C program unless you are tight on resources
in the Integrator.
* (I suppose you could do it with Perl just as well. But, being
Perl-challenged, I wouldn't know what to suggest.)
-----Original Message-----
From: Loupe, Rory (RJ) [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 23, 2001 3:07 PM
To: 'Foxboro - Cassandra'
Subject: ASCII Characters in 16 bit registers
List,
I will be using an Integrator 30 (Modbus) to communicate to an external
device. All of the data is packed in 16 bit registers as unsigned 16 bit
integers. Since I can scale this value to obtain a floating point number
this does not pose a problem for number values. The problem is that an
ASCII string of text is packed two 8 bit characters per 16 bit register and
this is the only way the device will transmit ASCII strings.
The only solution I can come up with is to receive the 2 character 16 bit
register into an AIN block. Then feed the AIN into a CALC and mask out each
character into it's own Integer Output. Then take the two Integer Outputs
from the calc block and feed them into an Independent block. Then
concatenate the two integer values into a strings.
This does not seem like a very elegant solution. Does anyone know of a
better way to accomplish this task?
Thanks,
Rory Loupe
The Dow Chemical Company
LHC-3
P.O. Box 150, Building 6801
Plaquemine, LA 70765-0150 USA
Phone: 225.353-6409 Fax: 225.353.6968
E-mail: [EMAIL PROTECTED]
-----------------------------------------------------------------------
This list is neither sponsored nor endorsed by the Foxboro Company. All
postings from this list are the work of list subscribers and no warranty
is made or implied as to the accuracy of any information disseminated
through this medium. By subscribing to this list you agree to hold the
list sponsor(s) blameless for any and all mishaps which might occur due to
your application of information received from this mailing list.
To be removed from this list, send mail to
[EMAIL PROTECTED]
with "unsubscribe foxboro" in the Subject. Or, send any mail to
[EMAIL PROTECTED]
This e-mail and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed.
If you are not the intended recipient or the person responsible for
delivering the e-mail to the intended recipient, be advised that you have
received this e-mail in error, and that any use, dissemination, forwarding,
printing, or copying of this e-mail is strictly prohibited. If you have
received this e-mail in error, please notify the TLNA HELPDESK at
800-404-2436 or e-mail [EMAIL PROTECTED]
-----------------------------------------------------------------------
This list is neither sponsored nor endorsed by the Foxboro Company. All
postings from this list are the work of list subscribers and no warranty
is made or implied as to the accuracy of any information disseminated
through this medium. By subscribing to this list you agree to hold the
list sponsor(s) blameless for any and all mishaps which might occur due to
your application of information received from this mailing list.
To be removed from this list, send mail to
[EMAIL PROTECTED]
with "unsubscribe foxboro" in the Subject. Or, send any mail to
[EMAIL PROTECTED]
-----------------------------------------------------------------------
This list is neither sponsored nor endorsed by the Foxboro Company. All
postings from this list are the work of list subscribers and no warranty
is made or implied as to the accuracy of any information disseminated
through this medium. By subscribing to this list you agree to hold the
list sponsor(s) blameless for any and all mishaps which might occur due to
your application of information received from this mailing list.
To be removed from this list, send mail to
[EMAIL PROTECTED]
with "unsubscribe foxboro" in the Subject. Or, send any mail to
[EMAIL PROTECTED]