⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 serial.txt

📁 FANUC数控设备的采集开发包FOCAS2.针对串口内容.
💻 TXT
📖 第 1 页 / 共 3 页
字号:
Arguments:
    name
        Points to a null-terminated string that specifies the file name.
        (17 characters or less)
        If the first character is "#", it is supposed that the file number is 
        specified.
            "#xxxx": The xxxx-th file (xxxx are 4 digits or less)
            "#0"   : The first file
            "#N"   : The next file
            "#E"   : The next file of the last (a new file is created)
    
    mode
        Points to a null-terminated string that specifies the access mode.
            "r": read
            "w": write

Return Values:
    If the function succeeds, the return value is 0.
    If an error occurs, the return value is -1.

Remarks:
    The fca_fopen function should be used with the fca_fclose function in 
    pairs.
    Between the fca_fopen function and the fca_fclose function, only the 
    fca_getc function and the fca_putc function can be called.
    If the other FCA Library functions (fca_xxxxxx) are called, an error 
    occurs. (except the fca_status function and the fca_bye function)
------------------------------------------------------------------------------


Function Name:
    fca_fclose

Description:
    Closes the file opened by the fca_fopen function.

Declaration:
    #include "fca32.h"
    int WINAPI fca_fclose(void);

Arguments:
    None

Return Values:
    If the function succeeds, the return value is 0.
    If an error occurs, the return value is -1.

Remarks:
    The fca_fclose function should be used with the fca_fopen function in 
    pairs.
    Between the fca_fopen function and the fca_fclose function, only the 
    fca_getc function and the fca_putc function can be called.
    If the other FCA Library functions (fca_xxxxxx) are called, an error 
    occurs. (except the fca_status function and the fca_bye function)
------------------------------------------------------------------------------


Function Name:
    fca_getc

Description:
    Reads a character from the file opened by the fca_fopen function.

Declaration:
    #include "fca32.h"
    int WINAPI fca_getc(void);

Arguments:
    None

Return Values:
    If the function succeeds, the return value is the input character.
    If the function reaches the end of file or an error occurs, the return 
    value is -1.

Remarks:
    The input character code is converted from the ISO to the ASCII.
    
    For a floppy disk of the FANUC format, an extra 0x7F might be input after 
    the function reaches the end of file because the file size cannot be 
    known correctly.
    So it is necessary to judge the end of file by an application.
------------------------------------------------------------------------------


Function Name:
    fca_putc

Description:
    Writes a character to the file opened by the fca_fopen function.

Declaration:
    #include "fca32.h"
    int WINAPI fca_putc(int c);

Arguments:
    c
        Specifies the character to be output.

Return Values:
    If the function succeeds, the return value is the output character.
    If an error occurs, the return value is -1.

Remarks:
    The output character code is converted from the ASCII to the ISO.
------------------------------------------------------------------------------


Function Name:
    fca_delete

Description:
    Deletes a file on the FCA device.

Declaration:
    #include "fca32.h"
    int WINAPI fca_delete(char *name);

Arguments:
    name
        Points to a null-terminated string that specifies the file name.
        (17 characters or less)
        If the first character is "#", it is supposed that the file number is 
        specified.
            "#xxxx": The xxxx-th file (xxxx are 4 digits or less)

Return Values:
    If the function succeeds, the return value is 0.
    If an error occurs, the return value is -1.
------------------------------------------------------------------------------


Function Name:
    fca_rename

Description:
    Changes a file name on the FCA device.

Declaration:
    #include "fca32.h"
    int WINAPI fca_rename(char *oldname, char *newname);

Arguments:
    oldname
        Points to a null-terminated string that specifies the old file name.
        (17 characters or less)
        If the first character is "#", it is supposed that the file number is 
        specified.
            "#xxxx": The xxxx-th file (xxxx are 4 digits or less)
            "#0"   : The first file
            "#N"   : The next file
    
    newname
        Points to a null-terminated string that specifies the new file name.
        (17 characters or less)
        The first character cannot be "#".

Return Values:
    If the function succeeds, the return value is 0.
    If an error occurs, the return value is -1.
------------------------------------------------------------------------------


Function Name:
    fca_readdir

Description:
    Reads the directory information on the FCA device.

Declaration:
    #include "fca32.h"
    int WINAPI fca_readdir(fca_dir *buffer, int ndir, int nfile);

Arguments:
    buffer
        Points to a buffer of the fca_dir structure (array) that receives 
        the directory information.
        If NULL is specified, the buffer does not receive the directory 
        information.
    
    ndir
        Specified the file number to start reading the directory information.
    
    nfile
        Specified the number of files to read the directory information.
        If 0 is specified, the directory information up to the last file is 
        read, but the buffer does not receive the directory information.

Return Values:
    If the function succeeds, the return value is the number of files whose 
    directory information is read.
    If an error occurs, the return value is -1.

Remarks:
    To use the fca_readdir function, use the following steps.
    
        1) Specify NULL for the argument buffer and 0 for the argument nfile, 
           and call the fca_readdir function.
        2) Because the return value is the number of files after the file 
           specified by the argument ndir, allocate the buffer that can 
           receive the directory information of the files, and specify the 
           pointer for the argument buffer.
        3) Specify the number of files obtained in the step 2) for the 
           argument nfile, and call the fca_readdir function again.
    
    The fca_dir structure receives the directory information.
    
        typedef struct FCA_DIRINFO {
            char file_name[18];
            char file_size[9]; 
            char wrt_protect;  
            char record_code;  
            char vol_no[3];    
            char multi_vol;    
        } fca_dir;
        
            Member          Description
            ------------------------------------------------------------------
            file_name       Specifies a string of the file name.
                            (17 alphanumeric characters or less + null)
                            If the first character is null, a deleted file 
                            is specified.
            
            file_size       Specifies a string of the file size.
                            (8 digits + null)
            
            wrt_protect     Specifies whether the file is write-protected.
                                'P': On
                                ' ': Off
            
            record_code     Specifies the record code.
                                'B': Binary
                                'E': EIA
                                ' ': ISO
            
            vol_no          Specifies a string of the volume number.
                            (2 digits + null)
                            If "  " is specified, a single volume is 
                            specified.
            
            multi_vol       Specified whether the file is multi-volume.
                                ' ': The file is a single volume.
                                'C': The file has a next volume.
                                'L': The file is the last volume.
------------------------------------------------------------------------------


Function Name:
    fca_status

Description:
    Reads the status information on the FCA device.

Declaration:
    #include "fca32.h"
    int WINAPI fca_status(char *buffer);

Arguments:
    buffer
        Points to a buffer that receives the status information.
        2 bytes are necessary for the buffer.

Return Values:
    If the function succeeds, the return value is 0.
    If an error occurs, the return value is -1.

Remarks:
    If the FCA device is in an alarm state, the function resets the FCA 
    device and clears the alarm state.
    
    If the FCA device is not in an alarm state, the function terminates the 
    input/output operation and clears the status.
    
    The content of the status information is as follows.
    
        The first byte: Error code etc.
        
              7   6   5   4   3   2   1   0
            +---+---+---+---+---+---+---+---+
            | SD| 0 | PT|    ERROR CODE     |
            +---+---+---+---+---+---+---+---+
              |       |
              |       +---+--->0: Write-protect off
              |           +--->1: Write-protect on
              |           
              +-----------+--->0: Sending the data of a file is completed.
                          +--->1: Sending the data of a file is not completed.
            
            ERROR CODE specifies the error code of the last alarm.
            
                ERROR CODE      Cause of alarm
                --------------------------------------------------------------
                00000 (= 0)     No error
                00001 (= 1)     File search error
                00010 (= 2)     (reserved)
                00011 (= 3)     (reserved)
                00100 (= 4)     (reserved)
                00101 (= 5)     (reserved)
                00110 (= 6)     (reserved)
                00111 (= 7)     Record size over
                01000 (= 8)     (reserved)
                01001 (= 9)     Protocol error
                01010 (=10)     (reserved)
                01011 (=11)     (reserved)
                01100 (=12)     Write protect error
                01101 (=13)     (reserved)
                01110 (=14)     (reserved)
                01111 (=15)     Overrun, framing error
                10000 (=16)     (reserved)
                10001 (=17)     FD hardware error
                10010 (=18)     RAM error
                10011 (=19)     ROM sum check error
                10100 (=20)     Volume sequence error
                10101 (=21)     Format error
                10110 (=22)     Label error
                10111 (=23)     Door opened
                11000 (=24)     (reserved)
                11001 (=25)     (reserved)
                11010 (=26)     Code error
                11011 (=27)     (reserved)
                11100 (=28)     File read error
                11101 (=29)     Preparation invalid
                11110 (=30)     System error
                11111 (=31)     Power off error
        
        The second byte: The kind of floppy disk
        
              7   6   5   4   3   2   1   0
            +---+---+---+---+---+---+---+---+
            | - | - | - | C5| - | C3| C2| - |
            +---+---+---+---+---+---+---+---+
                          |       |   |
                          0       0   1 : Single side double density (1D)
                          0       1   0 : Double side double density (2D)
                          1       0   0 : Double side high density  (2HD)
------------------------------------------------------------------------------


Function Name:
    fca_remains

Description:
    Reads the rest of the floppy disk on the FCA device.

Declaration:
    #include "fca32.h"
    int WINAPI fca_remains(long *remains);

Arguments:
    remains
        Points to a 32-bit variable that receives the rest of the floppy disk.

Return Values:
    If the function succeeds, the return value is 0.
    If an error occurs, the return value is -1.

Remarks:
    The rest of the floppy disk is specified in byte.
------------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -