From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

The Daily CLAD

Community Browser
cancel
Showing results for 
Search instead for 
Did you mean: 

Re: CLAD2017 - Fundamentals - Can you carry me?

SercoSteveB
Active Participant

Assuming Numeric Value In is set to 1.  Which of the following VIs results in Numeric Value Out = 1?

 

NOTE:  More than one answer may apply.

 

a)

Rotate 1.png

b)

Rotate 2.png

c)

Rotate 3.png

d)

Rotate 4.png

Comments
crossrulz
Knight of NI

A, C


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Bcortes
NI Employee (retired)

The right answers are A and C, and here is the explanation of every case:Daily CLAD 11 Feb 2018 (2).pngDaily CLAD 11 Feb 2018.png

AUlikyan_ANEL
Member

A,C

SPK91
Member

A & C

A.Bernau
Member

A & C

 

(Rotate Left With Carry Function - http://zone.ni.com/reference/en-XX/help/371361P-01/glang/rotate_left_with_carry/)

 

(Default Value for Boolean is False http://zone.ni.com/reference/en-XX/help/371361P-01/lvconcepts/block_diagram_objects/)

 

In the given answers the shift register only can hold the 1 for the Output.

Baltur
Member

A & C

B is wrong because carry input always false

D is wrong and to make it work correct you would have to reverse the array. (Number to boolean array function makes the least significant bit of the input the first (0th) element of the output.)

Matt-A.
Member

A,C

Ellie90
Member

AC

mini09
Active Participant

Agreed A & C

Priya16
Member

A & C

 

Lysandros
Member

At the 7th iteration, in the carry left case, isn't the left most entry 1  (of 1 0 0 0 0 0 0 0) supposed to turn the boolean to True, since the msb carry out is the former high-order bit of value?

So in this case, when moving to the 8th iteration the boolean should be positive, or am I wrong? And if the boolean is positive, the new low-order bit should get the value 1, so the number is now: 0 0 0 0 0 0 0 1...

Thanks for any help on that.

 


crossrulz
Knight of NI

Lysandros, which version of the code are you referencing?

 


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Lysandros
Member

Hi crossrulz,

In the comment of "Bcortes" from the 2-11-2018, in the yellow "Rotate left with carry" case. At entry value 7), so the 7th iteration, the Value is 1000000, but Carry Out is zero...



crossrulz
Knight of NI

Yes, the Carry Out should be 0.  What was in the MSb goes into the Carry Out.  So going into the 7th iteration, you have 0b01000000.  After the 7th iteration, you have 0b100000000 and 0 in the carry.  After the 8th iteration, you have 0b00000000 and the carry is 1.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
rak84
Member

A&C

istan0227
Member

AC