08-06-2015 03:25 PM
You should read the CANlib documentation which explains CanReadSpecific. Sounds like that is not the function you want, and CanReadSpecificSkip might be a better choice. You cannot run any of those functions standalone, because the device won't be open and configured; you need to use it in the context of a larger program, such as the CAN example. I don't know why it wouldn't accept the ID you entered, though - what text, exactly, did you enter?
If you read the documentation, you'll see that canSetAcceptanceFilter is basically the same as two calls to canAccept (one to set the mask, the other to set the code). The example code has those two calls to canAccept already (although in the version that I just downloaded, there's a broken wire going into each of them). So, if you fix that, you can set the ID filtering there.
Looking further into the CAN example, canRead does not return a string. It returns several separate values, one of which is the message ID. Another output is the data as an array of bytes. There's a separate function that grabs all those values and combines them into a string for a pretty display. For analyzing a CAN packet, you should use the raw data returned by the canRead, not the formatted string.
08-07-2015 07:32 AM
WOW thank you so much!! this guide was exactly what I needed! I dont know how in my hours of trying to google search this never came up Upon reading it does seem that I want can read specific skip! Thank you!
08-07-2015 07:53 AM
Any idea why the concatinate string has a red border in this VI that was uploaded?
@jpc335 wrote:
Here is my VI. Yes they are formatted as hexadecimal strings. I am just trying to get part of the programming done before I get to the testing site.
I was told by the manufacturer that the 3 bit hexadecimal string can then be converted into usable numbers. So if its faster/easier to replace the first byte with a 0 or turn it into a 3 bit hex string. Either will work.
Thank you for responding so fast I should have posted here yesterday haha. I haven't used LabVIEW for about 5 years and that was just basic stuff so I'm getting back into the swing of things.
08-07-2015 08:35 AM
08-07-2015 08:38 AM
Ah, I was confused becuase it was set, but disabled.
08-07-2015 02:26 PM
OK so hopefully this is my last hurdle. ive edited the KvCanExample to read only the designated channels and have isolated the part of the output string to use for my previous vi. Here is the issue, the output string outputs the hex values as a text string. This appears as 01 01 F0 98 C0 09 FC F1. These are the hex values I need in my program, however labview recognizes them as text. It is really an 8 byte string of hex values but labview does not recogize as such. I need to convert this to an 8 byte hex string wit the same characters and not the bytes for those characters. Any ideas?
08-07-2015 04:48 PM
Use Bob's code above and convert the byte array back to a string using "byte array to string".
08-07-2015 11:06 PM