From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

case structure always running default case

I am writing one code in which i have to display digital values for the data present in read buffer, what is happening is i am having one write buffer in ehich i am loading one file data and the data i am getting in read buffer is from controller which comes after programming, in read buffer first index will always be0x0000 so e.g in write buffer we have some data at 2 index thedata for the same channel would be present in reads buffer at 3 index means n+1 index, i am using write buffer to detect the channels and read to detect the data for every corresponding channel but what problem i am facing is my code is detecting channel properly and detetcing data also but to convert every data to digital value i am using case structure for every different data values but instead of running as per data values it is running default case alwyas.

 

below i am attaching he png image and my code also.

0 Kudos
Message 1 of 5
(3,226 Views)

@Ritu wrote:

i am using case structure for every different data values but instead of running as per data values it is running default case alwyas.


The case structure is not always executing the default state but only for those 'case selector values', there is no state is defined, I modified your code to capture whether for a particular 'case selector values', state is defined/available or not. Below is the list.

 

Spoiler

0x15
0x16_NotAvailable
0x17_NotAvailable
0x18_NotAvailable
0x19_NotAvailable
0x1A
0x1B
0x1C
0x1D_NotAvailable
0x1E_NotAvailable
0x1F_NotAvailable
0x20_NotAvailable
0x21_NotAvailable
0x22_NotAvailable
0x23_NotAvailable
0x24_NotAvailable
0x25_NotAvailable
0x26_NotAvailable
0x01
0x02
0x03
0x05
0x07_NotAvailable
0x08_NotAvailable
0x04
0x06
0x08_NotAvailable
0x09_NotAvailable
0x0B
0x0D
0x0A_NotAvailable
0x0C
0x0E
0x0F
0x10
0x11
0x12
0x13
0x14
0x00
0x80
0x81
0x82
0x83
0x84
0x85
0x86
0x87_NotAvailable
0x88_NotAvailable
0x89
0x8A
0x8B
0x8C
0x8D
0x8E
0x8F
0x07_NotAvailable
0x08_NotAvailable
0x90
0x91
0x92
0x93
0x94
0x95
0x96_NotAvailable
0x97_NotAvailable
0x98_NotAvailable
0x99_NotAvailable
0x9A
0x9B
0x9C
0x9D_NotAvailable
0x9E_NotAvailable
0x9F_NotAvailable
0xA0_NotAvailable
0xA1_NotAvailable
0xA2_NotAvailable
0xA3_NotAvailable
0xA4_NotAvailable
0xA5_NotAvailable
0xA6_NotAvailable
0xA7_NotAvailable
0x07_NotAvailable
0x08_NotAvailable
0xA8_NotAvailable
0xA9_NotAvailable
0xAA_NotAvailable
0xAB_NotAvailable
0xAC_NotAvailable
0xAD_NotAvailable
0xAE_NotAvailable
0xAF_NotAvailable
0xB0_NotAvailable
0xB1_NotAvailable
0xB2_NotAvailable
0xB3_NotAvailable
0xB4_NotAvailable
0xB5_NotAvailable
0xB6_NotAvailable
0xB7_NotAvailable
0xB8_NotAvailable
0xB9_NotAvailable
0xBA_NotAvailable
0xBB_NotAvailable
0xBC_NotAvailable
0xBD_NotAvailable
0xBE_NotAvailable
0xBF_NotAvailable
0xC0_NotAvailable
0xC1
0xC2
0xC3_NotAvailable
0xC4_NotAvailable
0xC5
0xC6
0xC7_NotAvailable
0xC8_NotAvailable
0xC9_NotAvailable
0xCA_NotAvailable
0xCB_NotAvailable
0xCC_NotAvailable
0xCD_NotAvailable
0xCE_NotAvailable
0xCF_NotAvailable
0xD0_NotAvailable
0xD1_NotAvailable
0xD2_NotAvailable
0xD3_NotAvailable
0xD4_NotAvailable
0xD5_NotAvailable
0xD6_NotAvailable
0xD7_NotAvailable
0xD8_NotAvailable
0xD9_NotAvailable
0x07_NotAvailable
0x08_NotAvailable
0xDA_NotAvailable
0xDB_NotAvailable
0xDC_NotAvailable
0xDD_NotAvailable
0xDE_NotAvailable
0xDF
0xE0_NotAvailable
0xE1_NotAvailable
0xE2_NotAvailable
0xE3_NotAvailable
0xE4_NotAvailable
0xE5_NotAvailable
0xE6_NotAvailable
0xE7_NotAvailable
0xE8_NotAvailable
0xE9_NotAvailable
0xEA_NotAvailable
0xEB_NotAvailable
0xEC_NotAvailable
0xED_NotAvailable
0xEE_NotAvailable
0xEF_NotAvailable
0xF0_NotAvailable
0xF1_NotAvailable
0xF2_NotAvailable
0xF3_NotAvailable
0xF4_NotAvailable
0xF5_NotAvailable
0xF6_NotAvailable
0xF7_NotAvailable
0xF8_NotAvailable
0xF9_NotAvailable
0xFA_NotAvailable
0xFB_NotAvailable
0xFC_NotAvailable
0xFD_NotAvailable
0xFE_NotAvailable
0xFF_NotAvailable
0x07_NotAvailable
0x08_NotAvailable

 

 


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


0 Kudos
Message 2 of 5
(3,209 Views)

Have you tried to change the display mode of the "match + rest of string" to '\' codes display ? This might reveal any 'invisible' characters.

 

I did... Smiley Wink ... and it seems that there is a space after every entry in the Read Buffer array Smiley Frustrated

Message 3 of 5
(3,207 Views)

moderator 1983 and pianne 

 

thanks for the reply

 

although i have found the solution by changing match+resttion to string subset, but i haven't got the problem why  match+ rest of string was not working, 

 

pianne

 when changing "\" codes display it is displaying \s character which is non white space character, but what is this non white space character, why it is coming.

 

moderator 1983

your code is fine but in case selector all the cases for different values that we can getcases are define, i have two case structures outer one for channel value and innerone for data values , first it checks for the channel in write buffer and than corresponding to that channel data is present in read buffer at n+1 index ( n= index of the channel in write buffer)

0 Kudos
Message 4 of 5
(3,198 Views)

The string in the Read Buffer array are actually 7 characters long, not 6 as you would think by looking at them; The last character is a space (shown as '\s').

 

The problem with the exrtra space is created when building the array, you'll have to figure out where it came from...

Message 5 of 5
(3,191 Views)