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 .....
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 .....
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!
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.
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!
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!
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!
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:
The strange thing is that the switch status IS correctly read in this part:Code:if PORTB.0 = 1 then '<---- this line? Serout2 PORTB.7, 16384+12, [144, 44, 127] ' Rewind endif
So PORTB.6 is high as long as a button is pressed.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
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.
Instead of this
try thisCode:if PORTB.0 = 1 then '<---- this line? Serout2 PORTB.7, 16384+12, [144, 44, 127] ' Rewind endif
Set LED to a Port and see if it blinks.Code:if PORTB.0 = 1 then '<---- this line? High LED Pause 100 Low LED ' Rewind endif
Ioannis
It doesn't. I tried already:
PORTB.6 never gets high!Code:If PORTB.0 = 1 then PORTB.6 = 1 else PORTB.6 = 0 ' and loop...
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 19:41.
Bookmarks