sjukheter Posted April 6, 2011 Report Share Posted April 6, 2011 I have 5 signed bits which creating problems. I have to get the below values when i run the VI. it is not converting the five bits to signed. CAA6--------> 5.3v, DA80-----------> 20,C34D-------->3.3, E367........> 54.43v You can find some examples from page 74 to 89 in th egiven PPt. Can any one help me. pptpm.pdf Quote Link to comment
mbrowne Posted April 6, 2011 Report Share Posted April 6, 2011 The following should do the job .. The Boolen Array to Number nodes need to be setup correctly ... In the Properties (right click menu) set the Output Configuration to I16 And make sure the Sign Extension Mode is set to If Output is Signed (or Always will work here) Quote Link to comment
sjukheter Posted April 6, 2011 Author Report Share Posted April 6, 2011 Thank you for your suggestion. I already know this option but i am using labview 8.5 ,so, that option is not available in 8.5. Now, i am downloading latest verstion . MAy it will take some time to fix all. I have one doubt and will ask later about that. Quote Link to comment
mbrowne Posted April 6, 2011 Report Share Posted April 6, 2011 Here is a version that will work in LabVIEW 8.2+ Convert.vi Quote Link to comment
sjukheter Posted April 6, 2011 Author Report Share Posted April 6, 2011 (edited) the given solution also not working and I sloved my problem. I just changed my labview version. Thank a lot for your kind help. Can you help me in writing write visa. suppose let say, i want to write 3.3V to device to set. I have to convert that into Y=X.2(power of -N) , which gives into two bytes. You can see example in the given PPT (77th slide second model). Can you help me, how can i do that logic in labview. Edited April 6, 2011 by sjukheter Quote Link to comment
sjukheter Posted April 7, 2011 Author Report Share Posted April 7, 2011 I would like write two bytes of information to write visa. Two bytes consisting with 5 bits as signed (exponent) and remaining 11 bits are mantissa. I have done some coding but i need extend that to two bytes. you can find attched vi. At last i have to add those 5 bit and 11 bit to a two byte value. example, 3.3 is written input and output should be ---------> 1100001101001101----> here first fivets represents -8(always signed) and next 11 bits represents(845). One more doubt, Please say in one sentense. what is difference between 4.x typecast and normal type case. I read the help information and not understand any thing. i have done some coding and did not got the original output. writevalue.vi Quote Link to comment
mbrowne Posted April 7, 2011 Report Share Posted April 7, 2011 Here is how you can convert a voltage to the correct format and send it using visa write. No type casts needed. For what you are trying to do use the Number to Boolean Array I would like write two bytes of information to write visa. Two bytes consisting with 5 bits as signed (exponent) and remaining 11 bits are mantissa. I have done some coding but i need extend that to two bytes. you can find attched vi. At last i have to add those 5 bit and 11 bit to a two byte value. example, 3.3 is written input and output should be ---------> 1100001101001101----> here first fivets represents -8(always signed) and next 11 bits represents(845). One more doubt, Please say in one sentense. what is difference between 4.x typecast and normal type case. I read the help information and not understand any thing. i have done some coding and did not got the original output. Quote Link to comment
sjukheter Posted April 8, 2011 Author Report Share Posted April 8, 2011 Thank you so much for your help. I have two small doubts that how Reshape array subset appending five bits as MSB and 11 bits as next to that. I think according to the discription it will append the 5 bits as LSB. I am little confused, can you how and where it is adding. I don't know exactly when to use 4.x data and normal typecast converstion. can tell in exactly one sentence when to use and what id the difference. I have studied labview discription and not understand. Quote Link to comment
mbrowne Posted April 8, 2011 Report Share Posted April 8, 2011 That is the Replace Array Subset (not Reshape array), and from the help description it "Replaces (not appends) an element or subarray in an array at the point you specify in index." It our case it replaces a 5 bit subarray in an 16-bit array starting at index 11. It will replaces: Y[11] with N[0] Y[12] with N[1] Y[13] with N[2] Y[14] with N[3] Y[15] with N[4] So the resultant output array is {N[4],N[3],N[2],N[1],N[0],Y[10],Y[9],Y[8],Y[7],Y[6],Y[5],Y[4],Y[3],Y[2],Y[1],Y[0],} Probe the wire to see what data is on the inputs and output to see this working Again you are heading in the wrong direction using Type Cast conversion, use the Number to Boolean Array instead!! The Number to Boolean Array "Converts an integer number to a Boolean array" which is exactly what we need here, not a type conversion!! But the Type Cast help clearly states the difference between the 4.x data and normal typecast converstion is how boolean data is handled. "..... LabVIEW 4.x and earlier stores Boolean data in two bytes unless the data is in an array, in which case LabVIEW stores each Boolean element in a single bit. LabVIEW 5.0 and later stores Boolean values in a single byte, regardless of whether it is in an array. ....." Quote Link to comment
sjukheter Posted April 8, 2011 Author Report Share Posted April 8, 2011 Really, I am confused and i need to know how it is displaying the binary "1100001101001101" after replace array subset. Before your message i think that it will add the coming 5 bits after 11 bits. On that time, i don't have any answer my self that how it is displaying "1100001101001101" instead of "1011001011000011". I have seen with probe now and I saw the output as "1011001011000011" and not "1100001101001101". Then how i got the real output or am i get going in wrong way. Quote Link to comment
mbrowne Posted April 8, 2011 Report Share Posted April 8, 2011 The Word indicator whish I set to display numeric data in binary format, shows the binary data with MSB on the left down to the LSB to the right (as you would expected) ! Therefore it shows 1100001101001101 which is equivalent to C34D hex! When you probe an array, index 0 is on the left with the index increasing to the right. Therefore when you probe a boolean array the LSB will be shown on the left and the MSB on the right. This is why the probe of the boolean array is the reverse of what is shown in the Word indicator!! But they both represent the value C34D Hex. Really, I am confused and i need to know how it is displaying the binary "1100001101001101" after replace array subset. Before your message i think that it will add the coming 5 bits after 11 bits. On that time, i don't have any answer my self that how it is displaying "1100001101001101" instead of "1011001011000011". I have seen with probe now and I saw the output as "1011001011000011" and not "1100001101001101". Then how i got the real output or am i get going in wrong way. Quote Link to comment
sjukheter Posted April 8, 2011 Author Report Share Posted April 8, 2011 thank you somuch for brief explanation. I have one more problem with my event structure that contains 10 event cases. In that event cases are run according to the button press. I would like to run one of the case for every 10 mintus to update the data. is it possible to that with one event case. Quote Link to comment
mbrowne Posted April 8, 2011 Report Share Posted April 8, 2011 You can use the timeout event to run code every 10 minutes If no other events occur the timeout case will run every 10 minutes.. thank you somuch for brief explanation. I have one more problem with my event structure that contains 10 event cases. In that event cases are run according to the button press. I would like to run one of the case for every 10 mintus to update the data. is it possible to that with one event case. Quote Link to comment
sjukheter Posted April 8, 2011 Author Report Share Posted April 8, 2011 yes, I know that and problem is even i have to wait 10 min first time to see the results. Can i put any button in the timeout case like you can see immediatly or otherwise for every 10 minuts. Quote Link to comment
SteveChandler Posted April 8, 2011 Report Share Posted April 8, 2011 yes, I know that and problem is even i have to wait 10 min first time to see the results. Can i put any button in the timeout case like you can see immediatly or otherwise for every 10 minuts. An event case can handle multiple events. right click to edit events handled by this case. At the bottom left there is a blue + to add additional events. Another way to do it with two event cases if you are using the producer consumer is to simply have both cases send the same message to the consumer. Quote Link to comment
Rolf Kalbermatter Posted April 8, 2011 Report Share Posted April 8, 2011 What would be wrong with using Boolean logic (NOT, AND, OR) and ROTATE instead? There you have full control of signedness of numbers and that worked as far back as LabVIEW 2.x.And it's most likely magnitudes faster, since it can be all done inplace, translates typically directly into one or two assembly codes, and doesn't use variable size arrays at all. 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.