Fanuc C-Executer Operating Manual
B-62443EN-3/03E
- 602 -
------------------------------------------------------------------------------
2.7 Read PMC message. <Main,Alarm>
------------------------------------------------------------------------------
[Name]
pmc_rdpcmsg
[Syntax]
#include <data.h>
#include <fwindow.h>
int pmc_rdpcmsg( unsigned int adr_no, unsigned int adr_bit,
struct pmcmsg *buf ) ;
struct pmcmsg {
unsigned int msg_len ; /* Length of message. */
unsigned char pmc_msg[256] ; /* PMC message string. */
} ;
[Arguments]
adr_no PMC address A. ( =0 - 24 )
adr_bit Bit of PMC address A. ( =0 - 7 )
buf Buffer in which PMC message is stored.
[Return]
0 Successful.
3 Incorrect PMC address A.
4 Incorrect bit of PMC address A.
5 No message for specified address.
[Description]
Reads the specified PMC message data.
This function reads the corrsponding message to the specified PMC
address A and bit number.
Specify the number of address A in "adr_no" with binary format.
Specify the bit number 0 - 7 in "adr_bit" with binary format.
The PMC message is stored in "buf.pmc_msg". The PMC message is the
ASCII string as same as one which is displayed in the CNC's alarm
message screen. The 2-byte character such as Japanese Kanji character
is stored by Shift-JIS code. A 'null' character ('\x00') is added
at the end of the string. The length of the string stored in
"buf.pcm_msg" is stored in "buf.msg_len" with binary format.
This function is available for only FS16/18 Model C or later.
[Example]
The following program reads all PMC message strings, and displays them
on the screen.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
#include <stdlib.h>
void example( void )
{ int ret ;
unsigned int idx, bit ;
struct pmcmsg *buf ;
buf = (struct pmcmsg *)malloc( sizeof( struct pmcmsg ) ) ;
for ( idx = 0 ; idx <= 24 ; idx++ ) {
for ( bit = 0 ; bit <= 7 ; bit++ ) {
ret = pmc_rdpcmsg( idx, bit, buf ) ;
if ( !ret ) printf( "A%02u.%u \"%s\"\n",
idx, bit, buf->pmc_msg ) ;
}
}
free( buf ) ;