Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 12:17 11 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 : Touch Screen Numpad.

Author Message
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 02:27am 29 May 2018
Copy link to clipboard 
Print this post

Touch Screen Number pads for the MX170....

Just wondering what code others are using?

Here I have one of my backpacks using code borrowed from Geoff's Garage Parking Sensor.

But I've seen a few different variations on this them.
The Super Clock looked like a different approach, and I have a feeling I also saw an example Matherp used that looked pretty simple.

The code I'm using ATM is working fine with no need for change,
but my Son is working on his Major Project with a Backpack & think it would be best if he could use code that he can easily explain.

Any thoughts on the most suitable code for this case?


Thanks

Phil.
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 04:27am 29 May 2018
Copy link to clipboard 
Print this post

Maybe a calculator?

Microblocks. Build with logic.
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3308
Posted: 05:01am 29 May 2018
Copy link to clipboard 
Print this post

Chapter 7 of Getting Started with the Micromite has a good example of a numeric keypad and an explanation of how it works.

You can download it from:
http://geoffg.net/Downloads/Micromite/Getting%20Started%20with%20the%20Micromite.pdf
Geoff Graham - http://geoffg.net
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 08:36am 29 May 2018
Copy link to clipboard 
Print this post

  Geoffg said   Chapter 7 of Getting Started with the Micromite has a good example of a numeric keypad and an explanation of how it works.

You can download it from:
http://geoffg.net/Downloads/Micromite/Getting%20Started%20with%20the%20Micromite.pdf


Thanks Geoff,

I had the document already, but didn't think to give it a look.

After spending year 11 coding in Python, It took a little kicking & screaming to get the Teenager to write some lines in MMbasic...

First nights progress; he has 2 menu screens, boxes, labels, different coloured fonts & Touch interacting.

Seeming a little addicted, and I did hear a comment slip that "This is Pretty Good".

There's also been mention that Arduino is just a few lines & some Libraries, but I don't really understand how those libraries work.

All in all, I believe a MM backpack is a far superior learning environment.

Cheers

Phil.
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 10:00am 29 May 2018
Copy link to clipboard 
Print this post

MM is best to start with.
But for future development with embedded systems, maybe even a career, learning at least a language like C is necessary.
Small steps, then bigger steps, then hit a limit. Time for C. :)

Microblocks. Build with logic.
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 10:08am 29 May 2018
Copy link to clipboard 
Print this post

  MicroBlocks said   Maybe a calculator?


On Screen Keyboard will be a just part of the overall project, which is a Security System/Burglar Alarm.

At the moment there's just 20 lines of code....

And about a dozen sheets of A4 spread across the dining room table mapping flow charts.

 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9751
Posted: 10:18am 29 May 2018
Copy link to clipboard 
Print this post

"This is pretty good" said from the mouth any Teenager, is approval and probably high praise too.

On the Arduino libraries, yeah, that seems to be a very common issue. People use the libraries to do what they need them to do, and to make it easier to write the Arduino C code for the rest of their sketch, but not that many people actually understand how the libraries themselves work, so that is still a black hole of C.

The MM now has libraries of it's own, but at least the MM libraries are just more MMBASIC code and/or C-functions/C-Subs.
Smoke makes things work. When the smoke gets out, it stops!
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 10:26am 29 May 2018
Copy link to clipboard 
Print this post

  MicroBlocks said   MM is best to start with.


Personally I started on a Canon Canola Programmable Calculator in the late '70's.
That & the TRS-80's, & the Wang computers that punted around NSW schools.

At around the age of 16, I got punted down to Sydney UNI for a week; sort of computer workshop a week long.

That was on some breed of Fortran; DEC LA-120 type stuff for terminals.

That was a really bad move on the part of Education in my opinion.
Think the whole week bred more confusion than learning & felt way out of depth.

Mid '80's it was back to Basic again with Dick Smiths VZ-300's & enjoyed programming & learning again.

Played with GW & QuickBasic in the DOS days.

What I find interesting is how some people look down their noses at Basic as weak & inferior. (And I'm not having a go at you MB, about C...).

But I do often wonder what would have happened if Basic had initially received a different name.

Apsic maybe? All Purpose Symbolic Instruction Code, just dropping that one word that some seem to shun at.


Cheers

Phil.
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9751
Posted: 10:35am 29 May 2018
Copy link to clipboard 
Print this post

Modern BASIC is a funny beast. Early BASIC's were just that - designed for beginners and to be easy to learn, and not REALLY that powerful. Something like the MMBASIC we have now seems like a hybrid monster - keeping the easy-to-learn idea along with many of the original commands, but it can do so much more then BASIC ever used to be able to do. Imagine trying to control a touch-screen with standard BASIC. I don't think it could be done, or it would be tediously slow. OK - the LCD drivers are written in C by our resident C guru(matherp), but we can essentially ignore that fact, cos all we need are lines of BASIC syntax to control it. "And I think to myself, what a wonderful world."
Smoke makes things work. When the smoke gets out, it stops!
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2171
Posted: 10:40am 29 May 2018
Copy link to clipboard 
Print this post

  Grogster said   not that many people actually understand how the libraries themselves work, so that is still a black hole of C


*sigh* this is precisely the argument I have had dozens of times... give me lego over airfix any-day... finished product might not be as polished but you can change any aspect of the original spec... once you disappear into a library (someone else's idea of what is needed) you lose all control.

All I want is a really good set of primitives and I can build everything else.

Edited by CaptainBoing 2018-05-30
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 09:46pm 29 May 2018
Copy link to clipboard 
Print this post

  Geoffg said   Chapter 7 of Getting Started with the Micromite has a good example of a numeric keypad...


Hi @Geoffg,

Just FYI,

I've been browsing the latest revision of this manual & noticed, Page 62, the circle command.

[Quote]CIRCLE X, Y, R, LW, A, C, FILL[/quote]

and page 52 of the 5.4 manual.





Neither mention the [LW] parameter.

Cheers

Phil

Edit, Found it in other commands, Line Width. Had a mental blank for a bit...Edited by Phil23 2018-05-31
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 02:18am 30 May 2018
Copy link to clipboard 
Print this post

  Phil23 said  
  MicroBlocks said   MM is best to start with.


What I find interesting is how some people look down their noses at Basic as weak & inferior. (And I'm not having a go at you MB, about C...).

But I do often wonder what would have happened if Basic had initially received a different name.

Apsic maybe? All Purpose Symbolic Instruction Code, just dropping that one word that some seem to shun at.


Cheers

Phil.


Phil,


My journey was started when I bought a VIC-20. Programmed it in BASIC of course. At that time everything was new but I already saw that programs that do really nice things had huge amounts of DATA statements and PEEK/POKE. That got me interested.


Very short after i traded my VIC-20 for a TRS-80 Model 1. Again BASIC and again interesting programs had lots of DATA and PEEK/POKE. This TRS-80 was my favorite and i soon learned to program it in assembler and did something similar as now is doen with MMBasic and CFunctions. I added my own BASIC commands to the TRS-80 basic and modified a few others. Remember the most usefull one was a modification to the CLS command. :) It could now handle start and end linenumbers to partially clear a screen superfast.


Got my first programming job and that assembly language together with BASIC made the difference. With only BASIC it could not be done as parts of the computer are just inaccessible from it or a BASIC version of the code would be extremely slow.


Then the PC came out. First programming job done in BASIC and for the first year or so i did everything with that until it became obvious that speed was not sufficient for the more difficult tasks. Turbo Basic to the rescue. After some more time
and more demanding jobs (like TSR's - Terminate and Stay Ready) the only way to get it done was by using C. On the PC it could also be done in assembler but in my needs C was the better choice as it is still a high level language.

My journey continued with Visual Basic once windows was stable and I used that for many years, but once in a while I had to write my own 'OCX' or 'DLL' in C to get more control.

Nowadays it is mostly C#. And on embedded systems I prefer Mmbasic but sometimes need C especially for other chips like the PIC 1455 or Atmel chips.

C is a pretty small language, the whole refence probably fits on a single piece of paper. The libraries though are what makes it very usefull.

BASIC is pretty much the same, the core language is small. Mmbasic has that core and a large amount of extra functions that are similar to a library. There is no I2C, SPI etc in BASIC. Those are added to BASIC to make it work well for the hardware it sits on. Using those functions gives you some control but not complete control especially when timing is critical. If that is the case your solution is to go to a CFunction or just go straight to a C compiler.

If your kid is interested in programming embedded systems then the need to use C will arrive. At younger ages learning more then one computer lamguage is easy.

Later in live it gets more difficult. :)

When a programming career is in the future then learning C is a must as it sets a very good foundation to many other computer languages.
BASIC unfortunately does not.



Microblocks. Build with logic.
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3308
Posted: 02:23pm 30 May 2018
Copy link to clipboard 
Print this post

  Phil23 said  Just FYI, I've been browsing the latest revision of this manual & noticed, Page 62, the circle command does not mention the [LW] parameter.

Thanks, I will fix that in the next version.
Geoff Graham - http://geoffg.net
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2171
Posted: 02:33pm 30 May 2018
Copy link to clipboard 
Print this post

  MicroBlocks said  
When a programming career is in the future then learning C is a must ...


so true.

it doesn't matter that modern Basics are good languages - if people look down their noses at it - that is all that matters. No amount of banging the drum will change that. Just roll with the punches and learn C (or Java) if you want a career as a programmer. Chances are you will feel just as passionately about them once you are proficient.
Edited by CaptainBoing 2018-06-01
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 03:28pm 30 May 2018
Copy link to clipboard 
Print this post

I must disagree with Java though. Making everything OOP is undermining a lot of other very good programming structures.
I would say, do java when you must, but if you do not really have to use it use C# as it takes the good parts of Java and makes it even better.

Java WAS the rage and it is still used a lot. Doesn't mean that it is a good language though.

I have had a few employees that were very good in Java, but they were unable to think differently. It cost me a lot to find out the reason why. They used Java exclusively in university. I think that was the real problem, exclusively will make you very good at something but it does not always give the best results.

With C you can stay high level or go really deep. Java is just very high level.
The difference is huge.

As a small example, one of the projects I had to do was to process huge amounts of GPS messages. The solution made in Java (because that was their expertise) processed it with a speed of about 6000 per second. They were very happy with this result, but I was not. They tried to squeeze every little bit of speed out of it but did not get much more improvements. One of them asked why I thought 6000 per second was not good enough. I told them they were using a Intel XEON processor with 32GB of memory not a 386SX with 1MB memory from 20 years ago. You should be able to get about 1.000.000 per second. You should have seen their faces. Like i was stating something completely impossible.
As proof i wrote the same processing of the messages in C# and got around 850.000 per second the first attempt. With further optimisation it would probably be even faster.
The thing i want to say with this example is that Java when used exclusively when learning also sets expectations and limits in peoples head. It makes you feel good about what you accomplish but in reality it is often far of what is possible.

Java has it good points and a lot of bad stuff. When used for what it is designed for it works good enough. It is not an 'all purpose' language.

Javascript for instance is very popular at the moment. It is not a good language at all, but same as Java (although they are not related at all) there are good parts and bad parts. If you know those then it can be a great language. If you do not know the bad parts, well get ready for some debugging sessions and cursing out loud why that was a bug. Yep, that bad.

With C i still not found any bad parts. Pointers are tricky, but o so usefull when used properly.







Microblocks. Build with logic.
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4126
Posted: 03:59pm 30 May 2018
Copy link to clipboard 
Print this post

  Phil23 said  There's also been mention that Arduino is just a few lines & some Libraries, but I don't really understand how those libraries work.

That doesn't make much sense as the libraries are readily available as source and generally quite readable.

Obviously they commonly try to provide sane wrappers for hardware, and some of that is horrid so it then infects the code (perhaps making it hard to grasp) - but that's true of any language support library. Look what Microchip's USB inflicts on the code!

Is it just that people (perhaps being lazy?) don't even look for the library code so have no idea what it is actually like? And then don't understand it. (There's no real cure for laziness.)

JohnEdited by JohnS 2018-06-01
 
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