Jump to content
OMRON Forums

Recommended Posts

Posted
Hello, We need a way to pass a single string (these can be finite size, e.g. 512 bytes max) from Capps to an HMI application. Ideally we might want the same functionality from motion progs and PLCs but this is not necessary at the moment. Since we aren't sure which path we are going to take for the HMI we want to leave the ability to access the string from the native PPMAC "C API" or any future API servers that are in development. We are currently considering packing the char array into the user buffer at a location picked by us because it is probably the most compatable with the different approaches. Is this the cleanest path to implement or is there a builtin facility for global string variables? Thank you, KEJR
  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted
In the C API we have the SEND structure which allows this to happen. There are 4 ports that data comes out on and we have an AppWare which will notice when a message is in the buffer and read it and pass it on. If you want to use our SEND structure then you could also link your HMI to our AppWare. The idea behnd this was that others need not remake something we must also do. The Unsolicited window in the IDE uses this feature. It will also get data from script programs so it is a total solution. From the C API manual the syntax is: //------------------------------------------------------------------- // Send: Puts the string in the SENDn Port buffer // There are four SEND Ports // returns: // 1 If it did - this doesn’t mean it went out. It just // concatenated the string to the other strings in the buffer. // 0 If it couldn't because the buffer was full or the Port was busy // In this case you must retry later to send your string out. // -1 If SENDn Port timedout - no one picked up the data // in the time set by "sys.SendTimeout”. The string buffer Port // is cleared in this case. //------------------------------------------------------- enum sendport {SEND1_PORT, SEND2_PORT, SEND3_PORT, SEND4_PORT}; int Send(enum sendport SendPort, char *pinstr) The Syntax from Script programs can be found in the program command manual, it is: send Function: Send formatted text string to specified port Syntax: send{constant}[,]"{string}"[,{expression}…] where: • {constant} is an integer in the range of 0 to 4 (inclusive) specifying the software communications port over which the string will be sent • {string} is a formatted ASCII text string consisting of literal alphanumeric characters, escape sequences, and formatted variable sequences, as explained below • {expression} is a mathematical expression containing the value that is to be sent for the matching formatted variable sequence in the string. There must be one expression for each formatted variable sequence. The send command causes the Power PMAC to transmit a formatted text string to the specified software communications port. The constant value immediately following the send – 0, 1, 2, 3, or 4, indicates the software port number over which the string will be sent. The host computer should have started the Power PMAC “sendgetsends” utility with a sendgetsends –n (where n is the matching port number) telnet command so these strings can be transmitted to the host. (In the IDE, the “Unsolicited Messages” window sets this up automatically and displays sent strings, and so is an excellent tool for debugging applications.) When the command is processed as part of program execution, the string is created and buffered for transmission over the specified port. Once the string is buffered, program execution continues; it does not wait until the string is transmitted over the port. However, if a previously created string for the same port is still in the buffer, not yet having been transmitted, program execution waits until the new string can be placed in the buffer. The string to be sent is a combination of standard ASCII characters, “escape sequences” that are started with a “backslash” (\) character and permit the output of control and special characters, and “format sequences” that are started with a “percent” (%) character and specify how the numerical value of an expression is to be formatted as a string. For each format sequence, there must be a matching expression following the string. The following escape sequences can be used (all letters must be lower case): • \a Bell (ASCII 7) • \b Backspace (ASCII 8) • \t Horizontal tab (ASCII 9) • \n New line (ASCII 10) • \v Vertical tab (ASCII 11) • \f Form feed (ASCII 12) • \r Carriage return (ASCII 13) • \\ Backslash character • \? Question-mark character • \' Single-quote character • \" Double-quote character • \ooo Octal specification of ASCII character code (of range 000 to 377) • \xhh Hexadecimal specification of ASCII character code (of range x00 to xff) The following format sequences can be used (all letters must be lower case): • %d Signed integer, decimal format • %u Unsigned integer, decimal format • %x Unsigned integer, hexadecimal format • %nx Unsigned integer, hexadecimal format, using n digits (n = 1 to 8) • %f Floating-point value, 6 digits total • %nf Floating-point value, n digits total (n = 1 to 31) • %% Percent character In a telnet communications session, the Power PMAC “sendgetsends” utility is started with the general syntax getsends –n [-n2…] [-b] [-fname] , where n, n2, etc. are the numbers of the software communications ports to activate for potential unsolicited communications, the optional “-b” implements binary mode (without binary mode, the Power PMAC cannot send the “null” character (ASCII 0) without terminating the string, and Power PMAC automatically appends the port number to the beginning of the string), and the optional fname enables the writing of the string into a file by specifying the name of that file. Examples send0,"Hello, World!"; // Pure literal string to Port 0 send1,"Hello, World!\n"; // String with Newline control character at end send2,"Cycle counter=%u\n",P100; // String with unsigned integer value send3,"Xpos: %9fmm Ypos: %9fmm\n",Q107*25.4,Q108*25.4; // String with 2 floating-point expressions
Posted
Brad, I can see how the Capp and script programs will send out data using the send command, but you did not describe the receiver function other than mention it is an AppWare. Is this Appware released yet, or is it part of the .net to PMAC communication package we have discussed that is in currently in development? Will the receiver function be able to process the buffer as raw data FIFO style stream (like a file or socket does)? On the HMI side I'd like to read the message in the buffer (terminated by an end of string character), and display it to a text box of some sort. Subsequent strings will *overwrite* previous entries in the text box instead of scrolling down. If I can read the "send" buffer as raw data in a FIFO buffer queue this is easy. Thank you, KEJR
Posted
AppWare is short for Application Software which is the name we have given to compiled C code resident in the Power Pmac that does some function for us. Most things we make that we believe are usable by others are made in AppWare. That way once we have it working you do not need to recreate it. All of the tuning processes like Step Move, AutoTune are AppWare. Hall Sensor Calibration, Commutation Six Step and many others are AppWare. The functionality of the Unsolicited message window of the IDE is an AppWare and this is what you are trying to create. Since the IDE already does this it is released. This is a component in the component library and you can use it that way. Or you can use it directly. In Telnet start the program /opt/ppmac/sendgetsends/sendgetsends -{port} For example I want to listen to port 1 and 3 I run /opt/ppmac/sendgetsends/sendgetsends -1 -3 At this point whenever a message comes to port 1 or 3 I will get it sent to me with the prefix -{port}:{message} or {message} depending on the setting of Sys.SendFileMode. Sys.SendFileMode is a bit field in which the bit corresponding to the port number can be 1 to enable the port echo or zero to only get the message. So Sys.SendFileMode=10 means port 3 and 1 have port echo enabled.
Guest
This topic is now closed to further replies.

×
×
  • Create New...