Ken, I'm trying to develop a logger add on which I can use in various programs. Right now I have to pass in the program and routine name along with the message I want logged. I just wanted to see if I could get them programmatically to try and save some headaches managing the name strings. (I currently have 10 programs in the controller)
One of the larger projects that I am working on is a compact logix plc completely dedicated to crunching numbers and data collection for a number of older (ie maxed out) production lines. It doesn't have any kind of HMI whatsoever, and runs autonomously. I quickly found out that I had few ways to determine what happened after problems, so I started trying to develop an internal logger of sorts to keep track of it's status / problems.
For example:
CODE
<snip>
//----------------------------------
// Transaction Error, Abort.
//----------------------------------
ELSIF logTransResult > 1 AND logTransRetries > MAX_TRANS_RETRIES THEN
//Log the error to the controller-scope log
JSR(loggerTransError, 1, logTransResult);
//Remove the problematic log from the queue
JSR(logDequeue, 0, lastProdXferLog);
</snip>
//|------------------------------------------------------------------
//| loggerTransError()
//|------------------------------------------------------------------
SBR(someTransResult);
//Start the message
COP(STRING_ERROR, tempMessage, 1);
CONCAT(tempMessage, ASCII_SPACE, tempMessage);
CONCAT(tempMessage, STRING_CODE, tempMessage);
CONCAT(tempMessage, ASCII_SPACE, tempMessage);
//Get the error code and add it to the message
rssqlErrorDecode(errorDecoder, someTransResult, errorCode);
DTOS(errorCode, tempString);
CONCAT(tempMessage, tempString, tempMessage);
//Pass the completed message on to be added to the log
logger(logger_controller, STRING_PROD_XFER, STRING_TRANSHANDLER, tempMessage, logs_controller);
RET();
I'm not sure if it's the best way to do what I'm looking for, but it seems to work ok, barring being a tad memory intensive...
I don't have much experience with CIP generic messages. Could you explain that a bit further?
Thanks for the help.