Discussion:
How do you Bulid CAN Messages using MAX + Channel API
(too old to reply)
doogle
2008-05-29 10:40:05 UTC
Permalink
I'm trying to build messages for repeat transmission by the Channel API Write Function every 30ms.
 
In one message I have a constant byte(Constant), a byte that I want to autoincrement(Increment) each transmission, and three Motorola Longs(16 bit) i.e. hi-low(DataA,DataB,DataC)
I put the message into MAX.
 
What I did was to create 3 tasks:

- 1 to handle the autoincrement i.e called every 30ms

- 1 to put the constant in place - called once after init start

- 1 to update the DataA, B & C values when any one changes (event structure in Labview)

This doesn't seem to work as each access to specific channels seems to clear the other channels to zero rather than masking them out and preserving the data.
Is this how it is supposed to work or am I missing something?
 
DirkW
2008-05-29 20:10:09 UTC
Permalink
If I understand this correctly, you must have three different messages with 5 different channels?
And with your third message if you change the values for your three channels, two of your channels become reset to zero if you change a third channel?
Normaly if you have three channels in one message and you change only one channel value, the other two channels should still have the last value transmitted.
So i guess there is a problem with your coding. Could you post your code, thus i could have a look?
DirkW
doogle
2008-05-30 08:10:07 UTC
Permalink
All 5 channels are actually within the same message.
 
I attach the code and MAX configuration to illustrate what I wanted to do.
 


Channel Update Problem.zip:
http://forums.ni.com/attachments/ni/30/3499/1/Channel Update Problem.zip
DirkW
2008-05-30 14:40:10 UTC
Permalink
If you use the same message in a second task, the driver writes the channel default value for all uninitialized channels of this message.
In your case you have to use a single task, to write all channels with one write operation. See the attached simplified example.
DirkW


Trying to Update Channels in a message using more than one task (Simplified).vi:
http://forums.ni.com/attachments/ni/30/3500/1/Trying to Update Channels in a message using more than one task (Simplified).vi
Loading...