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 PORTB.0=1
    ...

    You're assuming it can read port B properly.

    I'd start even easier, just blink a LED, nothing else, then build from that.
    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?

    So nobody can spot a mistake in my sample code?
    Strange, because this line is handled correctly:
    Code:
    If (PORTB.0=1) or (PORTB.1=1) or (PORTB.2=1) or (PORTB.3=1) or (PORTB.4=1) then
    .....

  3. #3
    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?

    I pulled out one of my old 16F628 programs from mothballs, only thing I notice, you have no CONFIG statements.


    EDIT: I used this with DEFINE OSC 20

    @ __CONFIG _HS_OSC & _WDT_OFF & _PWRTE_ON & _BODEN_ON & _MCLRE_ON & _LVP_OFF & _CP_OFF
    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!

  4. #4
    Join Date
    Feb 2012
    Posts
    57


    Did you find this post helpful? Yes | No

    Default Re: Who sees my stupid mistake?

    I set the config parameters in the programmer (as usual).
    The values you mentioned are the defaults in my programmer, except the HS mode, that I set manually.
    The point is that everything (almost) works.
    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 ...
    Last edited by RuudNL; - 2nd March 2024 at 18:04.

  5. #5
    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?

    Is this the "read modify write" problem?
    (I have to look that up whenever I encounter weird problems)
    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!

  6. #6
    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
    I set the config parameters in the programmer (as usual)...


    What if you set them in the program? Maybe something is wonky with your programmer config. (total wild guess, just eliminating stuff)
    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!

  7. #7
    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!

  8. #8
    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.

  9. #9
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,139


    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

Similar Threads

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