Offset to variable howto ?


Closed Thread
Results 1 to 19 of 19

Hybrid View

  1. #1
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by RFsolution View Post
    thank you melanie

    Well this is what i want to do and would show on the display:

    I read the Real position from the encoder as a 10bit word (0-1024) as the encoder is absolute
    i might want to add or substract an offset so that how the encoder mechanicly is fixed
    i still can correct it by the offset but need to keep 1024 as resolution for 1 revolution

    So i want to display or have new variables with:
    the position +/- it's offset but between 0 and 1024
    Conversion of the position +/- offset to 0 - 360 deg (keep the 10bit resolution)

    I dont see how I can do that

    Can you point me out ?
    So, you add your offset...
    If it's above 360, subtract 360...
    If it's below 360 (i.e. negative, somewhere above 65000, if using words), add 360...
    Get the picture yet?

  2. #2
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Why not using an offset switch? when you press it, you jump to a reading routine put the value into a word variable that will be use as the offset. In this way the offset will never be greater then the true value.

Similar Threads

  1. EEPROM Variables (EE_Vars.pbp)
    By Darrel Taylor in forum Code Examples
    Replies: 79
    Last Post: - 26th October 2012, 00:06
  2. Variable PWM PIC18F2431
    By trr1985 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 12th June 2009, 06:03
  3. HSEROUT full 3 digit display of variable howto ?
    By RFsolution in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 24th October 2008, 13:53
  4. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 20:36
  5. Big characters on HD44780 4x20
    By erpalma in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 7th January 2007, 02:21

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