Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 08:57 01 Aug 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 : CMM2 - Synchronising screen update to scanline?

Author Message
Nimue

Guru

Joined: 06/08/2020
Location: United Kingdom
Posts: 420
Posted: 12:09am 11 Feb 2021
Copy link to clipboard 
Print this post

Hi

If I have a simple program:


Time_Start$=Time$

DO
   Print "Start Time: ", Time_Start$
   Print "Time Now:  ", Time$
   Pause 1000
   CLS
LOOP


Occasionally the loop executes at just the wrong time and you get flicker.  I get this is to do with the screen update / scanline  -- but what is the "simplest" way to coordinate screen updates to prevent this?

(my normal domain is simple numerical stuff in MMBasic and this is the first use case where I am considering repeated screen updates.

Cheers
N
Edited 2021-02-11 10:09 by Nimue
Entropy is not what it used to be
 
Nimue

Guru

Joined: 06/08/2020
Location: United Kingdom
Posts: 420
Posted: 09:47am 11 Feb 2021
Copy link to clipboard 
Print this post

So, I read the Graphics programming PDF....

Version 2:

Still not a real program, just me exploring:

Do
   page write 1
   cls
   print "Current Time:", time$
   page copy 1 to 0
   pause 100
loop


Now, I appreciate that there is way more to this than what I've accomplished -- but this is the first time (in 48years) that I've page copy / written.

No flicker.

Nim
Entropy is not what it used to be
 
Schlowski
Newbie

Joined: 26/03/2014
Location: Germany
Posts: 29
Posted: 10:52am 11 Feb 2021
Copy link to clipboard 
Print this post

Nice advancement, there's one thing you could enhance:
the
page write 1
 
can be issued before the loop, it stays active until changed.
 
Nimue

Guru

Joined: 06/08/2020
Location: United Kingdom
Posts: 420
Posted: 11:34am 11 Feb 2021
Copy link to clipboard 
Print this post

  Schlowski said  Nice advancement, there's one thing you could enhance:
the
page write 1
 
can be issued before the loop, it stays active until changed.


Thank you!

For what it's worth -- my use case is to use the CMM2 to moniotor classroom conditions (temp, light, pressure, humidity, CO2) -- and this is the first thing we have designed that we plan to leave switched on for an extended period -- and to update the details in "real time".

Cheers
N
Entropy is not what it used to be
 
Nimue

Guru

Joined: 06/08/2020
Location: United Kingdom
Posts: 420
Posted: 04:44pm 11 Feb 2021
Copy link to clipboard 
Print this post

Evolution #1

This has now evolved into a temperature sensor (DS18B20) polling once every 5 minutes and logging the data to SD Card too.

Will add in light / pressure / humidity tomorrow -- but they will be more developmental as they are I2C but not native to the CMM2.

Have I posted before just how "easy" and "forgiving" the CMM2 is for developing this with children.  Have tried before with Arduino but the whole tethering to PC, write code remotely and "download" to the device somehow makes the whole thing too remote and long winded.

CMM2 -

tempr(15) << want to debug or change the pin used?  built in editor >> job done.  Somehow the children just "get it".

N
Entropy is not what it used to be
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1132
Posted: 06:04pm 11 Feb 2021
Copy link to clipboard 
Print this post

PAGE COPY 1,0

Good start, although this "risks causing screen artefacts"

Instead, use
PAGE COPY 1,0,B

This version ensures the page copy occurs during the next frame blanking and pauses your program until the copy is complete.

(Page 85 of manual V5.06.00)
Visit Vegipete's *Mite Library for cool programs.
 
RetroJoe

Senior Member

Joined: 06/08/2020
Location: Canada
Posts: 290
Posted: 07:29pm 11 Feb 2021
Copy link to clipboard 
Print this post

  Nimue said  Have I posted before just how "easy" and "forgiving" the CMM2 is for developing this with children.  Have tried before with Arduino but the whole tethering to PC, write code remotely and "download" to the device somehow makes the whole thing too remote and long winded.


That sentiment is applicable to everyone, of any age :)

Great project, BTW, and while the Arduino paradigm and C++ syntax is representative of most contemporary real-world scenarios, interpreted BASIC has historically been the goto language (see what I did there?) for educators, precisely because of its expressiveness, immediacy and interactivity.
Edited 2021-02-12 05:31 by RetroJoe
Enjoy Every Sandwich / Joe P.
 
Nimue

Guru

Joined: 06/08/2020
Location: United Kingdom
Posts: 420
Posted: 10:04pm 11 Feb 2021
Copy link to clipboard 
Print this post

  RetroJoe said  Great project, BTW, and while the Arduino paradigm and C++ syntax is representative of most contemporary real-world scenarios, interpreted BASIC has historically been the goto language (see what I did there?) for educators, precisely because of its expressiveness, immediacy and interactivity.


Getting there -- currently ticking away sampling every 5 mins and writing to SD card.  Just temp. Will add another 2 temps tomorrow - so I can measure outside and in the fish tank (for fun).

Then  the others - once I get to grips with I2C.

The challenge in education circles at present is the "Cat" (Scratch) and the Snake (Python).   Not a fan of block programming - never found a learner yet that finds it easier than BASIC (yes, they "like" it because its "fun" -- but they usually cant do anything more than copy the example from a book into the computer and tweak a few settings.)  Python, I quite like for rapid coding, but acknowledge that it has made me "lazy" with things like typing variables etc.

BASIC reads well and once you have explained that PRINT "HELLO"  does what it looks like it does, I always find that the learners can extend and modify this. Add a trailing "," to the statement and you can make the next thing print next to it.

Teach them that A$="Hello " and B$ = "World" and that "+" adds them together and they can quickly work out what Print A$+B$ will output.

At risk of getting all misty eyed, the "challenge" I have with BASIC is that the younger teachers have never used BASIC "back in the day" so default to the assumption that the modern alternatives are automatically better/more powerful AND the name puts them off.

I wonder if I could roll my own BASIC and call it something hip -- GOAT (greatest of all time -- according to my 19yo)

N
Edited 2021-02-12 08:05 by Nimue
Entropy is not what it used to be
 
Nimue

Guru

Joined: 06/08/2020
Location: United Kingdom
Posts: 420
Posted: 10:07pm 11 Feb 2021
Copy link to clipboard 
Print this post

  vegipete said  
PAGE COPY 1,0

Good start, although this "risks causing screen artefacts"

Instead, use
PAGE COPY 1,0,B

This version ensures the page copy occurs during the next frame blanking and pauses your program until the copy is complete.

(Page 85 of manual V5.06.00)


I know -- RTFM ;-)

Seriously though - cheers, added that into my latest version.

A weekend aside will be to code some visual "dials" for the sensor output - so all this page copy(ing) will be essential.

Cheers
N
Entropy is not what it used to be
 
RetroJoe

Senior Member

Joined: 06/08/2020
Location: Canada
Posts: 290
Posted: 01:18pm 12 Feb 2021
Copy link to clipboard 
Print this post

@Nimue, maybe what we need to do is rebrand BASIC to something more representative.

How about "EASYPZ": Everyone's All-purpose SYmbolic Program Zapper?

You could use it in full sentences: "It should be EASYPZ to code that algorithm".

Or,

Q: Who wrote this program?
A: My students - it was EASYPZ!

Obvious, silly names didn't stop Java, Python and Raspberry Pi from becoming wildly popular :)
Enjoy Every Sandwich / Joe P.
 
Nimue

Guru

Joined: 06/08/2020
Location: United Kingdom
Posts: 420
Posted: 01:51pm 12 Feb 2021
Copy link to clipboard 
Print this post

  RetroJoe said  
Obvious, silly names didn't stop Java, Python and Raspberry Pi from becoming wildly popular :)


The "challenge" is that most (90%) of teachers aren't enthusiastic about this -- and given than in Primary -- K12 -- they need to teach the whole curriculum, I suppose we could ask "Why should they be?"

Teachers look for support and guidance - so they inevitably end up with Scratch as a starter for 10.

One of my many "side projects" is to write a BASIC guide / resource for teachers -- make it easy to use / read / resource and teachers will use it.

And, as I was taught when training to be a teachers "Teachers are agents of social control"  -- if we re-normalise the use of BASIC as an introductory language, it will emerge victorious (   )

N
Entropy is not what it used to be
 
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