답변감사합니다. 언제나 답변은 civilian,안영제 님 아니면 임프님이 해주시는군여.
멀로 대처해야 하는지 이해가 안가네욤.. variant 인거 같기도 하고 Var 로 인자선언하는거 같기도 하고.
TObject 로 해야하는지.. 하핳.. 별의별 생각을..
밑에 자료는 함수 설명자료입니다. C++ 언어 기준으로 설명되어 있습니다. 헤더 화일을 델로 만들려는 거구요..
비베 , C++ 로 예제 자료와 샘플이 있어서 그쪽으로 옮길까 하다가 아무래도 델을 버릴수가 없어 꾸역 꾸역
헤더화일을 델파이로 바꾸는 중입니다.
C++ 보다는 VB 가 해석하기 쉬워 VB 함수 선언을 질문드렸던 거구요.
함수가 무지 많은데 이부분에서 막혔씁니다..
#include "fwlib32.h"
FWLIBAPI short WINAPI cnc_rdophistry(unsigned short FlibHndl, unsigned short s_no, unsigned short e_no, unsigned short length, ODBHIS *his);
Description
Reads the operation history data.
The unit of one operation history data is called a record. The structure of the operation history data is different according to the kind of the record (rec_type). When the operation history data is accessed, it is necessary to use a structure corresponding to the kind.
The operation history data and the alarm history data are automatically recorded on the CNC. When these data are accessed, it is necessary to temporarily stop sampling on the CNC. Therefore, it is necessary to execute "Stop logging operation history data" (cnc_stopophis) before this function is used.
And it is necessary to execute "Restart logging operation history data" (cnc_startophis) after reading to make the sampling stop time of the history data as short as possible.
The start/end record number means the relative number uesd at reading the operation history data. These record numbers are valid only at the period from the execution of cnc_stopophis function until the execution of cnc_startophis function.
This function cannot be used for Series 15, so use cnc_rdophistry2 function instead of cnc_rdophistry function.
Arguments
FlibHndl [in]
Specify the library handle. See "Library handle" for details.
s_no [in]
Specify the start record number. (more than 1)
e_no [in]
Specify the end record number. (more than 1)
length [in]
Specify the data block length (size of ODBHIS structure).
ODBHIS
his [out]
Pointer to the ODBHIS structure in which the operation history data is stored. The ODBHIS structure is as follows.
typedef struct odbhis {
unsigned s_no; /* Start record number */
short type; /* Not used */
unsigned e_no; /* Most recently entered */
/* record number */
union {
struct {
short rec_type; /* Record type */
short alm_grp; /* Alarm type */
short alm_no; /* Alarm number */
char axis_no; /* Axis number */
char dummy; /* Not used */
} rec_alm; /* Structure of alarm */
/* record */
struct {
short rec_type; /* Record type */
char key_code; /* Key code */
char pw_flag; /* Power-on flag */
char dummy[4]; /* Not used */
} rec_mdi; /* Structure of */
/* MDI key record */
struct {
short rec_type; /* Record type */
char sig_name; /* Signal name */
char sig_old; /* Bit pattern before a */
/* transition */
char sig_new; /* Bit pattern after a */
/* transition */
char dummy; /* Not used */
short sig_no; /* Signal number */
} rec_sgn; /* Structure of signal */
/* record */
struct {
short rec_type; /* Record type */
char year; /* Year */
char month; /* Month */
char day; /* Day */
char pw_flag; /* Power-on flag */
char dummy[2]; /* Not used */
} rec_date; /* Structure of date */
/* record */
struct {
short rec_type; /* record type */
char hour; /* Hour */
char minute; /* Minute */
char second; /* Second */
char pw_flag; /* Power-on flag */
char dummy[2]; /* Not used */
} rec_time; /* Structure of Time */
/* record */
} data[N]; /* N : Number of record */
} ODBHIS ;
rec_type
Record type 0 : MDI key history
1 : Signal history
2 : Alarm history
3 : Date history
4 : Time history
5 : MDI key history for 2nd path
6 : Signal history for 2nd path
7 : Alarm history for 2nd path
10 : MDI key history for 3rd path
11 : Signal history for 3rd path
12 : Alarm history for 3rd path
alm_grp
Alarm type
Series 16/18/21/0, Power Mate bit 0 : P/S 100
bit 1 : P/S 000
bit 2 : P/S 101
bit 3 : P/S others
bit 4 : Over travel
bit 5 : Over heat
bit 6 : Servo alarm
bit 7 : System alarm
bit 8 : APC alarm
bit 9 : Spindle alarm
bit 10 : P/S 5000,.., Punch press alarm
bit 11 : Laser alarm
bit 12 : (Not used)
bit 13 : Rigid tap alarm
bit 14 : (Not used)
bit 15 : External alarm message
Series 16i/18i-W bit 0 : P/S alarm
bit 1 : Overtravel alarm
bit 2 : Servo alarm
bit 3 : (Not used)
bit 4 : Overheat alarm
bit 5 : Stroke limit - 1
bit 6 : Stroke limit - 2
bit 7 : Edit alarm
bit 8 : APC alarm
bit 9 : System alarm
bit 10 : P/S 5000 ... alarm
bit 11 : (Not used)
bit 12 : (Not used)
bit 13 : (Not used)
bit 14 : External alarm
bit 15 : Reverse control alarm
alm_no
Alarm number
axis_no
Axis number (not used)
key_code
Key code
pw_flag
Power-on flag 1 : For power on
0 : Usually, 0 is stored
sig_name
Signal name 1 : X
2 : G
3 : Y
4 : F
sig_old
Bit pattern before transition
sig_new
Bit pattern after transition
sig_no
Signal number X : 0,..,127, 1000,..,1063
G : 0,..,255, 1000,..,1255, 2000,..,2255
Y : 0,..,127, 1000,..,1063
F : 0,..,255, 1000,..,1255, 2000,..,2255
year
Year (0,..,99)
month
Month (1,..,12)
data
Day (1,..,31)
hour
Hour (0,..,23)
minute
Minute (0,..,59)
second
Second (0,..,59)
Return
EW_OK is returned on successful completion, otherwise any value except EW_OK is returned. The major error codes are as follows. (As for the details, see "Return status of Data window function") Return code Meaning/Error handling
EW_FUNC cnc_stopophis function has not been executed.
EW_LENGTH Data block length error
Size of ODBHIS structure(length) is wrong.
The wrong case is as follows.
(e_no-s_no+1) × sizeof(data[0]) + 6 < length
EW_NUMBER Data number error
The record number (s_no, e_no) is wrong.
Others EW_PROTOCOL, EW_SOCKET, EW_HANDLE, EW_VERSION, EW_UNEXP
CNC option
The Ethernet function and the extended driver/library function are necessary.
However, in case of FS16i/18i/21i/0i MODEL B, the required CNC option is as follows.
When Embedded Ethernet is used,
above two optional functions are not required.
When Ethernet board is used,
only Ethernet function is required.
CNC parameter
This function is related to the following CNC parameter. See the manual of CNC parameter for details.
Series 16/18/21/0, Power Mate
3112#5=0 (must be set)
Series 16i/18i-W
3112#5=1 (must be set)
ODBHIS *his <- 이걸 어케 해야 할지..ODBHIS 라는 struct 형의 포인터를 전달하는건지..
ODBHIS 의 Record 형을 만들고 (위의 선언처럼)그 포인터를 전달하는 건지.. 판단이 서질 않습니다.
그리고 이름은 다르지만 ODBHIS1,ODBHIS 2,ODBHIS 3,ODBHIS 4,ODBHIS 5 라는 레코드 형은 이미 선언 되어있습니다.
ODBHIS1 = Record
nS_no : Integer; // start number
nRecord : Integer; // dummy
nE_no : Integer; // end number
nRec_alm : Array [0..9] of RECALM;
End; // In case that the number of data is 10
RECMDI = Record
nRec_type : Integer; // record type
sKey_code : byte; // key code
sPw_flag : byte; // power on flag
sDummy : Array [0..3] of byte;
End;
ODBHIS2 = Record
nS_no : Integer; // start number
nRecord : Integer; // dummy
nE_no : Integer; // end number
nRec_mdi : Array [0..9] of RECMDI;
End; // In case that the number of data is 10
RECSGN = Record
nRec_type : Integer; // record type
sSig_name : byte; // signal name
sSig_old : byte; // old signal bit pattern
sSig_new : byte; // new signal bit pattern
sDummy : byte;
nSig_no : Integer; // signal number
End;
ODBHIS3 = Record
nS_no : Integer; // start number
nRecord : Integer; // dummy
nE_no : Integer; // end number
nRec_sgn : Array [0..9] of RECSGN;
End; // In case that the number of data is 10
RECDATE = Record
nRec_type : Integer; // record type
sYear : byte; // year
sMonth : byte; // month
sDay : byte; // day
sPw_flag : byte; // power on flag
sDummy : Array [0..1] of byte;
End;
ODBHIS4 = record
nS_no : Integer; // start number
nRecord : Integer; // dummy
nE_no : Integer; // end number
nRec_date : Array [0..9] of RECDATE;
End; // In case that the number of data is 10
RECTIME = Record
nRec_type : Integer; // record flag
sHour : byte; // hour
sMinute : byte; // minute
sSecond : byte; // second
sPw_flag : byte; // power on flag
sDummy : Array [0..1] of byte;
End;
ODBHIS5 = Record
nS_no : Integer; // start number
nRecord : Integer; // dummy
nE_no : Integer; // end number
nRec_time : Array [0..9] of RECTIME;
End;
개념부터 잡고 가고 싶어 도움을 여쭙니다. 송구스럽지만 부탁드립니다.
건성건성 C++를 아는것이라 개념이 많이 부족합니다.
긴글 죄송합니다. ..
가르침 부탁드립니다. (__)
|