![]() | ![]() | ![]() |
| |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
![]() |
| | Tools |
| | #1 |
|
Hi All ![]() Need your help - using PICBASIC PRO (pic simulator IDE 6.2 compiler) - i input an analog value ranging from 0-2.5V and i converted it to digital 10bit MY PROBLEM is : what i need to do for example : if the digital value is 0000010101 output 2% if the digital value is 0000011011 output 2.2% should i place the 2% .... in an array table and compare them, if yes how this can be done? Please help | |
| |
| | #2 |
|
How many values do you need?.
| |
| |
| | #3 |
|
i minimize it to 128 values
| |
| |
| | #4 |
|
Is it a linear progression?.
| |
| |
| | #5 |
|
not 100% linear i.e: in some cases, for different input values, we can get same % results ex: for 0000001010 ==> 2% for 0000001011 ==> 2% for 0000001100 ==> 2% for 0000001101 ==> 2.1% for 0000001110 ==> 2.2% for 0000001111 ==> 2.3% for 0000010000 ==> 2.3% for 0000010001 ==> 2.3% | |
| |
| | #6 |
|
If it's not linear you need a table then! - unless you can produce a formula that fits it?.
| |
| |
| | #7 |
|
how to do a table ?
| |
| |
| | #8 |
|
I don't use PICBASIC, so I can't help you with that, in assembler you use a series of RETLW's. Can you define a single dimensional array in your BASIC?. EDIT: Quick rethink! - does your BASIC support the DATA statement?, this is an example from the PIC BASIC compiler version of WinPicProg I was working on. Code: DATA 45, 255, 0, "H", "e", "l", "l", "o" - store 8 bytes of data.
READ A - read the first three bytes of data to three variables.
READ B
READ C
RESTORE 4 - reset the read point to 4th byte
FOR X=1 TO 5 - print a stored string.
READ A
PRINT CHR$(A)
NEXT X
Last edited by Nigel Goodwin; 7th January 2007 at 02:39 PM. | |
| |
| | #9 |
|
unfortunately , it does not support this | |
| |
|
| Tags |
| compare, table |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| PIC: Table lookup across page boundary | eblc1388 | Micro Controllers | 11 | 16th August 2005 03:43 PM |
| 18F Lookup Table Cose Snippet [ASM] | pittuck | Micro Controllers | 0 | 14th December 2004 08:40 AM |
| PIC 16F873 resetting by itself? | nclark | Micro Controllers | 10 | 30th June 2004 10:30 PM |
| truth table vs lookup table | alamy | Micro Controllers | 14 | 16th June 2004 08:48 PM |
| Lookup table for LCD and 7 segment display | patricktran | Micro Controllers | 3 | 23rd April 2004 02:43 PM |