Ding Wang
Ding Wang

Reputation: 13

What is the main difference between byte addressable and bit addressable?

I'm learning 8051, and find it's hard to understand byte addressable and bit addressable.

a addressable SPF

Upvotes: 0

Views: 9427

Answers (2)

old_timer
old_timer

Reputation: 71536

They are not really using the terms right, byte addressable is what we are used to an address represents a unique byte in memory or the memory space. Bit addressable would mean that each bit in the memory space has a unique address, which is not the case. they are just showing you how to make some macros/variables that can access individual bits, is not an 8051 thing, but a generic programming thing and specifically implemented in C using variable types or keywords (or just macros) for their compiler.

What they are telling you is they have this sbit declaration which unless it is just a macro is clearly not a C standard declaration. But you can do the same things without. it is just bit manipulation that they are doing for you. Normally to set bit 5 you would do something like

variable |= (1<<5);  

to clear bit 5

variable&=~(1<<5);

and you can certainly make macros from that to make it more generic. What they have done for this compiler is allow you to declare a variable that is a single bit in some other variable and then that bit sized variable you can set to a one or zero.

Upvotes: 0

Ashish K
Ashish K

Reputation: 935

A type of hardware architecture that supports unique access to individual bytes of data.

For example, let us assume a number 0x1234 (0001001000110100). When storing the numbers on a system which is byte addressable, the first byte of the data (00010010) gets a unique address to the second byte (00110100), i.e each byte aligned in the memory will be uniquely addressable. You could manipulate the content only in chunks of 8bits.

However in case of micro-controller registers were data is stored, if you could manipulate its content bit by bit it’s called bit addressable.

Upvotes: 1

Related Questions