1. What is difference between RS232 and RS485?
Ans. RS232 is full duplex and
RS485 is half duplex. RS232 has RX,TX and GND lines and RS485 has D+ and D-
lines for communication. RS232 is used for short distance(15m) and RS485 is
used for long distance(1200m). Voltage levels for RS232 is +3V to +15V(logic 0)
and -3V to -15V(logic 1).Voltage levels for RS485 is -7V to +12V(difference in
two signals is greater than 0.2V then logic1 otherwise logic 0).
2. What is difference between I2C and SPI ?
Ans. I2C is two wire protocol(SDA and SCL). SPI is
4 wire protocol (SS,MISO,MOSI,SCK).I2C is half duplex and SPI is full
duplex.I2C supports Clock Stretching and SPI does not.Clock stretching is used
to slow down speed by holding SCL low.I2C is multimaster communication while
SPI is not.I2C is slower(100kbps,400kbps and 3.4Mbps) and SPI is
faster(10Mbps). I2C requires more power and SPI requires less power.I2C uses
addressing mechanism and SPI uses chip select mechanism.
3. What does static keyword used for?
Ans. Static variables have
property of preserving their value after they are out of their scope.They is
initialized only once and exist till termination of program. Static variables
are allocated memory in data segment not in stack segment. Static variables
should not declared inside structure. The reason is C Compiler required entire
structure elements to be placed together because memory allocation for
structure should be contiguous.
4. What does volatile is in C?
Ans. Volatile is qualifier used for omitting
variable from optimization.It tells compiler that variable may change at any
time during execution.
5. What are storage classes in C and explain?
Ans. Auto, Static, Extern,
register.


No comments:
Post a Comment