Posted: 07:47am 03 Apr 2025 Copy link to clipboard
matherp Guru
The firmware has no way of knowing what you have set as colours in teraterm/putty/mmedit etc. It has always set the console colour after an error so the change is minor to set it at program end to be consistent.
Been replaced with the flag command - simpler and faster
Edited 2025-04-03 17:54 by matherp
Posted: 08:25am 03 Apr 2025 Copy link to clipboard
Volhout Guru
Hi Peter,
It possibly eludes me, but I fail to see the use for the FLAGS function versus the old BIT function. In a typical program for readability you would name the flags in the flag regsiter with either a variable, or with a constant.
Lets assume you use 10 flags, that are labeled "b_Flag1"...."b_Flag10"
Using FLAG(n) you use - 10 variables (regardless if you use CONST or DIM, each use up 1 variable slot).
Using BIT(n) you would use - 10 variables (regardless if you use CONST or DIM, each use up 1 variable slot). - 1 user variable that holds the flags.
Agreed, in case you use only 1 flag, it saves 1 variable (50%). But in that case you could also use the 1 variable (64 bits) as 1 flag.
But I may be missing something. That often happens, that I need a bit of explaining to see the brilliance in the new commands.
Volhout Edited 2025-04-03 18:26 by Volhout
Posted: 08:36am 03 Apr 2025 Copy link to clipboard
matherp Guru
Both the flag command and function take less time than BIT as there is no variable lookup required. No-one needs more than 64 flags and standard basic commands can easily be used to manipulate bits in a standard integer if required
Posted: 09:11am 03 Apr 2025 Copy link to clipboard
Amnesie Guru
Hello,
I noticed a problem with the Pico 2 running PicoMiteVGA (latest version, but also tested with 02RC6):
The manual states that it isn't necessary to use a level shifter for the PS/2 keyboard (I am NOT using the ADC pins!) I use the default pins for the PS/2 Keyboard.
But I have a USB keyboard which supports PS/2 (as all of my keyboards from Cherry) which failed to initialize on MMBASIC boot-up (no level shifter!), I have to manually re-connect the keyboard and after that everything works fine. This keyboard works fine @ boot-up, if I use a level shifter!
My assumptions:
A: With the additional level shifter a small delay is introduced to leave more time for keyboard initialisation (for detecting USB or PS/2 operation) (?)
B: The additional level shifter is needed because even the none-ADC pins are not 5V tolerant @ boot-up (?)
C: Power issue, I have a small 2W amplifer on the same 5V rail, maybe it draws initially too much power so the keyboard cannot initialize (the more likely problem?)
USB Keyboard which supports PS/2 and has no problem at all: Cherry G80-1800, power consumption 15mA
USB Keyboard which supports PS/2 and only works after manually re-connecting: Cherry G84-4100, power consumption 100mA (!!!)
I have multiple (>5 keyboards from each model) and the problem is perfectly reproducible.
Any Ideas?
Things I am going to try now: adding a capacitor close to the keyboard supply - I will report.
Greetings Daniel Edited 2025-04-03 19:17 by Amnesie
Posted: 09:17am 03 Apr 2025 Copy link to clipboard
matherp Guru
This isn't a firmware issue. I'll make sure the manual states that a level shifter should ALWAYS be used for PS2 devices unless the device itself will run at 3.3V Edited 2025-04-03 19:18 by matherp
Posted: 09:33am 03 Apr 2025 Copy link to clipboard
Amnesie Guru
Hello Peter,
I can confirm that it sadly has nothing to do with the power supply or my circuit (traces routing).
I cut the traces on the pcb to the power amplifier (there is nothing else that draws power). I even added 220uF + 100nF capacitor directly to the PS/2 connector. Nothing.
You are right:
There should be always (!) used a level shifter unless the product / keyboard etc. is specified for 3v3 operation... Argh... Now I have do redesign the PCB again - I am glad I am living in Germany and not USA (trump tariff)
Thanks Daniel Edited 2025-04-03 19:35 by Amnesie
Posted: 09:52am 03 Apr 2025 Copy link to clipboard
Mixtel90 Guru
You don't know where the pull-ups are on a PS2 keyboard. The data lines are intended to be open collector transistors, but I don't think there is actually a standard for the pull-ups. Some keyboards have no pull-ups.
Differences in the "high" voltage level between TTL, TTL Schmitt and MOS systems mean that you can't always get reliable data even if the keyboard will power up at 3V3.
As PS2 was designed as a 5V system it's always safe to include level shifting and always risky to omit it. :)
Try to fit in 2 mosfets and 4 resistors for a level shifter. Done carefully it can take up less PCB area than a module as you can tuck resistors away.
. Edited 2025-04-03 19:56 by Mixtel90
Posted: 10:02am 03 Apr 2025 Copy link to clipboard
circuit Senior Member
Peter, may I join the chorus of those asking for the return of the BIT command and function. I use shift registers for some control functions and the ability to hold a variable for each shift register and manipulate it with the BIT command/function made life really easy. Yes, I realise that this can be achieved with a series of basic manipulations, but this becomes an unwelcome overhead compared with the simplicity of the BIT command.
Posted: 10:19am 03 Apr 2025 Copy link to clipboard
dddns Guru
Anyone tried, maybe a simple voltage divider with resistors could be sufficient in this case.It works for me with UART/TTL converters
Posted: 10:32am 03 Apr 2025 Copy link to clipboard
dddns Guru
Last comment in this issue: If it could be set, it would know. My only solution to not get my eyes hurt is to set my terminal default to white/black.. Not that I'm using black/white, but I have a slight grey background and even this is annoying for me..
Posted: 10:39am 03 Apr 2025 Copy link to clipboard
Mixtel90 Guru
Yes, I've done it using a very simple circuit that was intended for connecting a PS2 keyboard to a 3V3 FPGA. You need a diode from the clock and data lines to 3V3 and a series resistor to limit the current. It's not guaranteed to work as it depends on the value of pull-up resistor in the keyboard. I used BAT85 Schottky diodes and 270R resistors. It didn't blow up, but whether the inputs were within spec I don't really know. :) That was with an ordinary Pico.
You can force Putty colours to whatever you like providing it understands VT100. Just send it a suitable ESC control code or two. You could do this automatically using SUB MM.STARTUP in the Library and probably some variation of the new END command that I haven't investigated yet. MMBasic itself can't read the Putty colours (there's no guarantee that Putty or Tera Term could send them anyway) and won't configure them automatically.
. Edited 2025-04-03 20:48 by Mixtel90
Posted: 11:41am 03 Apr 2025 Copy link to clipboard
PhenixRising Guru
I am glad I am living in Germany and not USA (trump tariff)
Except that USA doesn't hit you up with a VAT. Trump is only doing like-for-like on tariffs.
Posted: 12:05pm 03 Apr 2025 Copy link to clipboard
Volhout Guru
@Trump
Fair or unfair, this move is not growing EXPORTS to US (desired by Trump, he want's local production) but as a result is not going to grow IMPORTS from US (undesired side effect). Direct effect: it only places the US as an unreliable partner. They just do whatever they want, and only to their benefit. And typically that change of mind sticks for a long time. It may cost a whole generation before that is gone.
Volhout
Posted: 12:15pm 03 Apr 2025 Copy link to clipboard
PhenixRising Guru
The plan is to eliminate income taxes for Americans.
Posted: 12:17pm 03 Apr 2025 Copy link to clipboard
matherp Guru
Politics are banned on TBS and particularly on this thread
Posted: 01:22pm 03 Apr 2025 Copy link to clipboard
Volhout Guru
Sorry
Volhout
Posted: 02:09pm 03 Apr 2025 Copy link to clipboard
bfwolf Regular Member
Peter, may I join the chorus of those asking for the return of the BIT command and function. I use shift registers for some control functions and the ability to hold a variable for each shift register and manipulate it with the BIT command/function made life really easy. Yes, I realise that this can be achieved with a series of basic manipulations, but this becomes an unwelcome overhead compared with the simplicity of the BIT command.
Why not use Sub(s) + Function(s) ?
Sub SetBit(byref BitPool% As integer, byval BitNr% As integer) Local BitMask% As integer = 1 << BitNr% BitPool% = BitPool% Or BitMask% End Sub
Sub ClrBit(byref BitPool% As integer, byval BitNr% As integer) Local BitMask% As integer = 1 << BitNr% BitPool% = BitPool% And INV BitMask% End Sub
Function GetBit(byval BitPool% As integer, byval BitNr% As integer) As integer Local BitMask% As integer = 1 << BitNr% GetBit = Choice((BitPool% And BitMask%)<>0, 1, 0) End Function
A problem has been found with the LCD backlight functionality using the original "Backpack" circuit, as used by Geoff and Silicon Chip Magazine. This uses 2 FETS as drivers for the backlight.
The backlight brightness is unable to be lowered below approx. 20% due to the change in frequency to avoid audio interference in V5.08.00, the output Mosfet is too slow to switch off at this frequency, however the choice of components may affect the severity.
Driving the backlight with the PWM command works fine if there is no simple software solution.
Regards, Lyle.
Posted: 02:33pm 03 Apr 2025 Copy link to clipboard
ville56 Senior Member
Why not use Sub(s) + Function(s) ?
Maybe not the fastest approach, but if Peter does not re-implement the BIT commands .... would also like to have them again. Not a question of the number of flags, but flag clusters can be seperated by name and si clashes between library routines can be avoided more easily.
Posted: 03:35pm 03 Apr 2025 Copy link to clipboard
bfwolf Regular Member
Why not use Sub(s) + Function(s) ?
Maybe not the fastest approach, but if Peter does not re-implement the BIT commands .... would also like to have them again. Not a question of the number of flags, but flag clusters can be seperated by name and si clashes between library routines can be avoided more easily.
Sure, it's certainly not the most performant option, but as the saying goes: "In times of need, the devil eats flies..."
Of course, CSUBs would also work - perhaps someone will take pity?
CSUB name [type [, type] …] hex [[ hex[…] hex [[ hex[…] END CSUB
And maybe one day something like this will appear in MMBasic?
CFUN name ( [type [, type] …] ) As type hex [[ hex[…] hex [[ hex[…] END CFUN
bfwolf Edited 2025-04-04 01:44 by bfwolf
Page 20 of 52
The Back Shed's forum code is written, and hosted, in Australia.