I forgot to mention that there are resistors to ground (to keep the input 'low' when no button is pressed) and that the buttons switch to the +5 Volts.
I forgot to mention that there are resistors to ground (to keep the input 'low' when no button is pressed) and that the buttons switch to the +5 Volts.
16384+12 seems correct for (inverted) 31250 but should it BE inverted and why 16384+3313? (I don't know MIDI...)
Can you do a standard baudrate like 9600 and verify that data is coming out by using a terminal program?
The 16F628 does have UART so HSEROUT will work with it. I'd try that but you might need to invert the signal externally.
The 16384+12 is correct, I have used that before.
The calculation is: (1.000.000/Baudrate) - 20 , so 1.000.000 / 31250 = 32 -20 = 12.
For inverted output set bit 14, = 16384.
But even with a different baudrate I don't get any output.
I did a quick test to trace the problem.
With this code, nothing 'toggles':
So I suspect the problem is in the line (and similar lines)Code:Progstart: if PORTB.0 = 1 then Toggle PORTB.6 endif Debounce: Pause 20 ' ? shorter ? If PORTB.0=1 then goto Debounce ' Button still pressed? endif Goto Progstart
Although I don't see what could be wrong with this...Code:If PORTB.0=1 then
If I don't touch programming for a while, I start with blinking a LED to make sure I have the basics working right (config, circuit, programming, etc).
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!
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.
Bookmarks