CAN Rx?

Discuss issues and ideas you have to configuring displays with PowerVision
drphil69
Posts: 139
Joined: Wed Mar 02, 2011 5:59 pm

CAN Rx?

Post by drphil69 » Tue Mar 04, 2014 4:54 pm

Hello,

Is there any way to know if a CAN message has been received on one of the CAN buses?

I would like to program the display to automatically recognize presence of a 2nd engine on the 2nd CAN bus. This bus will only be used if there is a second engine.

I think I can also look for a variable to remain invalid, just not sure how to implement that. If I were to use engine RPM for this purpose, what would be the result of "If Engine RPM > = 0...." If data is valid, value will always be >= 0, but if data is invalid would the IF be false? I've never used 'invalid' in this manner so I am not sure if it will work.

Any help is appreciated!

Regards,
Phil
BrianM
Posts: 8
Joined: Thu Sep 27, 2012 10:51 am

Re: CAN Rx?

Post by BrianM » Wed Jun 25, 2014 3:26 am

Hi,

Sorry I see you have had no replies but I have a similar request, I want to show if an item is connected to the CAN.

You can test for if it has been connected then goes “off-line” but that does not work if the item is already “off-line” when you power up the screen.

Did you find a solution? or can anybody help.

Regards, Brian
stalley
Enovation Controls Development
Enovation Controls Development
Posts: 618
Joined: Tue Mar 18, 2014 12:57 pm

Re: CAN Rx?

Post by stalley » Wed Jun 25, 2014 8:12 am

Hi!

The IsValid() will tell you when a parameter is being received by a display.

For example, if the expression,
IsValid(J1939_Engine_Engine_Speed)
is executed as a condition to fire an event, you would see that the event will only occur when the J1939_Engine_Engine_Speed parameter is received by the display and for the period of time set to wait for the parameter to go invalid (Look on the variable, the Invalidate After: setting, default is 5 seconds).

You would probably use a timer to execute the condition.

Checking for the speed to be a value greater than 0 along with the IsValid() test is a good way to see if the engine is running. For example,
AND(IsValid(J1939_Engine_Engine_Speed), J1939_Engine_Engine_Speed > 500)
is commonly used.

Thank you!
Sara Talley
Software Engineer
Enovation Controls
drphil69
Posts: 139
Joined: Wed Mar 02, 2011 5:59 pm

Re: CAN Rx?

Post by drphil69 » Thu Jun 26, 2014 12:25 pm

Hi Sara,

Thanks!

In your example with engine speed, if its > 500 RPM doesn't that mean the data is valid? Or does the display hold the last valid value?

Phil
stalley
Enovation Controls Development
Enovation Controls Development
Posts: 618
Joined: Tue Mar 18, 2014 12:57 pm

Re: CAN Rx?

Post by stalley » Thu Jun 26, 2014 12:46 pm

The variable holds the last data value. That's why the IsValid() is needed.
Sara Talley
Software Engineer
Enovation Controls
BrianM
Posts: 8
Joined: Thu Sep 27, 2012 10:51 am

Re: CAN Rx?

Post by BrianM » Fri Jun 27, 2014 5:46 am

Hi Many thanks for the reply

I am using Studio 2.6 and cant find a ref to IsValid()

What is the syntax

I want to use this in a script to see if a free form CAN message exists I am getting error messages

If (messageok)
{

}

Error-ERR : Expression must be of boolean type
Error-ERR : No matching signatures to 'IsValid(bool)

Regards Brian
Josh.b@ST
Posts: 18
Joined: Tue Dec 06, 2011 10:00 am

Re: CAN Rx?

Post by Josh.b@ST » Fri Jun 27, 2014 6:59 am

The IsValid is from a calculation event, to see if a variable is valid from a script, handle the return of smRead :)

It's not too clear in the documentation about this, but the scripting help file (in the PVCS) is good!

Josh