adccommunitymod (AutomationDirect) asked a question.

ECEMAIL I-BOX Body Parameter Format

Created Date: April 02,2007

Created By: AZRoger

**** This post has been imported from our legacy forum. Information in this post may be outdated and links contained in the post may no longer work.****

According to the I-BOX supplement for the E-MAIL function, the BODY parameter follows the rules of VPRINT. I intended to have a BASIC Co-Processor compose messages to be sent out as e-mail from the ECOM100. To do this, I think I need to compose ASCII text, two characters per word of PLC memory. Since the messages will vary in length, I'd like to use the option that puts the length of the message in the "first location ". This is described in Chapter 5 of the regular RLL programming manual as: "V-memory text element – this is used for printing text stored in V-memory. Use the % followed by the number of characters after V-memory number for representing the text. If you assign “0� as the number of characters, the print function will read the character count from the first location. Then it will start at the next V-memory location and read that number of ASCII codes for the text from memory. Example: V2000 % 16 16 characters in V2000 to V2007 are printed. V2000 % 0 The characters in V2001 to Vxxxx (determined by the number in V2000) will be printed. " Vnnnn % 0 is the option I would use. The first location, according to the example is one word of PLC memory. My question has to do with the format of the length information in that word. Is it 2 ASCII digits, with a range of 0 to 99? Is it 4 BCD digits with a range of 0 to 9999? Is it Binary with 0 to 65535 as the value? My guess is the total length is still limited by some backplane buffer size. And if so, is the word that tells the length included in the character count? Thanks for the help. Roger PS. I'm putting this in the General forum rather than Communication forum because it is really an I-BOX question. Feel free to move this to the Communication forum if that's where it belongs. R.


  • adccommunitymod (AutomationDirect)

    Created Date: April 02,2007

    Created by: franji1

    It's actually a VPRINT question (a very good one too). I'd have to try it out to see (don't have time right now). It's definitely NOT ASCII. It's either BCD or decimal. And the range is limited to 128 characters for the WHOLE VPRINT message, which translates to about 105 for the EMail parameters after subtracting for overhead. But the subject and to fields are part of that 105, so you are REALLY limited.

    I would try a VPRINT with 10 BCD as the length just to see if you get 16 or 10 real characters. You can use Data View and fill it with a bunch of text data (at least 8 words or 16 characters).

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: April 02,2007

    Created by: AZRoger

    Franji1,

    Ohhhh. I'm running a 250-1. Can't do a VPRINT. PRINT has the same function but it looks like that requires an active comm port. I guess I'll have to get the DHCP or Non-DHCP and SMTP ip address, etc. parameters sorted out before I can send any e-mail. Once that works, I'll be able to do the test -- with Dataview. If you get time, and are so inclined, try the test and let me know how it comes out. Otherwise, I'll post the answer when I 've finished my test. Thanks.

    Roger

    Roger

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: April 02,2007

    Created by: franji1

    I'll check it out - it's a lot easier for me

  • adccommunitymod (AutomationDirect)

    Created Date: April 02,2007

    Created by: franji1

    It's decimal.

    Here's the program I used:

    PLC 06

    // Rung 1

    // Address 0

    STRPD C0

    VPRINT K0 V2000 "V1400%0 "

    // Rung 2

    // Address 8

    END

    I preloaded V1401 thru V1411 with "abcdefghijklmnop ", the I stuck BCD K10 in V1400 and I got all 16 characters in V2001 thru V2010 (note V2000 contains the length - the ECEMAIL properly handles this "length " parameter, and actually uses it).

    I then cleared the output buffer of V2000-V2011 and put KA (10 decimal) in V1400 and got just 10 characters, "abcdefghij ".

    I then tried it with the following text for the VPRINT data:

    V1400%0 "Hello world "

    and I got "abcdefghijHello World "

    So if you want a space after (or before) your variable length buffer, you gotta add it as part of the text, either as a hardcoded string or as part of your variable length string in V memory.

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: April 02,2007

    Created by: AZRoger

    Franji1,

    I would have called KA hexadecimal, as in 0,1,2,...,9,A,B,C,D,E,F. The K constants are either BCD or HEX depending on ... magic. Was K10 BCD (9999 max) or HEX (FFFF max). Turns out it was treated in this case in dataview as HEX. KA had to be interpreted as HEX 000A. There must be a way to know ahead of time what bits Knnn will produce, but I always have to try it out, just like you did. And now we know. For VPRINT and ECEMAIL, it's treated like a 16 bit unsigned binary word.

    The BASIC print statement (to the screen) also insists that the programmer put his own spaces before and after variables. For example, "VAR1 is ";var1; "PSI " will print "VAR1 is 14.7 PSI " with the spaces provided by the programmer.

    Thanks. http://forum1.automationdirect.com/board/biggrin.gif

    Roger

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: April 03,2007

    Created by: franji1

    Hexadecimal is base 16 for representing a binar bit pattern (1s and 0s).

    BCD and Decimal are ways to interpret the bit patterns (as are ASCII and IEEE Floating point).

    LD K30

    the value 30 here is a bit pattern, represented in hexadecimal. It's not BCD. It's not Binary (aka decimal). It's the bit pattern

    0000 0000 0011 0000

    In ASCII, its the character zero '0 '

    In Decimal, it's the value 48.

    In BCD, it's the value 30.

    So when you use the LD instruction, you not only have to know it takes a K value in hexadecimal, you must also know the format of how you are going to use it (actually, you start with the data format then work backwards to how that value is represented in hexadecimal).

    So the bit pattern 30 hex has no meaning unless you apply it to a specific format (ASCII, Decimal, BCD, Float, etc.)

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: April 03,2007

    Created by: AZRoger

    OK. Just to be sure I finally have it right in my head.

    The xxxx part of Kxxxx is always the HEX representations of bits.

    If there are no "A "s- "F "s in xxxx then it is valid for an instruction that needs BCD or binary/decimal ie. 0-9999.

    The VALUE of the xxxx is interpreted as base(16) by some instructions and base(10) by others. Examples:

    MULB K50 will use the bits 0110 0000 as binary or the value 80 base(10).

    MUL K50 will use the bits 0110 0000 as BCD or the value 50 base(10).

    So, if I always think HEX I'll be OK. Thanks again for your help and persistence.

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: April 03,2007

    Created by: franji1

    Exactly! If there are no A-F's, then it could be BCD constant, or it could be a hex representation of a decimal number. If there ARE A-F's, then it BETTER BE a decimal number (i.e. better NOT be BCD).

    In order to know for sure, you have to know the context of the INSTRUCTION used, as you stated.

    IBoxes are the exception:

    When we did IBoxes, we wanted them to be "intuitively obvious ". Regardless of how the "native " instruction interprets a constant value, when you want the value 10 (i.e. one more than 9), you enter K10.

    In EVERY IBox. We "translate " constants automatically from its IBox "display " to what the PLC internal instruction truly needs. This way, you think about numbers they way you 've been doing numbers since you were 4, not since you 've been through 4 years of college http://forum1.automationdirect.com/board/wink.gif

    No manuals. No trying to figure out "what's the hexadecimal equivalent for the decimal value 47? "

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: April 02,2007

    Created by: AZRoger

    According to the I-BOX supplement for the E-MAIL function, the BODY parameter follows the rules of VPRINT. I intended to have a BASIC Co-Processor compose messages to be sent out as e-mail from the ECOM100. To do this, I think I need to compose ASCII text, two characters per word of PLC memory. Since the messages will vary in length, I'd like to use the option that puts the length of the message in the "first location ". This is described in Chapter 5 of the regular RLL programming manual as:

    "V-memory text element â€" this is used for printing text stored in V-memory. Use the

    % followed by the number of characters after V-memory number for representing the

    text. If you assign “0� as the number of characters, the print function will read the

    character count from the first location. Then it will start at the next V-memory location

    and read that number of ASCII codes for the text from memory.

    Example:

    V2000 % 16 16 characters in V2000 to V2007 are printed.

    V2000 % 0 The characters in V2001 to Vxxxx (determined by the number

    in V2000) will be printed. "

    Vnnnn % 0 is the option I would use. The first location, according to the example is one word of PLC memory. My question has to do with the format of the length information in that word.

    Is it 2 ASCII digits, with a range of 0 to 99?

    Is it 4 BCD digits with a range of 0 to 9999?

    Is it Binary with 0 to 65535 as the value?

    My guess is the total length is still limited by some backplane buffer size. And if so, is the word that tells the length included in the character count?

    Thanks for the help.

    Roger

    PS. I'm putting this in the General forum rather than Communication forum because it is really an I-BOX question. Feel free to move this to the Communication forum if that's where it belongs. R.

    Expand Post