Pages

Program to convert ASCII to hex in 8051

ASCII codes 30 to 39 represent 0 to 9 in binary and 41 to 46 represent A to F. Therefore

if the ASCII code is between 30-39h then 30h is subtracted from the code. If the number
lies between A to F then 37h is subtracted from the code to get its binary equivalent
mov dptr, #9000h ;load dptr with address 9000h
movx a,@dptr ; move data from external memory location to a
clr c ;clear carry bit
mov r1,a ;move data from a to r1
subb a,#40h ;subtract 40h from a
jc l2 ;jump to location l2, if carry
mov a,r1 ;move data from r1 to a
subb a,#37h ;subtract with borrow, 37h from a
sjmp here ;jump to location here
l2:mov a,r1 ;move data from r1 to a
clr c ;clear carry bit
subb a,#30h ;subtract with borrow, 30h from a
here:inc dptr ;increment dptr
movx @dptr,a ;move data from a to external memory location
rep:sjmp rep
end

Program to add two BCD numbers in 8051

mov dptr,#9000h ;move dptr with 9000h

movx a,@dptr ; move data from external memory location to a
mov b,a ;move data from a to b
inc dptr ;increment dptr
movx a,@dptr ; move data from external memory location to a
add a,b ;add a and b
da a ;decimal adjust accumulator after addition
jc down ;if carry, jump to label down
inc dptr ;increment dptr
movx @dptr,a ;move data from a to external memory location
sjmp last ;jump to label last
down:mov r2,a ;move data from a to r2
mov a,#01h ;move data 01h to a
movx @dptr,a ;move data from a to external memory location
inc dptr ;increment dptr
mov a,r2 ;move data from r2 to a
movx @dptr,a ;move data from external memory location to a
last:sjmp last
end

Program to find the square of an 8 bit number in 8051

mov dptr,#9000h ;load dptr with 9000h

movx a,@dptr ;move data from external memory location to a
mov b,a ;move data from a to b
mul ab ;multiply and b
inc dptr ;increment dptr
mov r0,a ;move data from a to r0
mov a,b ;move data from b to a
movx @dptr,a ;move data from a to external memory location
inc dptr ;increment dptr
mov a,r0 ;move data from r0 to a
movx @dptr,a ;move data from a to external memory location
here:sjmp here
end

Program to count from 0-9 in 8051

here:mov a,#0h ;move 0 to a

up:mov p0,a ;move data from a to port0
acall delay ;call delay routine
add a,#01 ;increment a
cjne a,#010,up ;compare a with 10, if not equal, jump to location up
sjmp here ;jump to location here
;delay routine
delay:mov r1,#0ffh ;move 0ffh to r1
l3:mov r2,#0ffh ;move 0ffh to r2
l2:mov r3,#0ffh ;move 0ffh to r3
l1:djnz r1,l1 ;decrement r1, repeat till r1=0
djnz r3,l2 ;decrement r3,repeat l2 till r3=0
djnz r2,l3 ;decrement r2, repeat l3 till r2=0
ret ;return
end

Program to implement BCD counter to count from 0-99 in 8051

here:mov a,#0h ;move 0 to a

up:mov p0,a ;move data fr
acall delay ;call delay program
inc a ;increment a
da a ;decimal adjust accumulator after addition
cjne a,#100,up ;compare a with 100, if not equal, jump to location up
sjmp here ;jump to location here
delay routine
delay:mov r1,#0ffh ;move 0ffh to r1
l3:mov r2,#0ffh ;move 0ffh to r2
l2:mov r3,#0ffh ;move 0ffh to r3
l1:djnz r1,l1 ;decrement r1, repeat till r1=0
djnz r3,l2 ;decrement r3,repeat l2 till r3=0
djnz r2,l3 ;decrement r2, repeat l3 till r2=0
ret ;return
end

Automatic Room Light Controller

Project title is “AUTOMATIC ROOM LIGHT CONTROLLER WITH BIDIRECTIONAL VISITOR COUNTER “.

The objective of this project is to make a controller based model to count number of persons visiting particular room and accordingly light up the room. Here we can use sensor and can know present number of persons.
In today’s world, there is a continuous need for automatic appliances with the increase in standard of living, there is a sense of urgency for developing circuits that would ease the complexity of life.
Also if at all one wants to know the number of people present in room so as not to have congestion. This circuit proves to be helpful.
Circuit Diagram:1
image


Circuit Diagram: 2


Download Project 

Microcontroller Based Access Control system

Now a days, a problem of security is very much important everywhere   in the world. So, in large firms or companies, to make protect of entering of unauthorized person or to secure their important section, they generally use this type of security.     


vThis project, AN ACCESS CONTROL SYSTEM provides a facility of security. This type of security lock is generally attached at the main entrance door of the firms. By using this type of security, only authorized fellow can enter.

It is quite easy in installation and use. Through this, one can allocate more number of passwords to many fellows. It is easy to use as the fellow don’t need to carry any type of id card or chip etc.
Circuit Diagram:

image




Download Project 

Click on above links to download