jillaye Posted January 4, 2008 Report Share Posted January 4, 2008 Hello, I would like to read a continuous serial stream consisting of 72 separate bytes of hex data. I think that I can sync on the first two bytes of each "set" of 72 bytes, as they are always "81 01". I have little experience decoding serial data and none of the examples included with LabVIEW cover continuously streaming data so any help will be appreciated. Thanks! Quote Link to comment
crelf Posted January 4, 2008 Report Share Posted January 4, 2008 QUOTE(jillaye @ Jan 4 2008, 06:06 AM) I would like to read a continuous serial stream consisting of 72 separate bytes of hex data... Please post the code you've tried so we can comment. Quote Link to comment
jillaye Posted January 5, 2008 Author Report Share Posted January 5, 2008 QUOTE(crelf @ Jan 3 2008, 04:55 PM) Please post the code you've tried so we can comment. Here it is:http://lavag.org/old_files/post-10350-1199483434.vi'>Download File:post-10350-1199483434.vi Quote Link to comment
crelf Posted January 6, 2008 Report Share Posted January 6, 2008 QUOTE(jillaye @ Jan 5 2008, 07:52 AM) Here it is... Sorry it's taken me a while to answer. First issue is that you're continuously adding to the string in the shift register - that keeps getting bigger and bigger, and all you're doing is looking at the first message in it, which will always be the same one: the first one. Also, you need to initialise the shift register - you're not gaurenteed what data is in there when you run it unless you explicitly tell it what to be in there: wire an empty string (it's a constant on the string palette that looks like "" in a box) to the left side of the shift register (outside the loop). As for formatting the read string to get the messages out, here's an example. It's not going to fit exactly into your code, but hopefully it will give you enough info to code something similar. Give it a go, but if you're still stuck, post again and I'll have another look for you. Quote Link to comment
jillaye Posted January 11, 2008 Author Report Share Posted January 11, 2008 QUOTE(crelf @ Jan 5 2008, 04:39 PM) Sorry it's taken me a while to answer. First issue is that you're continuously adding to the string in the shift register - that keeps getting bigger and bigger, and all you're doing is looking at the first message in it, which will always be the same one: the first one. Also, you need to initialise the shift register - you're not gaurenteed what data is in there when you run it unless you explicitly tell it what to be in there: wire an empty string (it's a constant on the string palette that looks like "" in a box) to the left side of the shift register (outside the loop).As for formatting the read string to get the messages out, here's an example. It's not going to fit exactly into your code, but hopefully it will give you enough info to code something similar. Give it a go, but if you're still stuck, post again and I'll have another look for you. Thanks crelf. The double "match pattern" is slick. It has turned out that the data that I will be receiving is not going to be a continuous stream; I will have to query with "0xC5 0x01 0x3A". If you get a chance, can you look this over and let me know what you think? Specifically, is the "scan from string" function that I used the most efficient way to go? Thanks.http://lavag.org/old_files/post-10350-1199995562.vi'>Download File:post-10350-1199995562.vi Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.