07-16-2012 04:46 PM
I am new to LabView....
Has anyone managed to get the CAN network work with the NI-XNET database to have the offset and scaling done all through the database instead of having do do everything by hand? I can't find any examples or VIs, although I keep seeing that everyone has the same general issue. The only response is that the API can't do it....ok...has anyone successfully done this and can share the VI?
Is there a way to feed in decimal (double) real world values and have a VI take the values and do the conversions necessary to make the can message with the scaling and offset that you put in the database using the NI-XNET API and LabView? How does this work when your message has the following format:
Sensor Reading 1: 2 bytes [unsigned 8]
Sensor Reading 2: 2 bytes
Sensor Reading 3: 2 bytes
Failure code 1: 5 bits
Failure code 2: 5 bits
Failure code 3: 5 bits
I am trying to put this message together and emulate a CAN message that would come from this sensor (has 3 different readings), and have this be generic enough to be ported to other kinds of sensors later. I can't get the database, which is already set-up, to have the scaling and offset applied or even get the correct format. The output I am expecting is a Hexadecimal output corresponding to the decimal values that I give it as input....
ie:
The initial input for the CAN message would be something like...
22.3 degC
25.9 degC
25.9 degC
2 (Failure Mode Indication)
so the data field message would read E824 5C25 5C25 FFFF
So the data length is 2 bytes. 0.03125 degC / bit scaling and -273 degC offset...
I can't get this to work with the API, and am hoping someone can point me in the right direction....
Thank you for any help in advance!
07-18-2012 08:20 AM
Hi estradjm,
I'm a little confused by your first paragraph. It originally sounded like you are trying to use the database editor to handle your scaling and offset, but then you asked if anyone has done the scaling and offset in a VI. Are you just trying to have the conversion from the frame to a real world signal handled behind the scenes, or am I missing something? You have the ability to create custom scales through the Database Editor that you can specify the scaling with. You may find some of the information from this white paper on FIBEX and the NI-XNET Database Editor useful as well.
If you open up the nixnet_example database, you can see under the CAN_Demo_Box cluster that you can specify this sort of scaling under the WAVEFORM0_SAW0_SWITHCES_FROM_CDB frame that each portion of the frame is broken up to represent different messages, and that each message in that frame has values associate with it. For example, Switch0 has to possible values, either 35 or 40 (real world signal) that is represented by a single bit. To do this, the signal properties are set accordingly.
I hope this helps.
07-27-2012 01:20 PM
I cannot open up the nixnet_example database, as there is something wrong with it on my computer, or we do not subscibe to the service. I don't know, but I have been looking into this with no success.
07-30-2012 10:13 AM
Hello AHHHHHHHG,
Are you having the same concern that estradjm is having? You mentioned in your most recent post that you can't open the nixnet_example database and that something is wrong with your computer. What exactly do you mean by "something is wrong with your computer"? Do you mean that for example perhaps one of the drivers or the examples was not installed properly, or something like the computer crashes? You should be able to access the example database through the editor. If you can't do that, you may want to verify that you do have NI-XNET installed. If you do have XNET installed, I would encourage you to do a repair on that driver. It sounds to me that you may have something wrong with your driver installation.
07-30-2012 01:50 PM
I have three 5 bit long signals that become two bytes when concatenated together. This is the portion that is not working still. Is this problem because LabView doesn't work below 8 bits inherently?
I want to give either 31 or 2, to represent a failure mode indicator. There are three of these, of which the user will be using three boolean buttons to indicate the status of the 3 sensors, respectively. ....3 buttons, one for each of the 3 sensor status'. Each status should be 5 bits long, and all three will be concatenated to create 16 bits. Parsed to create 2 U8s, which is seen over can as hexadecimal (4 alphanumerics total, 2 alphanumerics per byte).
I would like to have the API handle all the conversions, but I don't think that it is capable of handling data manipulation under 8 bits. Any ideas?
07-31-2012 12:12 PM
estradjm,
You can absolutely handle signals that are of different lengths. For example, I've attached two screen shots of the Database Editor with a frame configured to transmit every .1 seconds with a payload length of 2 bytes. In that frame, I have three different signals, each with a length of 5 bits. I've attached a screen shot of the Signal as well. You can set your scaling, ofset, maximum and minimum in this property screen as well. I hope this helps.
07-31-2012 12:57 PM
If you feed in the values for the signals, do you have to give the values in the same order as you labelled in the Database?
Do you feed in the value in bits, or will the truncation happen if you give a U8 signal?
07-31-2012 01:07 PM
Isn't the min and max for informational purposes only? Or does the API take and clamp at the values given regradless of the user's input in the VI?
08-01-2012 05:45 PM
estradjm,
Yes, you will need to pass the signals into the frame in the appropriate order. You do not have to pass this bit by bit, you can pass the actual signal. Also, you can go in and actually change the minimum and maximum values as well. Typically, the minimum is zero, but you could certainly set it to something different. Try it out. Also, feel free to take a look at the CAN Signal examples from your Example Finder. This should give you some clarification on what exactly is going on and how to use the Signal API. The example is based around an automotive system, but you can get an idea of how the signals get sent. I hope this helps.