Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Q: modern Forth with 1ms tickers

213 views
Skip to first unread message

Wolfgang Allinger

unread,
Jan 18, 2022, 8:37:53 AM1/18/22
to
Hi
is there any modern Forth, wich has a timer/TICKER
with at least 1ms resolution?

so I can do in a Multitasker something like

..
..
123 ms WAIT \ PAUSEing for 123 milli seconds
..

THX


Saludos (an alle Vernünftigen, Rest sh. sig)
Wolfgang

--
Ich bin in Paraguay lebender Trollallergiker :) reply Adresse gesetzt!
Ich diskutiere zukünftig weniger mit Idioten, denn sie ziehen mich auf
ihr Niveau herunter und schlagen mich dort mit ihrer Erfahrung! :p
(lt. alter usenet Weisheit) iPod, iPhone, iPad, iTunes, iRak, iDiot

David Schultz

unread,
Jan 18, 2022, 11:05:55 AM1/18/22
to
On 1/18/22 7:37 AM, Wolfgang Allinger wrote:
> Hi
> is there any modern Forth, wich has a timer/TICKER
> with at least 1ms resolution?
>
> so I can do in a Multitasker something like
>
> ..
> ..
> 123 ms WAIT \ PAUSEing for 123 milli seconds
> ..

The whole point of FORTH is that you can do it yourself. Tick rate is a
balance between how fast you would like it to run and how much time gets
wasted servicing the interrupt. 1KHz is too fast for most of what I do
but my version of eForth for the Teensy 3.6 runs systick at 1KHz. It can
handle it.

--
http://davesrocketworks.com
David Schultz

Stephen Pelc

unread,
Jan 18, 2022, 11:29:58 AM1/18/22
to
On 18 Jan 2022 at 14:37:00 CET, ""Wolfgang Allinger"" <all...@spambog.com>
wrote:
>
> is there any modern Forth, wich has a timer/TICKER
> with at least 1ms resolution?
>
> so I can do in a Multitasker something like
>
> 123 ms WAIT \ PAUSEing for 123 milli seconds

All the VFX desktop Forths let you do this:
123 MS
There may be a 1 ms jitter.

On the embedded systems, you choose your own timer granularity, which we
normally set to 1 ms.

Stephen
--
Stephen Pelc, ste...@vfxforth.com
MicroProcessor Engineering Ltd - More Real, Less Time
133 Hill Lane, Southampton SO15 5AF, England
tel: +44 (0)23 8063 1441, +44 (0)78 0390 3612, +34 649 662 974
http://www.mpeforth.com - free VFX Forth downloads

Paul Rubin

unread,
Jan 18, 2022, 12:36:37 PM1/18/22
to
"Wolfgang Allinger" <all...@spambog.com> writes:
> is there any modern Forth, wich has a timer/TICKER
> with at least 1ms resolution?

Gforth "100 ms" and "300 ms" appear to do about the right thing under
Linux. I expect they use the usleep system call which sleeps for a
specified number of microseconds. Of course there will be some
granularity and jitter under normal Linux. I don't know the situation
with gforth multitasking but I think there is some way to do it that
uses Posix threads underneath.

Marcel Hendrix

unread,
Jan 18, 2022, 2:54:53 PM1/18/22
to
On Tuesday, January 18, 2022 at 6:36:37 PM UTC+1, Paul Rubin wrote:
> "Wolfgang Allinger" <all...@spambog.com> writes:
> > is there any modern Forth, wich has a timer/TICKER
> > with at least 1ms resolution?
> Gforth "100 ms" and "300 ms" appear to do about the right thing under
> Linux. I expect they use the usleep system call which sleeps for a
> specified number of microseconds. Of course there will be some
> granularity and jitter under normal Linux.

I originally read it as a timer which can fire once every ms.
Maybe it is indeed meant to be a timer which can
fire at times accurate to within a millisecond.

Both cases are potentially difficult when Forth runs
stand alone.

-marcel

Paul Rubin

unread,
Jan 18, 2022, 4:46:40 PM1/18/22
to
Marcel Hendrix <m...@iae.nl> writes:
>> > is there any modern Forth, wich has a timer/TICKER
>> > with at least 1ms resolution? ...
> I originally read it as a timer which can fire once every ms. Maybe
> it is indeed meant to be a timer which can fire at times accurate to
> within a millisecond.

I saw the request as 1ms resolution, which is what it says. Resolution
is not accuracy though I'd expect that if you ask for 37msec, then on
the average you will get close to that.

Linux with the realtime scheduler can probably do 1ms and 1khz but not
much more than that. OP, what is the hardware environment and OS (if
any) that you want to run in?

> Both cases are potentially difficult when Forth runs stand alone.

In standalone it seems doable, again if you are willing to tolerate a
bit of jitter. The Raspberry Pi Pico running at 125MHz can do a lot in
1ms. The Teensy 4.x at 600MHz can do even more.

Andy Valencia

unread,
Jan 18, 2022, 7:12:11 PM1/18/22
to
"Wolfgang Allinger" <all...@spambog.com> writes:
> 123 ms WAIT \ PAUSEing for 123 milli seconds

ForthOS is just clock tick resolution. Thinking out loud, I suspect
what I'd do is just sleep on a dedicated event, and use a timer from
the PIT to interrupt and kick that channel back awake. Wouldn't scale to an
arbitrary number of tasks--to do that, you'd have to keep a queue, with the
nearest pending being the one waiting for the timer pop. But it doesn't
strike me as difficult.

(Huh, I just read that Windows does high res timers by cranking up
the system clock rate while they're in use.)

Andy Valencia
Home page: https://www.vsta.org/andy/
To contact me: https://www.vsta.org/contact/andy.html

Mike

unread,
Jan 20, 2022, 5:36:26 AM1/20/22
to
On Tuesday, January 18, 2022 at 3:37:53 PM UTC+2, Wolfgang Allinger wrote:
> Hi
> is there any modern Forth, wich has a timer/TICKER with at least 1ms resolution?

Flashforth has a 1 ms tick as default.
It works with PAUSE so all the tasks can independently wait for its delay to pass.

An Arduino (Atmega 16MHz) executes maybe 10000 instructions per millisecond.

Wolfgang Allinger

unread,
Jan 20, 2022, 4:32:38 PM1/20/22
to

On 20 Jan 22 at group /comp/lang/forth in article 4b6d8967-2109-43cd...@googlegroups.com
THX, do you have a link to Flashforth?

dxforth

unread,
Jan 20, 2022, 6:04:34 PM1/20/22
to
On 21/01/2022 03:19, Wolfgang Allinger wrote:
>
> On 20 Jan 22 at group /comp/lang/forth in article 4b6d8967-2109-43cd...@googlegroups.com
> <oh2...@gmail.com> (Mike) wrote:
>
>> On Tuesday, January 18, 2022 at 3:37:53 PM UTC+2, Wolfgang Allinger wrote:
>>> Hi
>>> is there any modern Forth, wich has a timer/TICKER with at least 1ms
>>> resolution?
>
>> Flashforth has a 1 ms tick as default.
>> It works with PAUSE so all the tasks can independently wait for its delay to
>> pass.
>
>> An Arduino (Atmega 16MHz) executes maybe 10000 instructions per millisecond.
>
> THX, do you have a link to Flashforth?
>
>
> Saludos (an alle Vernünftigen, Rest sh. sig)
> Wolfgang
>

https://flashforth.com/

https://sourceforge.net/projects/flashforth/

https://github.com/oh2aun/flashforth

Wayne morellini

unread,
Jan 22, 2022, 2:34:49 AM1/22/22
to
We are still working in milliseconds. No wonder GA exists. Hasn't the industry figured out to do nanoseconds in hardware by now. My hardware proposal decades ago, would be using less than billionths a second by now. The hardware industry is bone head dead!

I hope that 6Ghz forth chip has 1 to 10 of thousands, like had been proposed years ago, of 6ghz CPUs, that will put an end to things. That would be possible in current high end thermal packages.

minf...@arcor.de

unread,
Jan 22, 2022, 5:36:10 AM1/22/22
to
FWIW industrial safety shutdown systems eg. for steam turbines require reaction times of
of about 1 to 5 milliseconds. Most 'normal' safety systems can live with 10 to 50 ms.

Burn away at higher frequencies may have an adversary effect, namely reducing
statistical lifetime of electrical components. Let alone excessive energy consumption.

IOW reaction times or polling frequencies have to be optimized for the application.

Wayne morellini

unread,
Jan 22, 2022, 8:10:39 AM1/22/22
to
Thanks. I was referring to the statement that indicated there didn't seem support for faster, which is needed. Also I'm referring to technology a lot superior to what you are talking about, without poling, and with piling, is ok, depending on how it's designed. This is a statement on hardware design and system support. There is high need for faster potential switching in higher data flows now.

dxforth

unread,
Jan 23, 2022, 7:55:40 PM1/23/22
to
Speaking of timing and FlashForth for the Atmega here's a discussion involving a
practical application.

https://joecreager.com/better-resolution-and-accuracy-with-the-hc-sr04-and-flashforth/
0 new messages