digital electronics design

Donald wrote:
Sylvain Munaut wrote:

srinivasa.rangan@gmail.com wrote:

If the ouptut is obtained by around 500ms it is good enough.I dont want
to use a microcontroller or anything because i feel that it would be an
overkill.Also the quotient is good enough for me.


Overkill ? Come-on, a division is not 'that' simple (compared to an AND
snip
I don't know any chip that do the division and building one from other
chips, _that_ is overkill.


I think the OP wants an off-the-shelf (OTS) solution.

Any kind of micro will require software programming and hardware
programming, then it can be wired into his circuit.

Unless anyone here has this device already programmed with docs and
application notes to wire it up and maybe a demo board in their back
pocket......

It's clear that Srinivasa is a beginner.

So the long answer is "No" its not available OTS, but it can easily be
done if you are willing to learn a little and so some home work.

If Srinivasa is willing to learn, this is a good news group to ask
questions about getting your ideas and projects working.

I am sure many here have already did a napkin design on how they would
do it. ( I too have penciled out my own design I used and ATMega 32 :) )

Good Luck Srinivasa , I hope you success with your project.

Donald
I have implemented this fuction for an ohmmeter, which must do a divide
(R=E/I), since it can only measure voltage and current. Here is the
source for an Atmel processor. Use a fixed width font, tab space = 6 to
view.

This function divides two 32-bit numbers using an 8-bit AVR processor.
you will also need fuctions to store 4-registers to memory, and recall
them, e.g. SQ_2_mem() and LoadSQ()

Frank Raffaeli
http://www.aomwireless.com/

;************************************************************************
;*
;* Ratio -
;* Divides const in Temp[] (dividend) by variable in SQ[] (divisor)
;* DD = dividend, VR = divisor, RM = remainder. SQ[] (divisor) stored
in
;* SRAM and recalled as needed. SQ[] is then used as initial dividend.
;* result is shifted into the dividend SQ[], which returns final
answer.
;*
;************************************************************************

Ratio:
cbr Status, (1<<ACC_Ready) ; clear acc ready flag

tst SQ2 ; see if SQ2 is zero
brne init_dividend ; if not, its big enough
ldi EE_Addr, low(MinDivisor) ; lo byte of min divisor
cp SQ0, EE_Addr ; check low byte divisor
ldi EE_Addr, high(MinDivisor) ; hi byte of min divisor
cpc SQ1, EE_Addr ; carry compare to hi byte
brsh init_dividend ; if big enough, init
ser EE_Addr ; load constant 0xFF
mov SQ0, EE_Addr ; max it out - div by zero
mov SQ1, EE_Addr ; max it out - div by zero
rjmp ExitRatio ; bug out in disgrace

init_dividend:
lds Temp0, ohms_scale ; initi low byte 32-bit DD
lds Temp1, ohms_scale+1 ; init 2nd byte 32-bit DD
lds Temp2, ohms_scale+2 ; init 3rd byte 32-bit DD
lds Temp3, ohms_scale+3 ; init 4th byte 32-bit DD

; alternate entry point for arbitrary dividend

RatioMoose:
ldi XL, low(mem1) ; pointer low byte mem1
ldi XH, high(mem1) ; pointer high byte mem1
rcall SQ_2_Mem ; SQ[] (input) -> mem1

movw SQ0, Temp0 ; low word DD -> SQ[]
movw SQ2, Temp2 ; hi word DD -> SQ[]

clr Temp0 ; Temp[] -> lo byte RM = 0
clr Temp1 ; Temp[] -> 2nd byte RM = 0
clr Temp2 ; Temp[] -> 2nd byte RM = 0
sub Temp3, Temp3 ; 4th byte: RM=0 & clr carry

ldi EE_Addr, 33 ; use of EE_Addr as counter

divide_loop1:

rol SQ0 ; shift dividend left
rol SQ1 ; carry -> byte 2 dividend
rol SQ2 ; carry -> byte 3 dividend
rol SQ3 ; carry -> byte 4 dividend

dec EE_Addr ; decrement counter
breq ExitRatio ; bug out at end count

rol Temp0 ; shift dividend into remainder
rol Temp1 ; shift RM byte 2
rol Temp2 ; shift RM byte 3
rol Temp3 ; shift RM byte 4

ldi XL, low(mem2) ; load pointer low byte mem2
ldi XH, high(mem2) ; load pointer high byte mem2
rcall SQ_2_Mem ; SQ[] (DD/result) -> mem2

ldi XL, low(mem1) ; load pointer low byte mem1
ldi XH, high(mem1) ; load pointer high byte mem1
rcall LoadSQ ; divisor from mem1 -> SQ[]

sub Temp0, SQ0 ; RM = RM - VR (low byte)
sbc Temp1, SQ1 ; RM = RM - VR (carry)
sbc Temp2, SQ2 ; RM = RM - VR (carry)
sbc Temp3, SQ3 ; RM = RM - VR (carry)
brcs add_back ; if carry, add back to RM

ldi XL, low(mem2) ; load pointer low byte mem2
ldi XH, high(mem2) ; load ptr high byte mem2
rcall LoadSQ ; DD/result: mem2 -> SQ[]
sec ; set carry, '1' into DD
rjmp divide_loop1

add_back:
add Temp0, SQ0 ; RM = RM + VR (restore)
adc Temp1, SQ1 ; RM = RM + VR (carry 2nd)
adc Temp2, SQ2 ; RM = RM + VR (carry 3rd)
adc Temp3, SQ3 ; RM = RM + VR (carry 4th)

ldi XL, low(mem2) ; load pointer low byte mem2
ldi XH, high(mem2) ; load pointer high byte mem2
rcall LoadSQ ; DD/result: mem2 -> SQ[]
clc ; clear carry, '0' into DD

rjmp divide_loop1 ; back to start

ExitRatio:
rcall RatioFilter ; smooth the data in SQ[]
sbr Status, (1<<DataReady) ; data ready
ret
 
Frank Raffaeli wrote:

Donald wrote:

Sylvain Munaut wrote:


srinivasa.rangan@gmail.com wrote:
Hey Srinivasa are you still around ??

Have you made any decisions about your design ???

Donald
 
On Sun, 21 Aug 2005 06:38:55 +0100, Pooh Bear wrote:

Spehro Pefhany wrote:

On 20 Aug 2005 16:26:21 -0700, the renowned Winfield Hill
Winfield_member@newsguy.com> wrote:

Pooh Bear wrote...

srinivasa.rangan@gmail.com wrote:

I need to divide two 10 bit numbers.I would like to know if any kind
of chip is readily available or what would be the best circuit for
implementing this(A circuit for a higher number of bits like 16 will
also do).Any help in this regard would be appreciated.

The best 'circuit' to do this involves a microprocessor.

Two 16-bit D-A converters, a precision analog multiplier, wired as a
divider, plus a 12-bit A-D, with 10-bit truncation. Superior. :>)

Two M27C801s. Quotient in <100ns for 11.50 in single quantity.

That's a look-up table and a half for sure !

A look-up table and a quarter. ;-) It only uses 2/8 bits of the second
one, after all. Also, you'd need yet another if you want a remainder.

Cheers!
Rich
 
On Sun, 21 Aug 2005 09:11:13 GMT, Jonathan Kirwan
<jkirwan@easystreet.com> wrote:

On Sun, 21 Aug 2005 07:45:24 +0100, Pooh Bear
rabbitsfriendsandrelations@hotmail.com> wrote:

snip
Digikey is where I was looking, as I posted. I should have noted who
it was when I said 'they.' What surprised me about this particular
part is that they are asking less than 6 cents/IOpin. That's about
half of what I usually expect to see.

Ok - I see it. That's an awesome price. I'll have to investigate using Digikey
occasionally. Their site is rubbish compared to Farnell's though.

The Uk site gives Ł1.06 ea. Nice.

Now if I could find some other stuff to make the shipping worthwhile.....

Graham

I just pulled the data sheet from Atmel. The oscillator was listed at
Digikey as being "Oscillator Type: Internal." See:

http://www.digikey.com/scripts/DkSearch/dksus.dll?Detail?Ref=364926&Row=255354&Site=US

However, a quick skim and I now think the data sheet disagrees with
Digikey. It looks like it needs a crystal. I should have guessed.

Well, that adds some cost and a part and there goes the 6 cents/IOpin.

Jon
If you need a inaccurate clock, use Linear Technology's resistor set
oscillators (e.g. LTC6905).

---
Mark
 
On Mon, 22 Aug 2005 19:32:40 GMT, the renowned Rich Grise
<richgrise@example.net> wrote:

On Sun, 21 Aug 2005 06:38:55 +0100, Pooh Bear wrote:

Spehro Pefhany wrote:

On 20 Aug 2005 16:26:21 -0700, the renowned Winfield Hill
Winfield_member@newsguy.com> wrote:

Pooh Bear wrote...

srinivasa.rangan@gmail.com wrote:

I need to divide two 10 bit numbers.I would like to know if any kind
of chip is readily available or what would be the best circuit for
implementing this(A circuit for a higher number of bits like 16 will
also do).Any help in this regard would be appreciated.

The best 'circuit' to do this involves a microprocessor.

Two 16-bit D-A converters, a precision analog multiplier, wired as a
divider, plus a 12-bit A-D, with 10-bit truncation. Superior. :>)

Two M27C801s. Quotient in <100ns for 11.50 in single quantity.

That's a look-up table and a half for sure !

A look-up table and a quarter. ;-) It only uses 2/8 bits of the second
one, after all. Also, you'd need yet another if you want a remainder.

Cheers!
Rich
You can stick a radix point (say) after the 10 bits and use the last 6
bits for fractional results.

Often keeping *just* the fractional part is more useful than the
typical HLL integer math approach of just keeping the integer partand
truncating the fractional bit. That, of course, constrains the
denominator to be > the numerator, which is easily achieved by
prescaling (and may occur naturally anyway).

For example, if you have an ADC and measure the results of an unknown
X and a reference R (each 10 bits), and want the ratio, you most
likely don't want integer math y = X/R, because if X < R, it will
always be 0. Fractional fixed-point math is what you want.

If you're using standard data types in something like C, you'd have
to do something like...

y = (x << 10)/y

....in 32-bit unsigned math to get a useful 10-bit unsigned result.


Best regards,
Spehro Pefhany
--
"it's the network..." "The Journey is the reward"
speff@interlog.com Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog Info for designers: http://www.speff.com
 

Welcome to EDABoard.com

Sponsor

Back
Top