Sunday 21 August 2016

Bytewise and bitwise operation difference

Before we start Bytewise and bitwise operation we should know what is bit and Byte
1 Byte consists of 8 bits
              8 bit = 1Byte
              4 bit = 1 nibble


Bytewise operation

8085 microprocessor or some other microcontroller or microprocessor performs only bytewise operation . By Bytewise operation i mean , all 8 bits of 1 byte would get change no matter we want to change single bit.

For example: In 8085 microprocessor we have to perform either Oring or Anding of byte to change a particular bit.
Suppose in accumulator the value is 22h or 00100010b and if we want to reset (0) 5th bit we have to perform either Oring or Anding whole Byte.

On writing instruction
ANI dfh

following operation will perform

at accumulator:            00100010 b   = 22h
intermediate walue:      11011111 b   = DFh
result:                         00000010 b   = 02h

** b means binary
** h means hexadecimal
**anding
    0 and 0=0
    0 and 1=0
    1 and 0=0
    1 and 1=0


U might have seen the school benches. When the boy at middle wants to go the other corner boy also have to move.

Similarly if we want to change single bit we have to mask all 8 bits of 1 Byte.


Bitwise Operation

bit means either 1 or 0. In this type of operation we can set (1) or reset (1) a single bit. Now to set a particular bit we should know the address of that bit.
In some microcontroller like 8051 there is facility of bit addressable area where we could set or reset a particular bit. We don't need to mask whole Byte.

For example in 8051 microcontroller to set(1) a particular bit there is an instruction
SETB  bit

to reset
CLR bit


U might have seen the table which could fold. So now if middle student wants to move he could without disturbing his benchmates.


In bitwise operation single bit could change.

Thank u 4 vising my blog






Program to solve 4 variable equation(octave code)

function [x,y,z,alpha]=eq4variable( aaaa1,bbbb1,dddd1,eeee1,cccc1,aaaa2,bbbb2,dddd2,eeee2,cccc2,aaaa3,bbbb3,dddd3,eeee3,cccc3,aaaa4,bbbb4,d...