BINARY CELL:
A binary cell is a memory allocation element that can store one bit of information(1 or 0).
We have Binary cell with logic '1' and logic '0'. A binary cell is referred as bit.
REGISTER:
1)name of the register.
2)number of binary cells in it.
Different types of Registers
DDR,PIN and PORT registers are frequently used in coding of an MC.
These registers are used to give instructions to the MC as of which pins are used as input/output pins.
1.DDR-Data Direction Register
→This register is used to tell us about which pins in a particular port are to be used as input pins and which pins are to be used as output pins.
→Setting a bit in the DDR register to logic 1 will makes the corresponding pin as output pin.→Setting a bit in the DDR register to logic 0 will make the corresponding pin an input pin.
Ex:1)DDRA=0b11110000
the above statement means that the first 4 pins of port A(PA0-PA3) are set as input pins and the last four(PA4-PA7) are set as output pins.
2.PIN Register
→This register is used for the ports that are configured as the input ports.
→The inputs at each pin of the input port are stored in this PIN register.
→Setting a bit as logic 1 in PIN register means that,that particular pin in that specified port has been used for input operation.
→Setting a bit to logic 0 means that,that particular pin in that specified port has not been used to give input.
Ex:1)PINA=0b11110000
the above statement means that first 4 pins are not used to give input and the other 4 have been used to give input.
3.PORT register
→This register is used for the ports that are configured as the output ports.
→The outputs at each pin of the port are stored in the PORT register.
→Setting a bit as logic 1 in this register means that,that particular pin in that specified port has been used to take the output.
→Setting a bit as logic 0 means that,that particular pin in that specified port has not been used to take the output.
Ex: 1)PORTA=0b11110000
The above statement means that first 4 pins have not been used to take output..but other pins have been used.
0 comments:
Post a Comment