I have an ABB PM556 PLC and I'm trying to send an email from it using the function block ETH_SMTP_EMAIL_SEND. I'm having issues declaring the inputs for MAIL_INFO on the FB. The function bock uses data type ETH_EMAIL_DATA_TYPE, so I created a variable and declared it as that type.
EmailData : ETH_EMAIL_DATA_TYPE;
Then in the program, I try to write to the subject and body for my EmailData variable.
the type of the string is wrong, you try a string (80) and should be a pointer to string,
there are types available in the library, and you have to be sure the types on input and inside FB are the same.
on some it is the version that gives a problem, so check if the version of the codesys can cope and with the PLC and with the libraries.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I know my PLC doesn't support the function block, but that is a socket issue. The errors I'm getting are about mismatched variables and data types. I understand the subject email address has to be 'POINTER TO STRING(255)' but don't know how to declare a variable as that.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
a Pointer must be pointing to a Variable, so not the content but a Var, and obvious this must be same type so both 80 or 255.
not to a piece of text.
btw, i never use pointers, as this is not conform the standard. IEC61131
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
jethridge hat geschrieben:
How do I declare a variable as 'POINTER TO STRING(255)'? I tried that too and still got an error. For example, I declared the variable.
ToEmailAddress : POINTER TO STRING(255) := e 'myemail@mycompany.com e ';
I know my PLC doesn't support the function block, but that is a socket issue. The errors I'm getting are about mismatched variables and data types. I understand the subject email address has to be 'POINTER TO STRING(255)' but don't know how to declare a variable as that.
Did you notice the example within the online help?
Example:
pt:POINTER TO INT;
var_int1:INT := 5;
var_int2:INT;
pt := ADR(var_int1);
var_int2:= pt^; ( var_int2 is now 5 )
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have an ABB PM556 PLC and I'm trying to send an email from it using the function block ETH_SMTP_EMAIL_SEND. I'm having issues declaring the inputs for MAIL_INFO on the FB. The function bock uses data type ETH_EMAIL_DATA_TYPE, so I created a variable and declared it as that type.
EmailData : ETH_EMAIL_DATA_TYPE;
Then in the program, I try to write to the subject and body for my EmailData variable.
EmailData.psTOAddr := e 'myemailaddress@mycompany.com e ';
EmailData.apsBody[0] := 'test body for email from PLC';
However, I keep getting the following errors:
Here are the only two links I've been able to find describing this function block and data type.
http://www.vaeprosys.cz/dokumentace/ac500/English/CHM-Files/CAA-Merger-6/The-Ethernet-Library/ETH_SMTP_EMAIL_SEND.htm
http://www.vaeprosys.cz/dokumentace/ac500/English/CHM-Files/CAA-Merger-6/The-Ethernet-Library/ETH_EMAIL_DATA_TYPE.htm
How can I define values for my EmailData variable? The ETH_EMAIL_DATA_TYPE being defined as pointer to strings is throwing me off.
Was reading on this website http://www.vaeprosys.cz/dokumentace/ac500/English/CHM-Files/CAA-Merger-7/System-Technology-CPUs/AC500_Ethernet_Protocols_Ports.htm
If the errors were caused by something else, besides the CPU not supporting it, I'd appreciate any replies so I could add this to my toolbox.
Thanks!
the type of the string is wrong, you try a string (80) and should be a pointer to string,
there are types available in the library, and you have to be sure the types on input and inside FB are the same.
on some it is the version that gives a problem, so check if the version of the codesys can cope and with the PLC and with the libraries.
How do I declare a variable as 'POINTER TO STRING(255)'? I tried that too and still got an error. For example, I declared the variable.
ToEmailAddress : POINTER TO STRING(255) := e 'myemail@mycompany.com e ';
I know my PLC doesn't support the function block, but that is a socket issue. The errors I'm getting are about mismatched variables and data types. I understand the subject email address has to be 'POINTER TO STRING(255)' but don't know how to declare a variable as that.
a Pointer must be pointing to a Variable, so not the content but a Var, and obvious this must be same type so both 80 or 255.
not to a piece of text.
btw, i never use pointers, as this is not conform the standard. IEC61131
Did you notice the example within the online help?
Example:
pt:POINTER TO INT;
var_int1:INT := 5;
var_int2:INT;
pt := ADR(var_int1);
var_int2:= pt^; ( var_int2 is now 5 )