Datasheet
Project
If the I/O system is a part of a project, the registration is made in a c module that is linked with the
plc program. In the example below, the classes Ssab_Rack and Ssab_AiuP are registered in the file
ra_plc_user.c
#include "pwr.h"
#include "rt_io_base.h"
pwr_dImport pwr_BindIoUserMethods(Ssab_Rack);
pwr_dImport pwr_BindIoUserMethods(Ssab_Aiup);
pwr_BindIoUserClasses(User) = {
pwr_BindIoUserClass(Ssab_Rack),
pwr_BindIoUserClass(Ssab_Aiup),
pwr_NullClass
};
The file is compiled and linked with the plc-program by creating a link file on $pwrp_exe. The file
should be named plc_'nodename'_'busnumber'_'plcname'.opt, e.g.
plc_mynode_0517_plc.opt. The content of the file is sent as input data to the linker, ld, and
you must also add the module with the methods of the class. In the example below these modules
are supposed to be found in the archive $pwrp_lib/libpwrp.a.
$pwr_obj/rt_io_user.o -lpwrp -lpwr_rt -lpwr_usbio_dummy -lpwr_usb_dummy -lpwr_pnak_dummy
-lpwr_cifx_dummy -lpwr_nodave_dummy -lpwr_epl_dummy
Example of rack methods
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include "pwr.h"
#include "pwr_baseclasses.h"
#include "pwr_ssaboxclasses.h"
#include "rt_io_base.h"
#include "rt_errh.h"
#include "rt_io_rack_init.h"
#include "rt_io_m_ssab_locals.h"
#include "rt_io_msg.h"
/* Init method */
static pwr_tStatus IoRackInit( io_tCtx ctx,
io_sAgent *ap,
io_sRack *rp)
{
io_sRackLocal *local;
/* Open Qbus driver */
local = calloc( 1, sizeof(*local));
rp->Local = local;
local->Qbus_fp = open("/dev/qbus", O_RDWR);
if ( local->Qbus_fp == -1) {
errh_Error( "Qbus initialization error, IO rack %s", rp->Name);
ctx->Node->EmergBreakTrue = 1;
return IO__ERRDEVICE;
}










