|
Re: Using Forte with non supported WAGO PFC200 IO modules [message #1833164 is a reply to message #1833105] |
Mon, 05 October 2020 07:40 |
Jose Maria Jesus Cabral Lassalle Messages: 199 Registered: February 2016 |
Senior Member |
|
|
Hi,
you probably won't be able to use the modules using the other FBs . You don't need to do anything with the end module in 4diac. This is just for the hardware.
To extend the other modules the way to do it is:
1- Copy one of the existing FBs modules and change its name (for example Wago1506 -> Wago430) and change the inputs/outpus according to what you have in each module. Leave the events and bus as they are, and then export it as cpp files.
2- In the generated file, you need to do some changes. Copy the first part of other module and paste it there. Which part? The public and protected part, for example
class FORTE_Wago459: public WagoSlaveBase{
DECLARE_FIRMWARE_FB(FORTE_Wago459)
public:
FUNCTION_BLOCK_CTOR_FOR_WAGO_SLAVES(FORTE_Wago459, 459){
};
virtual ~FORTE_Wago459(){};
protected:
INIT_HANLDLES(0, 0, 4, 0)
Some things to take care of here:
- Don't change the name of the class, only the inheritance (it should inheritate from WagoSlaveBase. You will need to include this header too)
- INIT_HANLDLES takes 4 arguments, which are the number of boolean inputs, number of boolean outputs, number of analog inputs and number of analog outputs). Use the numbers according to the module
- FUNCTION_BLOCK_CTOR_FOR_WAGO_SLAVES takes two arguments: The first one is the class name, and the second is a number. This number is the tricky part. This is an identifier of each specific module. For the 459 it is the same actually, but for example for the 1506 it is 34831
I was checking the code right now to see if the id is logged, but apparently not. I think there's an error in wagoDeviceController.cpp:init()
for(size_t i = 0; i < mTerminalCount; ++i) { // find kbus device
if(0 == strcmp(deviceList[i].DeviceName, scmKBusDeviceName)) {
mKBusDeviceId = deviceList[i].DeviceId;
if(0 != mAppDevInterface->OpenDevice(mKBusDeviceId)) {
DEVLOG_ERROR("[WagoDeviceController] %s \n", scmFailedToOpenKBusDevice);
return scmFailedToOpenKBusDevice;
}
return loadTerminalInformation();
}
}
for(size_t i = 0; i < mTerminalCount; i++) {
DEVLOG_INFO("[WagoDeviceController] Found device with ID: %d\n", mTerminalIds[i]);
}
the last for loop which prints the IDs information (which is what you need) won't be executed. So if you move the loop inside the loadTerminalInformation() function before the last return it should work.
What you'll do then is to connect your new modules, and check the log for the ID information. And these numbers you'll use as the second argument of FUNCTION_BLOCK_CTOR_FOR_WAGO_SLAVES
|
|
|
Powered by
FUDForum. Page generated in 0.02521 seconds