Incoming Pulse Monitoring code - comments and suggestions welcome


Closed Thread
Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Aug 2007
    Posts
    15


    Did you find this post helpful? Yes | No

    Default 18f4431 try to use three-input capture mode with hall-effect senor state transitoin d

    capture
    ansel0=%00000000 'all digital
    trisa=%11111111 'set all port a pins to input cap1,cap2,cap3
    trisb=%00000000 'set all port b pins as output

    t1 var word
    t2 var word
    t3 var word

    Capture1 var pir3.1 ' tmr5 value was capture by the active edga on capl input
    Capture2 var pir3.2 'interrupt flag for pin cap2
    Capture3 var pir3.3 'interrupt flag for pin cap3

    ' auto time base reset, capture on rising to falling edge
    RiseToFall CON %01000111
    ' auto time base reset, capture on falling to rising edge
    FallToRise CON %01000110
    false con 0
    true con 1

    'capture mode
    intcon =0 'interrupts off
    tmr5h = 0 'clean high byte of tm5 counter
    tmr5l = 0 'clean low byte
    t5con = %00000001 ' prescale 1:1, int clock, tmr5 =on


    cap1con=%01000111 ' enable caputure,pulse width measurement mode,
    'every rising o falling edge
    cap2con=%01000101
    cap3con=%01000101

    Capture1 = false 'rest caputer flag
    Capture2 = false
    Capture3 = false
    main :
    if (Capture1=true)and(capture2=true)and(capture3 = true) then
    high portb.7
    endif


    end
    if (Capture1=true)and(capture2=false)and(capture3 = true) then
    high portb.6
    endif
    goto main

  2. #2
    Join Date
    Aug 2007
    Posts
    15


    Did you find this post helpful? Yes | No

    Default need help with 3-input caputer transtion detector

    need help with 3-input caputer transtion detector

Similar Threads

  1. Pushbutton code routine suggestions?
    By jessey in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 3rd September 2005, 02:02

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