Jump to content

A simple idea


Recommended Posts

Hi everyone

Here's an idea for a feature of MIOS.

Having the ability to choose between linear ang log input's on the AIN's. Meaning that you could connect a log pot to the input's and then MIOS scales the sampled voltage to a linear output or vice versa.

The math to do this is simple.

Is MIOS and the 18F up to the job? I guess this is taking MIOS in to the realms of DSP on a very basic level.

Any feed back would be helpful

Rowan

Link to comment
Share on other sites

Hi Rowan,

I think it's not so much a matter of maths but more of resolution (of the pots). Then you might experience a not so precise sampling of values in the upper or lower area of the pot, so something like "jitter" might occur (though technically speaking, this is no jitter). You might not be able to access certain values anymore, like say there's a direct jump from 125 to 127, without being able to enter 126.

Regards, ilmenator

Link to comment
Share on other sites

Yes Ilmentor, and this jitter will be especially appear in the region where the output curve of the logarithmic pot has it's highest increase rate where a sampled voltage value changes between 4V and 5V without moving the pot.

However, the implementation of a scale table is very simple, especially if only 7bit values should be converted.

Insert a table into your source code with 128 values:

Conversion_Table
        db       0x7f   ; value #0x00
        db       0x7e   ; value #0x01
        db       0x7d   ; value #0x02
[..]
        db       0x01   ; value #0x7e
        db       0x00   ; value #0x7f
Now you can convert a pot value in this way:
        ;; 7-bit pot value saved in TMP1
        ;; move converted pot value to TMP2

        TABLE_ADDR Conversion_Table
        movf    TMP1, W  ; get pot value 0x00-0x7f
        TABLE_ADD_W   ; add WREG to table pointer
        tblrd*+                  ; read from table
        movff TABLAT, TMP2 ; copy table entry to TMP2

Best Regards, Thorsten.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...