Rotary switch program help

This is a discussion on Rotary switch program help within the C Programming forums, part of the General Programming Boards category; I need to use a rotary switch with 3 I/Ps to set time in hours and minutes to a microcontroller. ...

  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    7

    Rotary switch program help

    I need to use a rotary switch with 3 I/Ps to set time in hours and minutes to a microcontroller. 1 input is always connected to ground. The O/P is 2 bit grey code with 36 positions, channel L leads channel R by 90 degrees in the clockwise direction.

    When you turn the switch right id like to increment the time and when you turn the switch left to decrement the time. Would anyone be able to help with the code for this rotary encoder? Thanks

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    Might your micro have an app note on such a thing like this one for a PIC?
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  3. #3
    Registered User
    Join Date
    Feb 2006
    Posts
    7
    Im afraid not.

  4. #4
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    That's not a terribly helpful reply.

    I was kind of hoping for something like this:
    Quote Originally Posted by Wishful Thinking
    I'm using a <tell us what you're using> microcontroller. I did find some of the material in the PIC application note to be applicable in this case, especially regarding lookup tables or an XOR operation. Here is a start of some of my code:
    Code:
    /* some code */
    But I'm having issues with <some issue> and <some other issue>.
    Or something like that. Otherwise you're not very likely to get wonderfully helpful replies.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  5. #5
    Registered User
    Join Date
    Feb 2006
    Posts
    7
    Sorry man didnt mean to offend. Im using a MC68HC908GP32 freescale microcontroller. Appreciate your reply though.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 10:17 PM
  2. Can someome help me with a program please?
    By WinterInChicago in forum C++ Programming
    Replies: 3
    Last Post: 09-21-2006, 10:58 PM
  3. Need help with my program...
    By Noah in forum C Programming
    Replies: 2
    Last Post: 03-11-2006, 06:49 PM
  4. Switch Case
    By FromHolland in forum C++ Programming
    Replies: 7
    Last Post: 06-13-2003, 03:51 AM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21