08-11-2011 05:42 AM
I am reading data from inport in hex form and save it in array to compare data with 0100800000D0.. how can i make hex constant array to store 010080000D0... and then compare it with the array that store data from inport.. (Actually it works as check)
Or there is any other good option
Solved! Go to Solution.
08-11-2011 05:58 AM - edited 08-11-2011 05:59 AM
You don't need to make array to compare. You can directly compare data array with hex reference number it will give comparison answer in form of Boolean array.
08-12-2011 01:31 AM
Thanks parashant for your reply
08-12-2011 01:43 AM - edited 08-12-2011 01:49 AM
I am receving data in single byte like 00, 01 or 08.... But my check is 5byte thats why first i store my data in array and than want it to compare. On comparing if its true than i have to send data..
08-12-2011 03:32 AM
Can you send me your VI with comment so that I can understand the code functionality.
08-12-2011 04:06 PM
To create a hex constant array:
1. drop an array constant onto the block diagram
2. Add a numeric constant to the block diagram and drag it into the empty array constant
3. right click on the numric in the array and select representation. Select U8
4. right click on the numric in the array and select display format->hexadecimal
5. click on the edge of the array and drag it to expand it to the required size
you can then put the values you want to compare in it, and use the equals sign to compare. Right click the equals sign and select comparison mode-> 'compare aggregates'
Hope that helps,
Chris
08-13-2011 04:07 AM - edited 08-13-2011 04:08 AM
@InDo asia wrote:
I am receving data in single byte like 00, 01 or 08.... But my check is 5byte thats why first i store my data in array and than want it to compare. On comparing if its true than i have to send data..
Here's a quick draft (case 2 above) to get you some ideas. More code is needed to make a complete program, e.g. the inner loop will run forever if there is a problem. Not good.
08-15-2011 01:16 PM
Thanks Parashant, Chris and specially Altenbach
Sorry for late reply.. After my last mail I went on site.
I want to stream the data until 5 consective bytes match the pattern and the inner while loop is used to ensure data reading... So that what ever is send it must be read. The code is under work so thats why its like that and I am a new user.
I will reattach the subvi as soon as I reach back to office.. The missing vi is used to send data.. The string is converted to bytes=n and send by outport by n-1 formula using while loop i...
While(Bytes=n, i=0, i<=n-1)
{
outport data
}
The data is send on receving consecutive 5 same bytes.
08-17-2011 12:15 AM
Kindly download the attached files.....kindly suggest me a possible check for continous reading and then continous comparing with constant 5byte data
Thanks
08-17-2011 03:23 AM
Hi Timmy,
Check attached VI and give me feedback.
Prashant Patel