Codesys mmp read block issue

I have a read block set up in my codesys program and have some values entered in the scratchpad to read. However only the first index of the scratchpad is read to the first element of the array. Here is how I have the mmp function blocks configured. It is a 3 element array. I assume this will read the values of index 0 in the scratchpad to element 0 in the array and so on with the other two values.

mmpClient1(
xConnect := TRUE,
sAddress := ‘127.0.0.1’
);

MmpReadDelay(IN := NOT MmpReadIntegerTimes.xBusy, PT := T#100MS);

mmpReadIntegerTimes(
xExecute := MmpReadDelay.Q,
udiTimeOut := 1000000,
udiMmpAddress := 16#F0D81000, // Scratchpad location 32 bit integer index 0 through 3 currently used. Indexs 4 through 30 spare.
rClient := mmpClient1,
pData := ADR(TimesInt),
uiCount := SIZEOF(TimesInt),
);

Can you provide your variable list as well? specifically what the type for TimesInt is. Did you follow the example code provided in the developer site for this example?

I verified the code:

PROGRAM ReadArray
VAR
	mmpClient:     OPTO.MmpClient;
    mmpReadBlock:  OPTO.MmpClientReadBlock;
    audiValues:    ARRAY[0..5] OF UDINT;
    tonReadDelay:  TON;
END_VAR
mmpClient(
		xConnect := NOT mmpClient.xError,
		sAddress := '127.0.0.1'
		);
		
tonReadDelay(
	IN := NOT mmpReadBlock.xBusy,
	PT := T#5S
	);

mmpReadBlock(
	xExecute := tonReadDelay.Q,
	udiTimeout := 1000000,
	udiMmpAddress := 16#F0D81000,
	rClient := mmpClient,
	pData := ADR(audiValues),
	uiCount := SIZEOF(audiValues)
	);
2 Likes

The array was of UINT not UDINT. That solved the issue.

Thank you

1 Like