Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

8051 assembly question, 16 bit division asm for 80c51

Status
Not open for further replies.

zohaib

Member level 4
Joined
Aug 24, 2007
Messages
75
Helped
2
Reputation
4
Reaction score
1
Trophy points
1,288
Location
PAKISTAN
Activity points
1,729
16 bit division asm for 80c51

hello forum!
i want to convert the data i am getting from adc ic into voltage .if the data reaches ff it means we have 5v and so on.so the formula should be (adc_data*5)/ff how to write the code in assembly i can do it in c and bascom but i need to do it in assembly please help
 

Re: 8051 assembly question

Create a look-up-table and use the MOVC A, @A+DPTR instruction ..
Here is an example:
**broken link removed**

Rgds,
IanP
 

Re: 8051 assembly question

u can calculate it, i guess ur using 8-bit adc with Vref+ as 5v and Vref- as 0v
so the step size is approx 20mv,
use two ram location say voltage_msb and voltage_lsb, where the voltage is stored in milli volts in BCD format. decrement the adc reading by 1 and add 20 to it keep repeating this loop till the adc reading becomes 0.
This method is much simpler are less tedious than making a lookup table

check :
https://www.dnatechindia.com/index.php/Code-Library/
for sample 8051 codes
 

8051 assembly question

You can place the ADC_DATA in a ACC and the number (05h) in (B) register and use the multiply instruction (mul a,b) for multiplication and after the execution of this instruction you get the result in accumulator. and for division move the number (#0ffh) in (B) register and use (div a,b). if your result of multiplication is greater then 8 bits then your result will be placed in A and B registers and you should take care of it. you should handle the 16 bit division in 2 steps. like divide the number by 2,4 to bring it in the range of 8 bits. by shifting right and divide them in 2 or 4 steps.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top