PPM decoding using 12F508 problem


Closed Thread
Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default Re: PPM decoding using 12F508 problem

    I think this will work.

    changed last label to Failsafeb
    Code:
    badframe:    clrwdt
            movlw    128-((23000-9000)/256); timer reached 9mS ?
            subwf    TMR0,w
            skpc            ; wait 9mS to skip other channels
            goto    badframe
            movlw    ARMCOUNT    ; reset throttle arming delay
            movwf    ArmFrames
            decfsz    HoldFrames    ; too many bad frames ?
            goto    hold
            goto    Failsafeb

    then try this directly above the routine Failsafe
    Code:
    Failsafeb:  
        	bsf    GPIO,CH_1
    	bsf    GPIO,CH_2
    	bsf    GPIO,CH_3
    	bsf    GPIO,CH_4
    
            movlw 	1	;total 1.5ms
    	call	Servo_Delay
    	movlw 	1
    	call	Servo_Delay
    
    	;goto	Failsafe ; not needed because execution will continue to Failsafe
    I can’t guess if you want to turn throttle off before or after the 1.5ms,
    or when you want to reset throttle arming delay which was done in Failsafe.
    That turns all outputs on 1 instruction apart.

    If you meant cycle them all with 1.5 ms delay each, then ignore all of the above,
    and simply write your own delay constants in the original routine instead of copying
    from the variables.

    This flows onto the next label int he program so must be left in place.
    Code:
    Failsafe:    movlw    1
            movwf    HoldFrames    ; stay in failsafe until signal returns        
    
            btfss    Flags,GOT_FS    ; do we have good failsafe values?
            goto    no_signal    
    
            movlw    110		; only guessing approx value for 1.5ms here
            movwf    PWM_1        
            movlw    110
            movwf    PWM_2           
            movlw    110
            movwf    PWM_3        
            movlw    110
            movwf    PWM_4
    
            call    Output        ; output failsafe frame
    
            bcf    Flags,ARMED    ; keep throttle OFF
            movlw    ARMCOUNT
            movwf    ArmFrames    ; reset throttle arming delay
    Last edited by Art; - 9th August 2016 at 17:10.

Similar Threads

  1. 12F508 OPTION Register
    By sayzer in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 13th January 2013, 00:00
  2. 12F508 and Dallas 1820 not working
    By Picprogman in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 10th February 2012, 17:13
  3. 12F508 strange timing
    By pk7639 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 23rd April 2007, 00:25
  4. calibration clock 12f508
    By volcane in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 5th December 2006, 10:33
  5. 12F508 question...
    By muddy0409 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 22nd August 2005, 09:32

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