Who sees my stupid mistake?


Closed Thread
Results 1 to 28 of 28

Hybrid View

  1. #1
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default Re: Who sees my stupid mistake?

    Quote Originally Posted by RuudNL View Post
    ...If I create a loop that does nothing else than: serout2 xxx, delay 1000, I get MIDI information every second.
    My main suspect is that the switch(es) are not read correctly in: if PORTB.x =1 then ...
    Blinking a LED confirms if your timing is running at the speed you think it's running at.

    I usually go for LED 1/2 second OFF, 1/2 second ON, just to know my OSC is running as it's supposed to.

    EDIT: Hm, yeah, but you're getting a SEROUT every second already, so not sure what else to check.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  2. #2
    Join Date
    Feb 2012
    Posts
    57


    Did you find this post helpful? Yes | No

    Default Re: Who sees my stupid mistake?

    I never had problems setting the config parameters in the programmer, but I will try that anyway...
    I have a feeling that the problem is in the line:
    Code:
      if PORTB.0 = 1 then   '<---- this line?
        Serout2 PORTB.7, 16384+12, [144, 44, 127]    ' Rewind
      endif
    The strange thing is that the switch status IS correctly read in this part:
    Code:
    Debounce:
      Pause 20                                          ' ? shorter ?
      If (PORTB.0=1) or (PORTB.1=1) or (PORTB.2=1) or (PORTB.3=1) or (PORTB.4=1) then
        PORTB.6 = 1                                   ' ADDED TO CHECK!! 
        goto Debounce                                ' Button still pressed?
      else
        PORTB.6 = 0                                   ' ADDED TO CHECK!!
      endif  
      Goto Progstart
    So PORTB.6 is high as long as a button is pressed.

    And a loop Serout xxx/ Pause 1000 spits out a burst of MIDI data every second, so it doesn't look it is a config problem.

  3. #3
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,175


    Did you find this post helpful? Yes | No

    Default Re: Who sees my stupid mistake?

    Instead of this

    Code:
      if PORTB.0 = 1 then   '<---- this line?
        Serout2 PORTB.7, 16384+12, [144, 44, 127]    ' Rewind
      endif
    try this
    Code:
      if PORTB.0 = 1 then   '<---- this line?
        High LED
        Pause 100
        Low LED    ' Rewind
      endif
    Set LED to a Port and see if it blinks.

    Ioannis

  4. #4
    Join Date
    Feb 2012
    Posts
    57


    Did you find this post helpful? Yes | No

    Default Re: Who sees my stupid mistake?

    It doesn't. I tried already:

    Code:
      If PORTB.0 = 1 then
        PORTB.6 = 1
      else
        PORTB.6 = 0
        ' and loop...
    PORTB.6 never gets high!

    I can't wrap my head around it...
    In the past I've written considerably more complicated code, usually with success.
    I think I'll sleep on it and try again from scratch tomorrow!
    Thank you everyone for your thoughts!
    Last edited by RuudNL; - 2nd March 2024 at 20:41.

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,175


    Did you find this post helpful? Yes | No

    Default Re: Who sees my stupid mistake?

    Then fried PIC maybe?

    Ioannis

  6. #6
    Join Date
    Feb 2012
    Posts
    57


    Did you find this post helpful? Yes | No

    Default Re: Who sees my stupid mistake?

    I doubt it... It is a brandnew one!
    What I find extremely strange, is that it seems the status of PORTB.x is not read in:
    Code:
    if PORTB.0 = 1 then 
        Serout2 PORTB.7, 16384+12, [144, 44, 127]    ' Rewind
      endif
    But IS read in:
    Code:
    Debounce:
      Pause 20                                          ' ? shorter ?
      If (PORTB.0=1) or (PORTB.1=1) or (PORTB.2=1) or (PORTB.3=1) or (PORTB.4=1) then
        PORTB.6 = 1                                   ' ADDED TO CHECK!! 
        goto Debounce                                ' Button still pressed?
      else
        PORTB.6 = 0                                   ' ADDED TO CHECK!!
      endif  
      Goto Progstart
    If it was a faulty PIC, this wouldn't work in both cases.

  7. #7
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,175


    Did you find this post helpful? Yes | No

    Default Re: Who sees my stupid mistake?

    Is it possible that you have high capacitance on the port B pins?

    Try to add pause 10 every after command and see how it goes.

    Ioannis

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