16LF1824 strange problem


Closed Thread
Results 1 to 32 of 32

Hybrid View

  1. #1
    Join Date
    May 2013
    Location
    australia
    Posts
    2,720


    Did you find this post helpful? Yes | No

    Default Re: 16LF1824 strange problem

    would it be possible to post the actual code you are using (in code tags preferably) not some edited portion.what are your config settings ? a schematic sketch could be in order. without the full story any solutions are just speculation
    whats "front" ? where is that defined


    this sort of code seems pretty awkward and may not really address the problem
    init:
    pulsin portc.2 , 1, vara
    if vara < 140 or vara > 160 then init
    pause 100
    pulsin portc.2 , 1, vara
    if vara < 140 or vara > 160 then init
    if vara > 140 and vara < 160 then goto beep
    goto init
    have a go at something like this

    Code:
    DEFINE PULSIN_MAX 500   ; why wait longer if its already out of limits (may need adjustment)
    init_ok  var bit
    
    init_ok=0
    
    
    init:
    
    while portc.2    ;  wait till portc.2 goes low 
    wend
    while ! init_ok   ; or init_ok=0 if you like
    pulsin portc.2 , 1, vara
    if abs(vara-150)<=10 then init_ok=1
    wend

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,720


    Did you find this post helpful? Yes | No

    Default Re: 16LF1824 strange problem

    or 5 good pulses in a row
    Code:
    DEFINE PULSIN_MAX 500   ; why wait longer if its already out of limits (may need adjustment)
    init_ok  var byte
    init_ok=5
    
    init:
    
    while portc.2    ;  wait till portc.2 goes low 
    wend
    while  init_ok   ; or init_ok>0 if you like
    pulsin portc.2 , 1, vara
    if abs(vara-150)<=10 then 
    init_ok=init_ok -1
    else
    init_ok=5
    endif
    wend

Similar Threads

  1. A strange problem
    By mombasa in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 25th January 2012, 22:08
  2. Very strange problem...
    By alanmcf in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 7th May 2011, 07:28
  3. strange serout2 problem
    By KaanInal in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 7th January 2010, 10:33
  4. Strange problem with PBP 2.50
    By Charles Linquis in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 16th October 2007, 21:45
  5. strange problem 12f675
    By peterdeco1 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 5th July 2007, 14:47

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