Digipot - linear (need log) - can charactersitic be changed in code?


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2009
    Posts
    653

    Default Digipot - linear (need log) - can charactersitic be changed in code?

    I've a circuit where I need to use a dual digipot - the thing is I need one to be linear & one to be log - they don't make up hybrid - it's one or the other. I really don't have PCB space for two separate pots, so just wondering is there anyway this can be spoofed in code?

    I'm using a linear pot as input...I'm thinking here along the lines of some clever maths on the AtoD sample (ie from the linear input pot) to then control the output pot in a log-esque way?

  2. #2
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    966


    Did you find this post helpful? Yes | No

    Default

    Off the top of my head, you could just use a log lookup table for one of the pots that will return log values instead of linear ones.

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Jerson View Post
    Off the top of my head, you could just use a log lookup table for one of the pots that will return log values instead of linear ones.
    +1 ...

    But care to very poor and variable resolution ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  4. #4
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default Re: Digipot - linear (need log) - can charactersitic be changed in code?

    Quote Originally Posted by Acetronics View Post
    +1 ...

    But care to very poor and variable resolution ...

    Alain
    Oop, straight out the blocks, an epic fail on this one!

    so to generate a lookup table, I need my digipot's 256 linear step converted to log.

    So I use the Excel log function to log 256 number & then charted it within Excel, the problem is, I get a plot like the No4 trace in the first chart/diagram about halfway down this page (ie a reverse log characteristic), whereas what I want is a trace like no2 on that same diagram


    http://www.geofex.com/article_folder...s/potscret.htm

    How can I generate my LUT values for a 256 pot & have it look like trace 2?!!! (now I'm sure this is embarrasingly simple ....but I now realise that I shouldn't have tried so hard to pull Mary Harbottle during maths lessons)

  5. #5
    Join Date
    Jul 2003
    Location
    USA - Arizona
    Posts
    156


    Did you find this post helpful? Yes | No

    Default Re: Digipot - linear (need log) - can charactersitic be changed in code?

    Try the antilog (i.e. 10^x)

  6. #6
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default Re: Digipot - linear (need log) - can charactersitic be changed in code?

    Quote Originally Posted by languer View Post
    Try the antilog (i.e. 10^x)
    thanks but that wasn't it.

    ok, I think I've cracked it, well actually Maxim did for me http://pdfserv.maxim-ic.com/en/an/AN3996.pdf (there's an exe embedded in their Apllication note which yields the attenuation per step - I was able to dick about in Excel until I got my values to match theirs, so for a 256 step pot, you have this formula

    Attenuation = 20*log(256 -actual tap_position) / (255)

    which yields the cuve in excel I want....albeit in DBs, but I rebased it to actual steps., giving me something like this...

    Code:
    Tap     Log     Attenuation
    1	0	0.0000
    2	0	-0.0341
    3	0	-0.0684
    4	0	-0.1028
    5	1	-0.1373
    6	1	-0.1720
    7	1	-0.2068
    8	1	-0.2418
    9	1	-0.2769
    10	1	-0.3121
    11	2	-0.3475
    12	2	-0.3830
    13	2	-0.4187
    14	2	-0.4545
    15	2	-0.4905
    16	2	-0.5266
    17	3	-0.5628
    18	3	-0.5993
    19	3	-0.6358
    20	3	-0.6726
    21	3	-0.7094
    22	3	-0.7465
    23	4	-0.7837
    24	4	-0.8210
    25	4	-0.8586
    26	4	-0.8962
    27	4	-0.9341
    28	5	-0.9721
    29	5	-1.0103
    30	5	-1.0486
    31	5	-1.0872
    32	5	-1.1258
    33	5	-1.1647
    34	6	-1.2037
    35	6	-1.2430
    36	6	-1.2823
    37	6	-1.3219
    38	6	-1.3617
    39	7	-1.4016
    40	7	-1.4417
    41	7	-1.4820
    42	7	-1.5225
    43	7	-1.5632
    44	7	-1.6041
    45	8	-1.6452
    46	8	-1.6864
    47	8	-1.7279
    48	8	-1.7695
    49	8	-1.8114
    50	9	-1.8535
    51	9	-1.8957
    52	9	-1.9382
    53	9	-1.9809
    54	9	-2.0238
    55	10	-2.0669
    56	10	-2.1102
    57	10	-2.1537
    58	10	-2.1975
    59	10	-2.2415
    60	11	-2.2857
    61	11	-2.3301
    62	11	-2.3748
    63	11	-2.4197
    64	11	-2.4648
    65	12	-2.5101
    66	12	-2.5557
    67	12	-2.6016
    68	12	-2.6476
    69	13	-2.6940
    70	13	-2.7405
    71	13	-2.7874
    72	13	-2.8344
    73	13	-2.8818
    74	14	-2.9294
    75	14	-2.9772
    76	14	-3.0254
    77	14	-3.0737
    78	15	-3.1224
    79	15	-3.1713
    80	15	-3.2206
    81	15	-3.2700
    82	15	-3.3198
    83	16	-3.3699
    84	16	-3.4202
    85	16	-3.4709
    86	16	-3.5218
    87	17	-3.5731
    88	17	-3.6246
    89	17	-3.6765
    90	17	-3.7286
    91	18	-3.7811
    92	18	-3.8339
    93	18	-3.8871
    94	18	-3.9405
    95	19	-3.9943
    96	19	-4.0484
    97	19	-4.1029
    98	19	-4.1577
    99	20	-4.2128
    100	20	-4.2683
    101	20	-4.3242
    102	20	-4.3804
    103	21	-4.4370
    104	21	-4.4939
    105	21	-4.5513
    106	21	-4.6090
    107	22	-4.6671
    108	22	-4.7256
    109	22	-4.7845
    110	23	-4.8437
    111	23	-4.9034
    112	23	-4.9636
    113	23	-5.0241
    114	24	-5.0850
    115	24	-5.1464
    116	24	-5.2082
    117	25	-5.2705
    118	25	-5.3332
    119	25	-5.3964
    120	25	-5.4600
    121	26	-5.5241
    122	26	-5.5887
    123	26	-5.6538
    124	27	-5.7193
    125	27	-5.7854
    126	27	-5.8519
    127	28	-5.9190
    128	28	-5.9866
    129	28	-6.0547
    130	28	-6.1234
    131	29	-6.1926
    132	29	-6.2624
    133	29	-6.3327
    134	30	-6.4036
    135	30	-6.4751
    136	30	-6.5472
    137	31	-6.6199
    138	31	-6.6932
    139	31	-6.7671
    140	32	-6.8416
    141	32	-6.9168
    142	33	-6.9927
    143	33	-7.0692
    144	33	-7.1464
    145	34	-7.2243
    146	34	-7.3029
    147	34	-7.3823
    148	35	-7.4623
    149	35	-7.5431
    150	35	-7.6247
    151	36	-7.7070
    152	36	-7.7901
    153	37	-7.8741
    154	37	-7.9588
    155	37	-8.0444
    156	38	-8.1308
    157	38	-8.2181
    158	39	-8.3063
    159	39	-8.3954
    160	39	-8.4854
    161	40	-8.5763
    162	40	-8.6682
    163	41	-8.7611
    164	41	-8.8550
    165	42	-8.9500
    166	42	-9.0460
    167	43	-9.1430
    168	43	-9.2412
    169	43	-9.3404
    170	44	-9.4408
    171	44	-9.5424
    172	45	-9.6452
    173	45	-9.7492
    174	46	-9.8545
    175	46	-9.9611
    176	47	-10.0690
    177	47	-10.1783
    178	48	-10.2889
    179	48	-10.4010
    180	49	-10.5145
    181	49	-10.6296
    182	50	-10.7462
    183	51	-10.8643
    184	51	-10.9842
    185	52	-11.1056
    186	52	-11.2288
    187	53	-11.3538
    188	53	-11.4806
    189	54	-11.6093
    190	55	-11.7399
    191	55	-11.8725
    192	56	-12.0072
    193	57	-12.1440
    194	57	-12.2830
    195	58	-12.4242
    196	58	-12.5678
    197	59	-12.7138
    198	60	-12.8622
    199	61	-13.0133
    200	61	-13.1670
    201	62	-13.3235
    202	63	-13.4829
    203	64	-13.6453
    204	64	-13.8107
    205	65	-13.9794
    206	66	-14.1514
    207	67	-14.3269
    208	68	-14.5060
    209	68	-14.6888
    210	69	-14.8756
    211	70	-15.0666
    212	71	-15.2618
    213	72	-15.4614
    214	73	-15.6658
    215	74	-15.8751
    216	75	-16.0896
    217	76	-16.3095
    218	77	-16.5351
    219	78	-16.7668
    220	79	-17.0048
    221	80	-17.2494
    222	81	-17.5012
    223	83	-17.7605
    224	84	-18.0278
    225	85	-18.3036
    226	87	-18.5884
    227	88	-18.8828
    228	89	-19.1876
    229	91	-19.5035
    230	92	-19.8313
    231	94	-20.1720
    232	96	-20.5266
    233	97	-20.8962
    234	99	-21.2823
    235	101	-21.6864
    236	103	-22.1102
    237	105	-22.5557
    238	107	-23.0254
    239	109	-23.5218
    240	112	-24.0484
    241	115	-24.6090
    242	117	-25.2082
    243	120	-25.8519
    244	124	-26.5472
    245	127	-27.3029
    246	131	-28.1308
    247	135	-29.0460
    248	140	-30.0690
    249	145	-31.2288
    250	152	-32.5678
    251	159	-34.1514
    252	168	-36.0896
    253	180	-38.5884
    254	196	-42.1102
    255	224	-48.1308
    256	256	Infinity
    Last edited by HankMcSpank; - 11th February 2011 at 00:35.

  7. #7
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Red face Re: Digipot - linear (need log) - can charactersitic be changed in code?

    Hi,

    Just confirms #3 ...

    try to add a linear, or best 2nd order, regression between each step ...

    simple, you said simple ???

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts