Hi nverma,
If you're using an 18F this might work for you ...
The EXT (external) modifier.
http://www.picbasic.co.uk/forum/showthread.php?t=3891
In particular, the section on Using EXT with Labels.
HTH,
Hi nverma,
If you're using an 18F this might work for you ...
The EXT (external) modifier.
http://www.picbasic.co.uk/forum/showthread.php?t=3891
In particular, the section on Using EXT with Labels.
HTH,
DT
Thanks Darrel,
I'm not exactly sure what the DW command does. And if you look at the example of the EXT with label, could I write code as:
POT_VALUE CON EXT
POT_VALUE
DW (basically enter my precalculated values in order from the one correposidng to 0 all the way to 1023 here)
And then reading:
READCODE(POT_VALUE + (OFFSET<<1)),Temperature
DW is "Declare Data of One Word" in assembly language.
And, sounds like you've got the right idea for the rest of it.
<br>
DT
That's a rather involved calculation to be sure. Honestly, I gave up trying to follow it.
You have just 1024 input values, I assume these lead to 1024 discrete output values else you wouldn't be looking for a look-up table solution.
However, can you solve this by some other simpler method? Piecewize linear, interpolation polynomial, or such? Do you have say an excel spreadsheet with the results calculated?
Also, you don't need EEPROM to save values, you can use RETLW (Return with literal in W) to get a byte look up table, that will take 2048 memory locations to get 1024 words (and yeah, its assembler, but not much).
What type of thermometer do you use ?
I always make a table of maybe 30 points and make an interpolation between this points. It is good for me, but I don't know, what you need...
PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2
Ernie,
Yes I do have an excel spreadsheet with the values calculated. And I could possibly linearize the curve but loose accuracy. But about this RETLW command, how does it work and where can I find the syntax etc etc for it?
Darrel,
I don't think I can use that approach since the ADCIN command only lets you store the result in a VAR not a CON. How would I tell it what values from 0-1023 to pull out from memory?
The reading from the POT should be put in a variable.
The CON is the address of the Data Table that gets stored in program memory.
Then the A/D reading would be used as an offset into the data table in order to find the correct value.
<br>
DT
Bookmarks