I am programming a PV780 and using a grayhill 3k switch that uses J1939 messages to let me know when buttons are pressed, I then need to send a response back to the switch to let it know that I want the switch to flash its LED via a custom J1939 message.
I am trying to work out the best way to program with this in PowerVision. I have created the J1939 message in the J1939 Parameter group with each key mapped to a parameter (there are up to 32 keys, each using 2 bits) which I can them map onto an event on chage, but I want to determine if there are multiple key presses and it seems a bit overkill to map 32 keys onto variables each raising a change request
So I though I could have manually handle the data and use a script to bit mask the received message and so, I looked at freeform CAN but this doesn't seem to allow for a variable greater than 32 bits, so, is there a standard way to handle a message where you want to look at multiple parameters at the same time?
Thanks
Multiple parameters in J1939 message
- andymartyn
- Posts: 25
- Joined: Wed Oct 29, 2014 4:51 am
- stalley
- Enovation Controls Development
- Posts: 618
- Joined: Tue Mar 18, 2014 12:57 pm
Re: Multiple parameters in J1939 message
Hello andymarteyn,
Well, I've got to say that being a former C programmer, I was all for the bitmask approach, but I was talking to some of the actual config developers and they say let PowerVision do some of that fiddly work for you.
They recommend using 32 parameters on the message, you can probably do it in the database. Each parameter gets it's own On Change event so you only process the parameters that actually change. Not as much scripting and not as much processing in the config.
Thanks for the question!
Well, I've got to say that being a former C programmer, I was all for the bitmask approach, but I was talking to some of the actual config developers and they say let PowerVision do some of that fiddly work for you.
They recommend using 32 parameters on the message, you can probably do it in the database. Each parameter gets it's own On Change event so you only process the parameters that actually change. Not as much scripting and not as much processing in the config.
Thanks for the question!
Sara Talley
Software Engineer
Enovation Controls
Software Engineer
Enovation Controls
- andymartyn
- Posts: 25
- Joined: Wed Oct 29, 2014 4:51 am
Re: Multiple parameters in J1939 message
Thanks for the reply
I appreciate I can use this approach and I have luckily only 8 button switches (3 off) so I can map each press to an event but this approach means that if I have multiple key presses, say 3, that I need to track I could get these 3 events in any order? So the question is knowing which of those 3 takes priority
Maybe there is some way to create a state machine that can handle these situations but not sure how best to do that. On buttons that are independent of the others it seems easy but on those that are dependent I am not sure the best approach without scripts. Perhaps being a C programmer colours my way of thinking here
I appreciate I can use this approach and I have luckily only 8 button switches (3 off) so I can map each press to an event but this approach means that if I have multiple key presses, say 3, that I need to track I could get these 3 events in any order? So the question is knowing which of those 3 takes priority
Maybe there is some way to create a state machine that can handle these situations but not sure how best to do that. On buttons that are independent of the others it seems easy but on those that are dependent I am not sure the best approach without scripts. Perhaps being a C programmer colours my way of thinking here