Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 22:10 10 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Micromite eXtreme: USB keyboard support

Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10566
Posted: 07:57pm 14 Jan 2018
Copy link to clipboard 
Print this post









Attached is a beta release for the 100/144 pin Micromite eXtreme that supports a USB keyboard

2018-01-15_053507_Micromite5.04.10Beta.zip

At the moment the key layout is for a UK keyboard so US users will fine @ and " characters swapped and possible other errors. Australian users - I have no idea.
Please let me know any coding issue and I will correct them in a subsequent release.

To use the code you need USB connected to the chip in HOST mode which means VUSB must be at 5V and USBID should be at GND.

On the 144 pin Micromite eXtreme PCB ensure the shorting link USBv is made and put a jumper on USBv2.

The code should enumerate the keyboard on boot up if it is already plugged in or immediately when it is plugged in. A message will confirm the connection. The enumeration doesn't seem completely reliable (this is true of the Microchip example program as well as MMBasic) but just reset a couple of times if required until it works - this may be because the PCB has fairly primitive USB wiring and the enumeration takes place before the keyboard is stably powered.

Once the connection is made the keyboard can be used exactly like a normal console. If a normal console is also connected it will work as well.

NB to make this change I have removed the Micromite eXtreme CDC device functionality so you will need to use the PIC16F1455 or a USB/UART connected to the console pins if you don't want to use a USB keyboard.

To use the Micromite eXtreme as a standalone computer with a VGA monitor, plug in the VGA connector and set up the display as the console

OPTION LCDPANEL VGA
OPTION LCDPANEL CONSOLE 1,rgb(white),rgb(blue)


This is all that is required to give a nice white on blue display with 36 x 80 resolution and colour coding in the editor

NB this does not affect the use of a PS2 keyboard which should work as before.
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2171
Posted: 09:09pm 14 Jan 2018
Copy link to clipboard 
Print this post

woot!

thanks Peter
 
Bill7300
Senior Member

Joined: 05/08/2014
Location: Australia
Posts: 159
Posted: 10:18pm 14 Jan 2018
Copy link to clipboard 
Print this post

We Aussies can await the arrival of the US keyboard code, Peter. That will fix all our issues - well, except for the fact that our $key is worth only 78% of the US $key
Bill
 
Paul_L
Guru

Joined: 03/03/2016
Location: United States
Posts: 769
Posted: 12:53am 15 Jan 2018
Copy link to clipboard 
Print this post

I wonder if Peter can find a way to keep track of the relative value of the AU $ and the US $ and apply it automatically???????????

File this under "things that make you go HMMMMMM".

Paul in NY
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2959
Posted: 11:28am 15 Jan 2018
Copy link to clipboard 
Print this post

Great stuff Peter, but a few things immediately apparent . . .


1> I have loaded a (largish) program from SD card into memory. It runs ok. I can LIST it ok. BUT when I go into EDITor, nothing is there!

2> VGA screen also going corrupt around the edges with 'random pixels'. I will try take a picture.

3> With the nunchuck controller in versions up to .06, I was successfully using I2C READ &H52,0,6,nun(0) in a program (to read Nunchuk controller values). From v.08 I get an error 'Cannot find NUN'

Will report back anything else as I find it . . .

WWEdited by WhiteWizzard 2018-01-16
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2959
Posted: 11:43am 15 Jan 2018
Copy link to clipboard 
Print this post

Two more things:

1> At the command prompt, if you type something that generates an error (i.e. -LIST), the ERROR message is displayed immediately, but the Command Prompt takes about half a second before it is displayed. I am sure there was never a delay before (but I maybe wrong). Possibly something for Geoff, but no need for a delay IMHO

2> With the USB keyboard, F2 does not work (and possibly other Fn keys). So if in EDITor, type something, then press F2; it saves three bytes saved but it looses everything! Typing in on PS2 is not an issue (i.e. F2 works as expected)


Will keep testing. . .

WW
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10566
Posted: 12:51pm 15 Jan 2018
Copy link to clipboard 
Print this post

  Quote  With the nunchuck controller in versions up to .06, I was successfully using I2C READ &H52,0,6,nun(0) in a program (to read Nunchuk controller values). From v.08 I get an error 'Cannot find NUN'


Firstly, this is incorrect syntax - should be I2C READ &H52,0,6,nun()
Secondly, you must DIM nun before use and then the error goes away.

It is possible Geoff has tightened something up in parsing that had previously let you get away with it.

The delay after an error was a diagnostic I left in, that one is easy

The rest are all memory corruption issues which I though I'd solved but didn't retest with VGA active. Please could you test 5.4.08 for the same thing as it may have been introduced before the USB changeEdited by matherp 2018-01-16
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2959
Posted: 02:15pm 15 Jan 2018
Copy link to clipboard 
Print this post

Will test on v08 again soon.

Regarding the nun(): I have not altered the original program that contained: DIM nun(6)

Changing to I2C READ &H52,0,6,nun() results in the same error message (with NUN in capitals if thats any clue?).

I would try to play with this but currently have no EDITor!!

Will revert back to v08 and test all again . . .

WW

 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2959
Posted: 02:43pm 15 Jan 2018
Copy link to clipboard 
Print this post

Hi Peter,

Please can you confirm something:

With the MMX144 onboard MicroBridge, when I initially power up, the Mode button responds (i.e. Mode LED lights up when Mode button pressed). I then hold mode button down for 2+ seconds (to reset) and Mode LED goes off (as expected). BUT from here the MODE button does not respond UNLESS I remove power and then reapply.

Please can you confirm if you also only get a one-chance press of Mode button.

I can confirm the PIC1454 is ok - and it works as expected in Geoffs MicroBridge module.

I have tried this on MMX144 v10, v08, and v05 and all give me only one press (then button does not respond)

Thanks . . .

To clarify: It may have always behaved like this on the MMX144 - but on other modules such as the E28 you can press the mode button 'multiple times'. Just curious now . . . Edited by WhiteWizzard 2018-01-17
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10566
Posted: 03:39pm 15 Jan 2018
Copy link to clipboard 
Print this post

  Quote  To clarify: It may have always behaved like this on the MMX144 - but on other modules such as the E28 you can press the mode button 'multiple times'. Just curious now . . .


No you can't, the behaviour is the same

The issue is whether the pic16f145x is connected to the PC. If you flash the chip and don't connect a terminal you can't use the mode switch until after the USB has reconnected.

To flash it twice in a row (why?) start the second flash and then push the mode switch and it will work.

To use the mode to reset, just have a terminal connected and you can do it as many times as you like
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2959
Posted: 03:39pm 15 Jan 2018
Copy link to clipboard 
Print this post

Peter:

With v08, I still have the issues with: nun() (i.e. 0 removed; and has always been DIMmed). Also the issue with EDITor listing disappearing (but LIST working).

However, the good news is that the screen does not seem to be corrupted around edges in v08

My OPTIONs as follows:

CPU 252
ColourCode ON
LCDPANEL VGA (as always with my favourite: Console 1,rgb(white),rgb(blue))
SDCARD 93,94
RTC 15,6


Regarding the Mode 'one-time only' issue; with all above OPTION parameters set it works ok (multiple times as expected). It seems to be something early on after updating firmware and before setting any OPTIONs. Too intermittent yet to pinpoint but I will keep 'hunting'!!
Edited by WhiteWizzard 2018-01-17
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2959
Posted: 03:49pm 15 Jan 2018
Copy link to clipboard 
Print this post

  matherp said   To flash it twice in a row (why?) start the second flash and then push the mode switch and it will work.


I was backing down to v08 to do the test you requested but by mistake I backed down to v05. So Pressed Mode button again to load v08 immediately and noticed the issue at this point. Just lost a couple of hours as you just made me realise the USB end needs to be talking to TeraTerm

Hopefully you seen my last post regarding v08: No pixels on screen border, but still EDITor displays no listing (but LIST does; and program runs ok). Also nun() still an issue - will get a small program snippet to you asap to test there . . .
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10566
Posted: 05:52pm 15 Jan 2018
Copy link to clipboard 
Print this post

Here is a new beta which should address many of the issues. I can't replicate the nun() issue and this is not a bit of the code I have touched so I can only suggest you also try and replicate on Geoff's latest MM+ release.

2018-01-16_034922_MMX5.04.10Beta2.zip

To make things convenient for testing this beta automatically sets the options as listed below. I've also implemented "SAVE IMAGE" for the VGA display and fixed a bug in BLIT for VGA




 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2959
Posted: 06:01pm 15 Jan 2018
Copy link to clipboard 
Print this post

Thanks Peter - I will load this Beta later tonight and get back to you with outcomes. . .

Nice touch with the vga SAVE IMAGE

WW

 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2959
Posted: 11:20am 16 Jan 2018
Copy link to clipboard 
Print this post

Peter:

All above seems to be nicely fixed in B2.

I have not done any testing on TFT as not a spare one here currently available (will be later today though).

ONE NEW THING (sorry!):
With USB keyboard, the 'buffer' fills up very quickly. i.e. IF you hold down a key so it enters its 'repeat state', then the repeat interval seems to be near zero micro-seconds.

Wrote a program to show this (using DO:LOOP with PRINT str$(ASC(INKEY$)) and a PAUSE 10) but there is an easier way to see the 'issue'. At command prompt, hold down a character key and see what happens!!

There are several knock-on issues but fixing this will solve the others.
For example, holding cursor direction key down to navigate in editor results in cursor jumping to start/end of program.

Hope this all makes sense . . .

WW
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10566
Posted: 12:30pm 16 Jan 2018
Copy link to clipboard 
Print this post

Please find attached Version 5.04.10

2018-01-16_222632_MMX5.04.10.zip

and updated manual

2018-01-16_222701_Micromite_eXtreme_Manual.pdf

This now slows the maximum repeat rate of the USB keyboard to a sensible level. There is a small stutter in the auto-repeat every 10 characters or so but this seems to be something in the Microchip USB driver.

In addition you can select between a UK (default of course ) and US keyboard using

OPTION USBKEYBOARD UK or OPTION USBKEYBOARD US

This is a normal release with no Options set
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2959
Posted: 05:23pm 16 Jan 2018
Copy link to clipboard 
Print this post

Peter;

All seems good after a fair bit of testing today.

Only one thing which I cannot replicate WITH v10BETA2. I was needing to switch options from VGA to TFT, so did an OPTION RESET. It kept saying (incorrectly IMHO) that 'RTC not responding' (even though it was plugged in). Normally with an OPTION RESET it just does it.

Like I say, this only happened once - but it did happen. FYI: OPTION RTC DISABLE also resulted in RTC not responding.

Will continue to test tonight . . .


WW


 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025