1 Continuous MCPWM at a time


Results 1 to 40 of 47

Threaded View

  1. #23
    Join Date
    Jul 2011
    Posts
    29


    Did you find this post helpful? Yes | No

    Default Re: 1 Continuous MCPWM at a time

    Hello,

    Thank you for your reply,
    The IF...THEN code still works (thanks for the tip putting just the subroutines at the top of main).
    Do you have a serial connection setup? If so you can HSEROUT some debug information which will make it easier to figure out what's going on.
    I am only using a PICkit 2 programmer. ?!

    If not perhaps you could blink a LED the same number of times as the value that gets assigned to EncoderState1, just to see what's going on.
    What do you mean ??


    This morning I've tried a different code :
    Code:
     
    Main:
    encoderstate1 = PORTA
    
            Select encoderstate1
            Case %000000
                GoSub GetADC
                GoSub SetPWM           
                OVDCOND = %00100010 'Q4 (PWM5) and Q10 (PWM1)
                PORTC = %00000011   'Q1 and Q7 ON   
            Case %000001
                GoSub GetADC
                GoSub SetPWM           
                OVDCOND = %00100010 'Q4 (PWM5) and Q10 (PWM1)
                PORTC = %00000011   'Q1 and Q7 ON
            Case Else 
                PORTC = 0
                OVDCOND = 0
            EndSelect
    In case 0, it is doing what it should do, now if I'm trying to give the value of 1 (I have a switch on portA.0, that is all !!) it jumps to case else, it means that it does not see the value 1 ??? Why not ? it is working with IF... THEN...
    Moreover, after switching my switch and giving the value 1 to portA.0, 4seconds after, it acts like if the value on portA.0 was 0... ???

    AHHH sometimes those pics know how to make you crazy, doesn't they ?
    Thanks for the help. Very much appreciated
    Last edited by barneyfrance; - 19th July 2011 at 11:28.

Members who have read this thread : 1

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