Please help me understand this code


Results 1 to 15 of 15

Threaded View

  1. #4
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    969


    Did you find this post helpful? Yes | No

    Default

    Try this. Changes are in Bold

    Code:
    '---[INT - interrupt handler]------Signal found at RB0, take a reading
    SignalFound:
        T1CON.0 = 0                             ; Stop timer1
        i = i + 1                               
        FValue = TMR1H * 256 + TMR1L + fvalue   ; Add 10 readings to FValue
        if i >= 10 then                        ' COMPARISON CHANGED TO >=
            fvalue = fvalue / i                ; get the average of one reading CHANGED HERE
            i = 0                               ; Reset counter
            ReadFlag = 1                        ; FValue is ready to read 
        endif        
        TMR1H = 21                              ; reset timer1 to 60mS
        TMR1L = 167
        T1CON.0 = 1                             ; Start timer1
    @ INT_RETURN
    Last edited by Jerson; - 29th April 2010 at 03:26.

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