02-26-2011 10:40 AM
Your string array consists of strings that are in hex display mode. The case structure has a string wired to it, but the case structure still only sees the the character that 0x88 represents, which is "X". However, the case is set up to respond to the characters "88". That's NOT the same as the number 0x88. Thus, regardless of which array element you give it, the "Default" case is the one that will run each time. If you want to specify case values as hexadecimal then you need to feed a numeric, not a string. The example that 10degree had given would have gotten you there. All you had to do was replace the Number to Decimal String function there with the Type Cast function. That's it.
02-26-2011 11:47 AM
i hope there is no problem with case structure because i saw when 88 writen to the port which get back the valu and i displayed in respective textbox. You mis understood my problem that always writing 88 and reading the same value but its not going ahead and not writing next 89. So i want to write always one by one command. not all at a time and not one.
thank you for your quick reply...
02-26-2011 11:52 AM
I understood your problem perfectly, and I can see it directly from the code. The issue is that you're not understanding us. Your string array is autoindexed. That means in each iteration it will write out the next byte. The problem is with how you are evaluating the case structure. Please re-read my response.
02-27-2011 09:03 AM
As Smerucio says, a string case cannot be set in hexadecimal mode, thus in loop #1 you're comparing 0x8D to 0x3344 ("8D"). You'll need to add a Decimal string to number to correct it.
/Y
02-28-2011 03:29 AM
Hi,
still the problem is not rectified even if i use decimal string to number or hex string to number. Always they interpret as zero whet ever the input coming in and also my loop that means everytime one command only running and default case is displaying the result.
02-28-2011 08:57 AM - edited 02-28-2011 08:57 AM
Please post your actual VI so we can determine how your display settings are set on your constants.
My guess is that the 88 string is set for hex display. That is the character ^ which can not be put into hex string to number since a carat has no meaning has a hexadecimal digit. Only 0-9,A-F have any meaning.
If you want to convert the hex character of 88 (^) to a number then you use typecase, but wire a U32 into the top and not a string.
02-28-2011 09:10 AM
Yes, i am using hexadecimal string and i don't why always default case is running. even i woul like to do first 88 command execute and 89 and so on one by one. but it always resulting only one one value for first command i.e. 88 and simply getting out of the for loop and even not coming out of the while loop. Vi is attached and using labview8.5.
02-28-2011 09:23 AM - edited 02-28-2011 09:23 AM
Type cast
But I see you have already been getting this advice here. serial communication without string

02-28-2011 09:36 AM
My bad, you need a Type Cast to U8. 🙂
/Y
02-28-2011 09:44 AM
everytime i am silly questions on you. I fell my self bad and though i can't go forward without your help because i am new to these virtual environment. However, before message about typecast, how i can chage datatype of type terminal to different methods now it is showing string for me. How i can draw like U32 there and i saw there is no options on right click.???