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

How to test a single bit in Visual Basic?

Status
Not open for further replies.

neoaspilet11

Full Member level 5
Joined
Sep 29, 2005
Messages
277
Helped
29
Reputation
56
Reaction score
8
Trophy points
1,298
Location
Cebu, Philippines
Activity points
4,048
Hello Everybody,

Is there a simple way to access a single bit of a byte data type in VB?

Example: a = 90 = 0x5A

how to access bit 4 of a?

Thanks,

Jack
 

aslm

Full Member level 2
Joined
May 3, 2002
Messages
120
Helped
7
Reputation
14
Reaction score
2
Trophy points
1,298
Activity points
1,499
For Byte, Integer and Long datatypes the AND OR NOT operators apply as bit operators in VB.

a = &H01
b = &H02

a And b = &H00
a Or b = &H03

(a And b) = a -> False
(a And a) = a -> True

Then when it comes to the next part of bit manupulaiton, shifting, there is no simple way to do this. Devide and Multiply with powers of 2 works for bytes but when it comes to Integers and Longs then you get into problems with the sign bit and how that is used...

Real crap that they dont have a way of working with unsigned integer and long values and also a way to do shifting.

regards Me
 

Code Warrior

Full Member level 4
Joined
Dec 30, 2004
Messages
230
Helped
10
Reputation
20
Reaction score
2
Trophy points
1,298
Activity points
1,831
Hello,
I think this is the possible solution.
Bye
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top