2. Assembly language----- includes mnemonics
Example: ADD, SUB, MUL, RR…
Assembly Language-----Assembler---Binary
Disadvantage:
We should know about architecture of microcontroller or
microcontroller
3. Higher level languages : c ,java
( c, c++,java)------compiler----binary
Advantage:
No need to consider about architecture of µp/µc….just
few features are considered
8. Syntax to be followed:
Pin declaration:
sbit variablename = PX ^Y;
Where,
x=0,1,2,3 port
y=0,1,2,3,4,5,6,7 pins
Example: sbit led = P1^0;
9. WAP to blink a led which is connected to port2 , pin 0
#include<reg52.h>
sbit led = P2^0;
unsigned int i;
void main()
{
P2=0x00;
led =1;
for(i=0; i<1000; i++);
led =0;
for(i=0; i<1000; i++);
}
10. Syntax to be followed:
port declaration:
#define variablename Px
Where,
x=0,1,2,3
Example: #define segment P1
11. WAP to blink all led’s connected to port2
#include<reg52.h>
#define leds P2
unsigned int i;
void main()
{
leds=0x00;
for(i=0; i<1000; i++);
leds =0xFF;
for(i=0; i<1000; i++);
}
13. PROGRAM 1:
WAP to blink a led which is connected to port1 , pin 0
PROGRAM 2:
WAP to blink the led’s which are connected to port1
PROGRAM 3:
WAP to blink the led’s alternatively which are
connected to port1
Practice examples
18. 8 data pins
3 control pins
supply pins and a potentiometer
1. Two modes
-----Command mode (RS=0)
-----Data mode (RS=1)
2. RW is always logic zero
3. EN=1 to EN=0 for data transfer
19. LCD INITIALIZATION Using commands
0X38 =========2 lines and 5x7 matrix
0x01 ========= clear the display
0x06 ========= shift cursor to right i.e. increment cursor
0x05 ========= shift display right
0x0E ========= display on, cursor blinking
0x80 ========= force cursor to beginning of first line
0xC0 ========= force cursor to beginning of first line
20. To pass command to lcd
8datapins = data
RS=0
RW=0
EN=1
Delay()
EN=0
To pass command to lcd
8datapins = data
RS=1
RW=0
EN=1
Delay()
EN=0