
B-66284EN/01 4.EMBEDDING OF C APPLICATIONS
- 355 -
-3 Too long function name
(exceeding 30 characters)
NOTE
1 Pointer to the argument character string specified
with a function call control.
If user_Func[123_456] is specified with a function
call control, a pointer to the character string
“123_456” is passed as an argument and,
therefore, create a function with “usr_Func(char*)”.
Notes:
• The function name must always start with the four characters
“usr_”.
• The maximum number of characters in a function is 40, including
those in the argument section.
• No blanks can be used to specify an argument with a function
call control.
• An argument must always be enclosed in “[“ and “]”.
• For a read function in a ten-key pad call control, create the
function as one that returns the data value that has been read.
Example: Function to return a custom macro variable value
long usr_rmacro(char *param)
{
int ret;
struct odbpm buf;
int num;
// Analysis of param
// For example,
// decide the common variable number (num)
ret = cnc_rdmacro(num, 10, buf);
if (ret != 0) {
// Error handling
}
return buf.mcr_val;
}
• For a write function in a ten-key pad call control, the function is
called with the unsigned long argument added to the write
function argument specified with ten-key pad call control.
Example 1
Calling a user function with only a write data argument
Create a user function with usr_wmacro(unsigned long data).
Specify usr_wmacro[] as the write function specification in the
ten-key pad control.
The function is called with usr_wmacro (data) from the ten-key
call control. (data is the input value from the ten-key pad.)