Send Date types variables to M340 PLC

Hello,

I am trying to include in my software a simple interface to schedule maintenance of a sensor.

How can I send a Date type variable to M340 PLC?

What I have done now is use strings and split it in day, month and year.

Is there a simple way?

Thank you very much!

Parents
  • Former Member
    Former Member

    Kevin, check Unity Pro Help - it describes Date type.

    The Date type in 32 bit format contains the following information:

    the year coded in a 16-bit field (4 most significant half-bytes)

    the month coded in an 8-bit field (2 half bytes)

    the day coded in an 8-bit field (2 least significant half bytes)

    Representation in BCD format of the date 2001-09-20:

    Year (2001)  Month (09)  Day (20)  

    0010 0000 0000 0001  0000 1001  0010 0000  

    Syntax Rules

    The Date type is entered as follows: D#<Year>-<Month>-<Day>

    This table shows the lower/upper limits in each field.

    Field  Limits  Comment  

    Year  [1990,2099]  

    Month  [01,12]  The left 0 is always displayed, but can be omitted at the time of entry  

    Day  [01,31]  For the months 01\03\05\07\08\10\12  

    [01,30]  For the months 04\06\09\11  

    [01,29]  For the month 02 (leap years)  

    [01,28]  For the month 02 (non leap years)  

    Example:

    Entry  Comments  

    D#2001-1-1  The left 0 of the month and the day can be omitted  

    d#1990-02-02  The prefix can be written in lower case  

Reply
  • Former Member
    Former Member

    Kevin, check Unity Pro Help - it describes Date type.

    The Date type in 32 bit format contains the following information:

    the year coded in a 16-bit field (4 most significant half-bytes)

    the month coded in an 8-bit field (2 half bytes)

    the day coded in an 8-bit field (2 least significant half bytes)

    Representation in BCD format of the date 2001-09-20:

    Year (2001)  Month (09)  Day (20)  

    0010 0000 0000 0001  0000 1001  0010 0000  

    Syntax Rules

    The Date type is entered as follows: D#<Year>-<Month>-<Day>

    This table shows the lower/upper limits in each field.

    Field  Limits  Comment  

    Year  [1990,2099]  

    Month  [01,12]  The left 0 is always displayed, but can be omitted at the time of entry  

    Day  [01,31]  For the months 01\03\05\07\08\10\12  

    [01,30]  For the months 04\06\09\11  

    [01,29]  For the month 02 (leap years)  

    [01,28]  For the month 02 (non leap years)  

    Example:

    Entry  Comments  

    D#2001-1-1  The left 0 of the month and the day can be omitted  

    d#1990-02-02  The prefix can be written in lower case  

Children
No Data