BASEstartm Classic DAS
for Siemens H1tm Protocol
Installation and User's Guide


Previous Contents Index


Appendix B
Sending and Receiving Data Using ILAN$DEVICE_SPECIFIC

This service is used to send or receive data packets to or from Siemens programmable controllers.

To send or receive a message, one has to define the unsolicited TSAP by specifying the name of the unsolicited TSAP in the /NETADDR definition of the Siemens device.

Note

You cannot use the ILAN$DEVICE_SPECIFIC routine to send and receive data on a device defined as unsolicited.

You can use the following program to send data to the programmable controller, using an unsolicited TSAP.


#include stdio 
#include stdlib 
#include ssdef 
 
#include <ilan_defs> 
#include <ilan_services> 
#include <dcm_h1$def> 
 
main () 
    { 
    long int ret; 
    char *device_name = "S150_DEVICE"; 
    long int send_function = dcm_h1$k_send_message; /* Send message */ 
    short int ret_length; 
    unsigned char request_buffer[512]; 
    unsigned char *null_buffer = NULL; 
    short int request_buffer_len; 
    short int response_buffer_len; 
 
    request_buffer_len = 10; 
    response_buffer_len = 0; 
    ret = ilan_device_specific (0, 
    device_name, 
    &send_function, 
    &request_buffer_len, 
    (struct itmlst *) request_buffer, 
    &response_buffer_len, 
    (struct itmlst *) null_buffer, 
    &ret_length); 
    exit (ret); 
    } /* End main */ 
 

You can use the following program to receive data from the programmable controller, using an unsolicited TSAP.


#include stdio 
#include stdlib 
 
#include <ilan_defs> 
#include <ilan_services> 
#include <dcm_h1$def> 
main () 
    { 
    long int ret; 
    char *device_name = "S150_DEVICE"; 
    long int rcv_function = dcm_h1$k_receive_message; /* Receive message */ 
    short int ret_length; 
    unsigned char request_buffer[512]; 
    unsigned char response_buffer[512]; 
    unsigned char *null_buffer = NULL; 
    short int request_buffer_len; 
    short int response_buffer_len; 
 
    request_buffer_len = 0; 
    response_buffer_len = sizeof (response_buffer); 
    ret = ilan_device_specific (0, 
                                device_name, 
                                &rcv_function, 
                                &request_buffer_len, 
                                (struct itmlst *) null_buffer, 
                                &response_buffer_len, 
                                (struct itmlst *) response_buffer, 
                                &ret_length); 
    exit (ret); 
    } /* End main */ 
 


Previous Next Contents Index