Who sees my stupid mistake?


Results 1 to 28 of 28

Threaded View

  1. #20
    Join Date
    Feb 2012
    Posts
    57


    Did you find this post helpful? Yes | No

    Default Re: Who sees my stupid mistake?

    In the meantime there is some progress:
    Code:
    CMCON =  7                                       ' Digital mode
    DEFINE OSC 20                                    ' 20 MHZ OSC.                                                                      
    TRISB= %00111111                                 ' PORTB 6/7=Output 0..5=Input
    
    Progstart: 
      if (PORTB & 1) = 1 then 
        Serout2 PORTB.7, 16384+12, [144, 44, 127]    ' Rewind
      endif  
      if (PORTB & 2) = 2 then 
        Serout2 PORTB.7, 16384+12, [144, 46, 127]    ' Fast Fwd.
      endif  
      if (PORTB & 4) = 4 then 
        Serout2 PORTB.7, 16384+12, [144, 48, 127]    ' Stop  
      endif  
      if (PORTB & 8) = 8 then 
        Serout2 PORTB.7, 16384+12, [144, 50, 127]    ' Play  
      endif  
      if (PORTB & 16) = 16 then 
        Serout2 PORTB.7, 16384+12, [144, 52, 127]    ' Record
      endif  
    
    Debounce:
      Pause 100                                      ' ? shorter ?
      If (PORTB.0=1) or (PORTB.1=1) or (PORTB.2=1) or (PORTB.3=1) or (PORTB.4=1) then
           goto Debounce                                ' Button still pressed?
      endif  
      Goto Progstart
    This works, as long as I comment out these lines:
    Code:
     '  If (PORTB.0=1) or (PORTB.1=1) or (PORTB.2=1) or (PORTB.3=1) or (PORTB.4=1) then
     '     goto Debounce                                ' Button still pressed?
     '  endif
    The idea is of course to prevent that the same data is sent multiple times, so I want to wait until a button is released.
    But the these lines seem to avoid that PORTB is read again.
    Last edited by RuudNL; - 3rd March 2024 at 10:42.

Similar Threads

  1. I don't understand my mistake
    By kik1kou in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 31st January 2015, 13:56
  2. Stupid simple question.....
    By chien_fu in forum mel PIC BASIC
    Replies: 18
    Last Post: - 23rd February 2010, 14:21
  3. Stupid question about LCDOUT
    By Glenn in forum mel PIC BASIC Pro
    Replies: 21
    Last Post: - 7th October 2008, 22:37
  4. SERIN2 – SEROUT2 and Manchester mistake.
    By RCtech in forum Serial
    Replies: 8
    Last Post: - 4th September 2007, 23:55
  5. Stupid question
    By Meriachee in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 20th July 2007, 06:47

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