Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #18060
| Newsgroups | alt.folklore.computers, comp.lang.forth |
|---|---|
| Date | 2012-12-17 22:34 -0800 |
| References | (11 earlier) <kafvpq$jr3$1@dont-email.me> <alpine.LNX.2.02.1212141538260.3758@darkstar.example.org> <61f5b422-e46d-497a-8377-7971b4215046@c14g2000vbd.googlegroups.com> <op.wpg8e6lb5cosae@dell3100> <7fa63f1e-35e6-4cb6-b2ca-0e1a5e61916d@n2g2000pbp.googlegroups.com> |
| Message-ID | <e0af7234-1236-4e80-a132-e84e5518801d@vb8g2000pbb.googlegroups.com> (permalink) |
| Subject | Re: Search Google, 1960:s-style |
| From | Alex McDonald <blog@rivadpm.com> |
Cross-posted to 2 groups.
On Dec 17, 2:58 pm, Tarkin <tarkin...@gmail.com> wrote:
> On Dec 17, 2:58 pm, "Stanley Daniel de Liver"
>
>
>
>
>
>
>
>
>
> <notagood...@invalid.org.invalid> wrote:
> > On Fri, 14 Dec 2012 21:00:55 -0000, <hanco...@bbs.cpcn.com> wrote:
> > > On Dec 14, 3:40 pm, Michael Black <et...@ncf.ca> wrote:
>
> > >> For all the expense, and size, most of them are quite simple. Some
> > >> controls, some electronics now, the motor in a washing machine, the
> > >> heating elements in an oven. Yet often very bulky to work on, and
> > >> nobody
> > >> is going to take it in to fix it, they require a serviceman to come to
> > >> the
> > >> house.
>
> > > After usage for some time, repairing a major appliance isn't usually
> > > econonically justified. Labor and parts are expensive, and it becomes
> > > cheaper just to get a new one.
>
> > > I don't think of an automatic washing machine was "quite simple". It
> > > may be old technology, not as complex as an automobile, but it does
> > > various tasks fully automatically. It knows how to fill the tub with
> > > water of the proper temperature, to stop filling when full, then start
> > > the wash cycle, to drain the water, knowing when to stop, then refill
> > > with rinse water, then draining and executing a spin cycle. The
> > > controls engage and disengage multiple electrical-mechanical
> > > components in the course of that process. There are some safety
> > > interlocks built in, too. It has some measure of durability and
> > > reliability (commercial grade units have more ruggedness).
>
> > This is a standard Forth programming example!
> > Which I don't have to hand ATM.
> > Hopefully a Forther can post it.
>
> > (xpost added)
>
> > --
> > [dash dash space newline 4line sig]
>
> > Money/Life question
>
> From Leo Brodie's 'Starting Forth':
>
> : WASHER WASH SPIN RINSE SPIN ;
>
> : RINSE FAUCETS OPEN TILL-FULL FAUCETS CLOSE ;
>
> ok.
That's a fraction of it. From Forth Inc's web site;
( Washing Machine Embedded Application )
\ Port assignments
01 CONSTANT PORT
\ bit-mask name bit-mask name
1 CONSTANT MOTOR 8 CONSTANT FAUCETS
2 CONSTANT CLUTCH 16 CONSTANT DETERGENT
4 CONSTANT PUMP 32 CONSTANT LEVEL
\ A colon begins a new definition.
\ Device control
: ON ( mask -- ) PORT C@ OR PORT C! ;
: OFF ( mask -- ) INVERT PORT C@ AND PORT C! ;
\ Definitions can contain generic SwiftX words and any others you've
defined…
\ Timing functions
: SECONDS ( n -- ) 0 ?DO 1000 MS LOOP ;
: MINUTES ( n -- ) 60 * SECONDS ;
: TILL-FULL ( -- ) \ Wait till level switch is on
BEGIN PORT C@ LEVEL AND UNTIL ;
\ …so, application-specific functions are defined in terms of previous
definitions…
\ Washing machine functions
: ADD ( port -- ) DUP ON 10 SECONDS OFF ;
: DRAIN ( -- ) PUMP ON 3 MINUTES ;
: AGITATE ( -- ) MOTOR ON 10 MINUTES MOTOR OFF ;
: SPIN ( -- ) CLUTCH ON MOTOR ON
5 MINUTES MOTOR OFF CLUTCH OFF PUMP OFF ;
: FILL-TUB ( -- ) FAUCETS ON TILL-FULL FAUCETS OFF ;
\ Wash cycles
: WASH ( -- ) FILL-TUB DETERGENT ADD AGITATE DRAIN ;
: RINSE ( -- ) FILL-TUB AGITATE DRAIN ;
\ …until you reach the main application definition.
\ Top-level control
: WASHER ( -- ) WASH SPIN RINSE SPIN ;
Back to comp.lang.forth | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: Search Google, 1960:s-style "Stanley Daniel de Liver" <notagoodone@invalid.org.invalid> - 2012-12-17 19:58 +0000
Re: Search Google, 1960:s-style Tarkin <tarkin000@gmail.com> - 2012-12-17 14:58 -0800
Re: Search Google, 1960:s-style Alex McDonald <blog@rivadpm.com> - 2012-12-17 22:34 -0800
csiph-web