|
Prev: Announcing the LabVIEW 64-bit Pioneer Beta
Next: TDMS File Viewer limits, maximum rows in a table?
From: OnlyOne on 6 May 2008 05:10 Hello, i think i have an easy problem but i dont get the solution.What is want to do is a vi with this parameters:Input: current-value (U32)BitNumber (0..31)State (Bool)Output: new-value (U32)for example ifcurrent-value = 00000000 00000000 00000000 00000111 (binary)BitNumber = 2 (dez)State = FalseThen the new-value should be: 00000000 00000000 00000000 00000011 (binary)With same parameters and State = True the new-value is unchanged because ithe bit is already true.How do i do this?Thanks
From: MikeS81 on 6 May 2008 05:10 Hi OnlyOne, here is one solution for you. <img src="http://forums.ni.com/attachments/ni/170/321288/1/Unbenannt1.PNG"></a> MikeMessage Edited by MikeS81 on 05-06-2008 11:06 AM Unbenannt1.PNG: http://forums.ni.com/attachments/ni/170/321288/1/Unbenannt1.PNG
From: daveTW on 6 May 2008 05:40 Hi,this is a nice problem. Hope this helps<img src="http://forums.ni.com/attachments/ni/170/321291/1/set%20bit%20in%20U32.png"> greets, DaveP.S. Mike, it's hard to beat you :smileyvery-happy:Message Edited by daveTW on 05-06-2008 11:12 AM set bit in U32.png: http://forums.ni.com/attachments/ni/170/321291/1/set bit in U32.png set bit in U32.vi: http://forums.ni.com/attachments/ni/170/321291/2/set bit in U32.vi
From: Norbert B on 6 May 2008 05:40 daveTW wrote:P.S. Mike, it's hard to beat you :smileyvery-happy:But i will try it with a perharps more generic solution since you can mask more bits at a time:<img src="http://forums.ni.com/attachments/ni/170/321292/1/Numbermasking.JPG"> hope this helps,NorbertMessage Edited by Norbert B on 05-06-2008 04:18 AM Numbermasking.JPG: http://forums.ni.com/attachments/ni/170/321292/1/Numbermasking.JPG
From: OnlyOne on 6 May 2008 05:40 Hi Mike, thank you for your fast answer.I was always trying to solve it like Dave and didnt think about the way that you did it (which is much easier to understand).thx
|
Next
|
Last
Pages: 1 2 Prev: Announcing the LabVIEW 64-bit Pioneer Beta Next: TDMS File Viewer limits, maximum rows in a table? |