Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

What does 1 << ( twint) mean?

dl09

Full Member level 4
Joined
Feb 12, 2020
Messages
201
Helped
1
Reputation
2
Reaction score
1
Trophy points
18
Activity points
1,492
If I write 1 << (twint) on an arduino ide, does that set or clear the twi interrupt flag of the twi control register? I tried researching on the internet, I cannot find an answer.
 

srizbf

Advanced Member level 5
Joined
Apr 3, 2010
Messages
1,995
Helped
417
Reputation
840
Reaction score
328
Trophy points
1,363
Activity points
10,985
If I write 1 << (twint) on an arduino ide,
does that set or clear the twi interrupt flag
of the twi control register? I tried researching on the internet,
I cannot find an answer.
the operation clears bitno_0 of the register.
 

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
14,121
Helped
4,676
Reputation
9,366
Reaction score
4,414
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
120,664
Are you sure?
1 << (twint) shifts a '1' left by '(twint)' times, it creates a value but does it change the contents of a register?

Brian.
 

dl09

Full Member level 4
Joined
Feb 12, 2020
Messages
201
Helped
1
Reputation
2
Reaction score
1
Trophy points
18
Activity points
1,492
Are you sure?
1 << (twint) shifts a '1' left by '(twint)' times, it creates a value but does it change the contents of a register?

Brian.
Honestly I don't know what it does.
 

c_mitra

Advanced Member level 5
Joined
Nov 13, 2012
Messages
3,367
Helped
846
Reputation
1,692
Reaction score
797
Trophy points
1,393
Activity points
25,730
1 << (twint) shifts a '1' left by '(twint)' times, it creates a value but does it change the contents of a register?
You are right; it does nothing because the contents are not assigned a location. I think the result will be left into the accumulator and discarded.

You need an assignment statement: x=1<<2; (or something like that); it can also be part of another expression.
 

ZASto

Advanced Member level 2
Joined
Jan 9, 2008
Messages
690
Helped
140
Reputation
283
Reaction score
123
Trophy points
1,323
Location
Messy Corner, 44°47'31.56"N, 20°28'9.16"E
Activity points
4,610
Honestly I don't know what it does.
If you don't know, just click on Help -> Reference and, if you are lucky, you will find this page:

file:///home/zasto/arduino-1.8.12/reference/www.arduino.cc/en/Reference/Bitshift.html

Don't be shy to consult Help :D
 

c_mitra

Advanced Member level 5
Joined
Nov 13, 2012
Messages
3,367
Helped
846
Reputation
1,692
Reaction score
797
Trophy points
1,393
Activity points
25,730
Last edited:

Toggle Sidebar

Part and Inventory Search


Welcome to EDABoard.com

Sponsor

Sponsor

Design Fast


×
Top