Recent Posts

Pages: 1 [2] 3 4 ... 10
11
Controllers / Using MC024 to control s20 pump
« Last post by Mr.Jacobee on September 25, 2023, 02:05:51 PM »
Hello,

Could anyone tell me if it is at all possible to use PLUS+1 software to control pumps like those from s20? Better yet, is there any way to change output current on a pin ? Let's say I use standard s90 EDC block in GUIDE and I want to get it to 100mA (while standart for EDC on s90 should be 85mA)?

Thank you all in advance.
12
Controllers / Re: Read multiple Can messages same ID
« Last post by F.M.Elettromeccanica on September 23, 2023, 06:58:03 PM »
FluidPowerTom, I still can't get your code to work. Maybe I'm making a mistake somewhere. I will reply as soon as possible and let you know. Thank you, many thanks for everything.
13
Controllers / Re: Read multiple Can messages same ID
« Last post by FluidPowerTom on September 19, 2023, 05:35:29 PM »
The programming syntax is interfering with part of the code I wrote

FOR i = 0 TO 7 DO
    Arr0[i+Index_Adder]:=Data[''i'']; (remove apostrophes on i)
END_FOR
14
Controllers / Re: Read multiple Can messages same ID
« Last post by FluidPowerTom on September 19, 2023, 05:33:19 PM »
Matt, that's a good tip which sounds like a possible way to do this in GUIDE graphical.

F.M., should the output arrays be 80 elements instead of 8?  In that case I'd do some index incrementing perhaps like the below when a new message is received with the same Data[0].  I'd recommend using the Rx output from the CANRx block which will turn on for one scan whenever a new message is received:



FUNCTION_BLOCK GGA_Decoder
VAR_INPUT
  Data : ARRAY[0..7] OF USINT;
  Length : USINT;
  CAN_Rx: BOOL;
END_VAR
VAR_OUTPUT
  Arr0 : ARRAY[0..79] OF USINT := [0, 0, 0, 0, 0, 0, 0, 0];
  Arr1 : ARRAY[0..79] OF USINT := [0, 0, 0, 0, 0, 0, 0, 0];
  Arr2 : ARRAY[0..79] OF USINT := [0, 0, 0, 0, 0, 0, 0, 0];
  Arr3 : ARRAY[0..79] OF USINT := [0, 0, 0, 0, 0, 0, 0, 0];
  Arr4 : ARRAY[0..79] OF USINT := [0, 0, 0, 0, 0, 0, 0, 0];
  Arr5 : ARRAY[0..79] OF USINT := [0, 0, 0, 0, 0, 0, 0, 0];
  Arr6 : ARRAY[0..79] OF USINT := [0, 0, 0, 0, 0, 0, 0, 0];
END_VAR
VAR
  Index : USINT;
  Index_Adder: USINT;
END_VAR


//Increment indexer
IF CAN_Rx AND Index=Data[0] THEN
    Index_Adder:=Index_Adder+8;
ELSIF CAN_Rx AND Index<>Data[0] THEN
    Index_Adder:=0;
END_IF

// Extract Identifier
Index := Data[0];

FOR i = 0 TO 7 DO
    Arr0[i+Index_Adder]:=Data;
END_FOR


I think the above will save 80 elements with each message data in sequence in an 80 element array.  I haven't tested this of course.  You'll need to implement some other logic to fill in the other arrays with different byte 0 values, so some logic needs to be added for that


CASE Index OF
  160, 192, 32, 0, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240:
    Arr0 := Data;
  161, 193, 33, 1, 65, 81, 97, 113, 129, 145, 161, 177, 193, 209, 225, 241:
    Arr1 := Data;
  162, 194, 34, 2, 66, 82, 98, 114, 130, 146, 162, 178, 194, 210, 226, 242:
    Arr2 := Data;
  163, 195, 35, 3, 67, 83, 99, 115, 131, 147, 163, 179, 195, 211, 227, 243:
    Arr3 := Data;
  164, 196, 36, 4, 68, 84, 100, 116, 132, 148, 164, 180, 196, 212, 228, 244:
    Arr4 := Data;
  165, 197, 37, 5, 69, 85, 101, 117, 133, 149, 165, 181, 197, 213, 229, 245:
    Arr5 := Data;
  166, 198, 38, 6, 70, 86, 102, 118, 134, 150, 166, 182, 198, 214, 230, 246:
    Arr6 := Data;
 
END_CASE
15
Controllers / Re: Read multiple Can messages same ID
« Last post by F.M.Elettromeccanica on September 19, 2023, 05:26:34 PM »
Matt_Ing, you are the Goat. that's is working perfectly as i want.
I'm making an NMEA2000 GNSS parsing,i will share the project once tested.
16
Controllers / Re: Read multiple Can messages same ID
« Last post by Matt_Eng on September 19, 2023, 04:22:03 PM »
Hi,
It can be a little tricky initially to deal with a multi-message data array in GUIDE, I know I struggled with it when I first started working in GUIDE.
There are a few different ways you can go about implementing the reception, but I'll describe the most straight forward method, based on your latest message.

I'll first describe how Protected works, as it is key to getting this working. Imagine you have an list of messages that was received each loop.
When Protected is False, it will only grab the newest message that is available, so if 3 messages were received that match the CAN receiver the oldest 2 are discarded and only the latest is used.
This is useful for receiving something like a joystick message, where the latest data is preferred.
When Protected is True, it will pop off the first message it finds and return that. Then if you have an additional CAN receiver with the same setup and protected True, that 2nd receiver will get the second message that was received.

So by having multiple receivers with Protected True, you can see all the messages that were received over a loop.
The next part is to choose to have a Receive CAN with Filter for every sequence byte, as shown in my example picture. This allows us to apply a data mask and further limit which message is received. This is a good option if the amount of data being transmitted is less than 10 messages.
More Advanced: If it is more than 10, then I just use 3-5 Receive CAN with ID Filter and use additional logic to place the messages in the correct spot of the combined array.

I hope this helps, Matt_Eng
17
Controllers / Re: Read multiple Can messages same ID
« Last post by F.M.Elettromeccanica on September 19, 2023, 01:22:32 AM »
And this is the Trace
18
Controllers / Re: Read multiple Can messages same ID
« Last post by F.M.Elettromeccanica on September 19, 2023, 01:16:29 AM »
What i'm doing is this in pictures. Trying Protected T or F, trying to play with ExcecTimeOut with no success. Seems that every messages are absorbed from controller and only first or last are visibles. If it's so i think is a very bad limit for plu+1 controllers.

this is what's in the POU (a very easy test) :

FUNCTION_BLOCK GGA_Decoder
VAR_INPUT
  Data : ARRAY[0..7] OF USINT;
  Length : USINT;
END_VAR
VAR_OUTPUT
  Arr0 : ARRAY[0..7] OF USINT := [0, 0, 0, 0, 0, 0, 0, 0];
  Arr1 : ARRAY[0..7] OF USINT := [0, 0, 0, 0, 0, 0, 0, 0];
  Arr2 : ARRAY[0..7] OF USINT := [0, 0, 0, 0, 0, 0, 0, 0];
  Arr3 : ARRAY[0..7] OF USINT := [0, 0, 0, 0, 0, 0, 0, 0];
  Arr4 : ARRAY[0..7] OF USINT := [0, 0, 0, 0, 0, 0, 0, 0];
  Arr5 : ARRAY[0..7] OF USINT := [0, 0, 0, 0, 0, 0, 0, 0];
  Arr6 : ARRAY[0..7] OF USINT := [0, 0, 0, 0, 0, 0, 0, 0];
END_VAR
VAR
  Index : USINT;
END_VAR

// Extract Identifier
Index := Data[0];

CASE Index OF
  160, 192, 32, 0, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240:
    Arr0 := Data;
  161, 193, 33, 1, 65, 81, 97, 113, 129, 145, 161, 177, 193, 209, 225, 241:
    Arr1 := Data;
  162, 194, 34, 2, 66, 82, 98, 114, 130, 146, 162, 178, 194, 210, 226, 242:
    Arr2 := Data;
  163, 195, 35, 3, 67, 83, 99, 115, 131, 147, 163, 179, 195, 211, 227, 243:
    Arr3 := Data;
  164, 196, 36, 4, 68, 84, 100, 116, 132, 148, 164, 180, 196, 212, 228, 244:
    Arr4 := Data;
  165, 197, 37, 5, 69, 85, 101, 117, 133, 149, 165, 181, 197, 213, 229, 245:
    Arr5 := Data;
  166, 198, 38, 6, 70, 86, 102, 118, 134, 150, 166, 182, 198, 214, 230, 246:
    Arr6 := Data;
 
END_CASE

in the recent past I struggled badly with Danfoss displays trying to acceptably capture an NMEA string on RS232,but ExcTimeout always effect the result, now we can't get the positioning data correctly read even on Can.
Once again I'm afraid we should change Hardware. But in 2023, almost 2024, with many blocks for Autonomous Guide developed, at least something to manage the data of a standard GNSS would have expected. It's a real shame, because the displays and controllers are
very good.
19
Controllers / Re: Read multiple Can messages same ID
« Last post by F.M.Elettromeccanica on September 18, 2023, 06:06:44 PM »
Thanks for your reply FluidPowerTom.
So youbmean to connect to a POU inputbus, the Array [8] U8 fron CanRx block? I'm just trying to do this,but seems that only first or last packet sent from my the device is cought in MC controller. Basically yes,i have to built an Array larger than 8. If uou will back with an example i'll can see where i'm doing it wrong
Thanks in advance
20
Controllers / Re: Read multiple Can messages same ID
« Last post by FluidPowerTom on September 18, 2023, 05:14:08 PM »
I'd definitely use a ST POU for that.  The output from the CAN Rx is an array which you could use as an input variable to your POU.  It'd probably take me 20-30 min to type out some code that'd do this though.  Array operations, while nowhere near as powerful as with MATLAB, are still pretty sufficient in ST.
Pages: 1 [2] 3 4 ... 10