Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Other Forums > Chit-Chat


Chit-Chat Relax for a bit and have a general conversation (off topic is allowed!) with other members. Please be polite and respect your fellow members.

Reply
 
Tools
Old 26th May 2009, 11:10 PM   #31
Default

Well it is always good to know a little bit of everything, you never know that next job interview may require you to know AVR's even if you have been playing with FPGA's. But FPGA is next on my list
speakerguy79 is offline  
Old 27th May 2009, 12:56 AM   #32
Default

Psst.. OpenCores
Worth your time for opensource FPGA cores. They even have an AVR core in there somewhere. You could take that and tweak it to your hearts content =)

Just as a side note cause I'm an Atmel AVR pimp, give the FPSLIC series from Atmel a view, they're big blocks of FPGA material loved up with an AVR core for basic processing can make your own custom peripherals. Opencores is good, but the size for a dedicated chip is so much better than FPGA gate consumption putting the two together is just the perfect solution. Xilinx stuff is nice though free IDE and cheap kits.
__________________
"Because I be what I be. I would tell you what you want to know if I
could, mum, but I be a cat, and no cat anywhere ever gave anyone a
straight answer, har har."
Sceadwian is offline  
Old 27th May 2009, 06:23 AM   #33
Default

Yeah my brother gave me his old Spartan 3E development board, and I just downloaded the Xilinx ISE webpack. So I'll be using that as a starter system.
speakerguy79 is offline  
Old 30th May 2009, 12:10 AM   #34
Default

Quote:
Originally Posted by Nigel Goodwin View Post
Tables are incredibly fast, FAR faster than any maths you might be doing, I don't see any reason for a formula at all, which as you say, doesn't work anyway.
I don't see how using a lookup table will help that much.

Firstly I'm splitting the number up into the exponent and a mantissa (0 to 999) which requires a log and an exponential function.

Working out the nearest E24 value (this is corrected later on) only requires an extra multiplication which would be required to index a lookup table anyway.

Here's the fragment of code which does all of the above.

Code:
INPUT "Enter value"; value#
 
lgval# = LOG(value#) / lgb10' Take log10 of the value.
 
ex = INT(lgval#)' Exponent is the integer part of log 10 of the value.
 
dec#= lgval# - ex' store the decimal part of log10.
 
el = dec#* 24' Work out the nearest preferred number.
 
mnt = 10 ^ (2 + dec#)' get the mantissa.
 
ex = ex - 2' Preferred numbers in the array are multiplied by 100 so /100.
Do you know if there's a better way of getting the exponent and mantissa?

Quote:
Originally Posted by Nigel Goodwin View Post
Sorry, but I don't believe you - an interpreted BASIC doesn't run faster than a compiled language (it runs MUCH slower).

Are you perhaps referring to QuickBasic rather than QBasic?, as QuickBasic is a compiler.

As for potential speed differences, I would suggest it depends entirely on how the two programmes were written - particularly if you were doing complicated maths with them.
Yes compilers are much faster than interpreters.

I will eventually convert the program to FreeBASIC which is a compiler and runs on Windows and Linux. The program will probably still be text mode though.

I shall make it free under the LGPL so other people can use it as a library and hopefully write a GUI for it.
__________________

I do not answer private messages asking for help because no one else can: benefit from advice I may give or correct me if I'm wrong.

Please ask on the open forum if you have a question and I'll be happy to help,
if I know the answer.
Hero999 is offline  
Old 30th May 2009, 10:10 AM   #35
Default

Quote:
Originally Posted by Hero999 View Post
I don't see how using a lookup table will help that much.

Firstly I'm splitting the number up into the exponent and a mantissa (0 to 999) which requires a log and an exponential function.

Working out the nearest E24 value (this is corrected later on) only requires an extra multiplication which would be required to index a lookup table anyway.

Here's the fragment of code which does all of the above.

Code:
INPUT "Enter value"; value#
 
lgval# = LOG(value#) / lgb10' Take log10 of the value.
 
ex = INT(lgval#)' Exponent is the integer part of log 10 of the value.
 
dec#= lgval# - ex' store the decimal part of log10.
 
el = dec#* 24' Work out the nearest preferred number.
 
mnt = 10 ^ (2 + dec#)' get the mantissa.
 
ex = ex - 2' Preferred numbers in the array are multiplied by 100 so /100.
Do you know if there's a better way of getting the exponent and mantissa?
I don't even see any reason to want to do it?.

Like I said, I did it for E12 values, but the only difference would be in the size of the tables, and the number of iterations round the loop.

Input the value required:

Run a nested loop paralleling each value in turn with every other one, and comparing the result with that required.

Display the 3 most accurate results, complete with actual value and percentage error.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Old 30th May 2009, 05:01 PM   #36
Default

The input value could theoretically range from anything between 10mΩ to 100MΩ, a dynamic range of 10^9.

Without ensuring the values are within a known order of magnitude how can I ensure that the loop doesn't have to go through 10^9 iterations or have an lookup table 10^9 elements long?

I could have a loop which multiplies or divides the number until it's >0 <1000 but I'm not sure whether it would be faster than the log and exponential used to work out the mantissa and exponent.

Is there another way?
__________________

I do not answer private messages asking for help because no one else can: benefit from advice I may give or correct me if I'm wrong.

Please ask on the open forum if you have a question and I'll be happy to help,
if I know the answer.
Hero999 is offline  
Old 30th May 2009, 08:26 PM   #37
Default

Like I said, it's a LONG time since I did it, it was pre-windows on a DOS laptop running a 386SX16 processor.

There was no complicated maths, just a lookup table for a single decade - you simply scale for all other decades.

It was absolutely instant, you entered the value you wanted, hit enter - and the results appeared LONG before your finger was off the key.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Old 30th May 2009, 09:02 PM   #38
Default

How about just using this website hero? It's common when designing software or hardware to make sure no one else has done it first =)
Standard Resistor Closest Value Calculator
__________________
"Because I be what I be. I would tell you what you want to know if I
could, mum, but I be a cat, and no cat anywhere ever gave anyone a
straight answer, har har."
Sceadwian is offline  
Old 30th May 2009, 09:29 PM   #39
Default

Nigel,
So with your program, the user had to manually scale the value, mine will do it automatically.

Sceadwian,
That website just selects the nearest value. My program will do a lot more. Give it any value and it will select a pair of resistors which can be connected in series or parallel to give as near to the specified value as possible.

I know of a program which does this but it doesn't include E3, E48 and E192 values. It's also closed source, mine will be open source.
Directory of /~rstevew/Public/Software
__________________

I do not answer private messages asking for help because no one else can: benefit from advice I may give or correct me if I'm wrong.

Please ask on the open forum if you have a question and I'll be happy to help,
if I know the answer.

Last edited by Hero999; 30th May 2009 at 09:29 PM.
Hero999 is offline  
Old 31st May 2009, 12:16 PM   #40
Default

Quote:
Originally Posted by Hero999 View Post
Nigel,
So with your program, the user had to manually scale the value, mine will do it automatically.
No, you just entered the value you wanted, and the program displayed the five nearest combinations, it did any scaling itself.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Old 28th July 2009, 07:53 PM   #41
Default

Just an anorak here, turning this one upside down.
My understanding is that the original series (E6) was so that resistors could be made (very badly, with a conductive paint) for a target value (eg 2k). When tested, they could be sorted by their actual values into bins where the values were separated by their tolerances.
Eg: 1k (20%) bin would contain 800R to 1k20
1k5 bin goes from 1k20 to 1k80
2k2 - 1k76 to 2k64
3k3 - 2k64 to 3k96
4k7 - 3k76 to 5k64
6k8 - 5k44 to 8k16
10k - 8k0 up

These values fitted quite well, but when tolerances improved and the E12 values came along, they wanted to keep the E6 values and intersperse the new values - but they didn't quite fit as well as they might have done had they used the equation as guide rather than stay with the already rounded values.

Baldi
Baldilocks is offline  
Old 30th July 2009, 03:43 PM   #42
Default

Nothing to add, but I miss the simple days of Turbo Pascal.
__________________
Mark Higgins
DirtyLude is offline  
Old 30th July 2009, 05:13 PM   #43
Default

Oh Ya. OOPIC, also an interpreted PIC. Object Oriented language, too.
__________________
Mark Higgins
DirtyLude is offline  
Old 30th July 2009, 05:14 PM   #44
Default

Quote:
Originally Posted by DirtyLude View Post
Nothing to add, but I miss the simple days of Turbo Pascal.
Great wasn't it - incredibly fast compiling times, and a really nice language to use.

I used Microsoft once (both Pascal and C), I thought the computer had crashed it was SOOOOOOO slow
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Reply

Tags
e24, values, wrong

Thread Tools
Display Modes


Similar
Title Starter Forum Replies Latest
Resistor Values MrDEB Electronic Projects Design/Ideas/Reviews 5 21st May 2008 03:49 AM
A/D Values Omar.M Micro Controllers 0 16th April 2007 10:56 PM
Resistor values...... madmikejt12 General Electronics Chat 12 11th October 2005 04:12 PM
need a circuti with values samratyuvi General Electronics Chat 15 23rd September 2005 11:06 PM
How to compare values? Lac Micro Controllers 7 26th January 2005 03:45 PM



All times are GMT. The time now is 12:59 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker