Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Problem in making assembly code

Status
Not open for further replies.

ahsanbilal

New Member
I am taking inputs from six flex bend sensors one by one using multiplexer selection pins then convert them into digital form using ADC 0820 and store them in register available in microcontroller 89c51.Now what i want to ask is i want to run subroutines depending on the sensors value i am in a confusion as how to compare all the six values at a time and output the result on the concerned port....can anyone please help me in this?
 
The multiplexer, probably a '4051 type chip, has input select lines. Use them and read one value at a time.
 
yes its 4051 i able to read the inputs but the problem is coming in how to compare all the signals at the same time and take decission like
org 00h
main:
lcall delaytensec
data_collection:
clr 2.0 //S2 //mux selection pins
clr 2.1 //s1
clr 2.2 //s0
mov A,p1 //sensor 1 data from Multiplex
mov R0,A // sensor 1 data stored in R0
clr 2.0
clr 2.1
setb 2.2
mov A,p1 //sensor 2 data from Multiplex
mov R1,A // sensor 2 data stored in R1
clr 2.0
setb 2.1
clr 2.2
mov A,p1 //sensor 3 data from Multiplex
mov R2,A // sensor 3 data stored in R2
clr 2.0
setb 2.1
setb 2.2
mov A,p1 //sensor 4 data from Multiplex
mov R7,A // sensor 4 data stored in R7
setb 2.0
clr 2.1
clr 2.2
mov A,p1 //sensor 5 data from Multiplex
mov R5,A // sensor 5 data stored in R7
setb 2.0
clr 2.1
setb 2.2
mov A,p1 //sensor 6 data from Multiplex
mov R4,A // sensor 6 data stored in R4
jmp voices


delaytensec:
mov r3,#10
z1:
mov r2,#10
y1:
mov r1,#200
x1:
mov r0,#250
djnz r0,$
djnz r1,x1
djnz r2,y1
djnz r3,z1
ret

Now i have all the values in the register voices will be the subroutines of sound...now i want if 1st sensor value is 125(decimel) second sensor 85 third sensor 100 etc then 1001 should be output to the port 0 pins but i dont know how to make a range
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top