Hello Hannu,

> TCCR1A_COM1A  TCCR1A_COM1B or TCCR1A c! And all those four bits are set.
> 
> However most of the time COM1A part of register shouldn't be 11 but for 
> example 10
> 
> So how do you guys write TCCR1A_COM1A lowerBitClearPlease c! with register 
> names?

The bitmap: words defines the bits, which are changeable.
To apply a particular bit pattern, the word pin! takes 
the bit pattern and the bitmap: word. It changes the
bits which are set to 1 in the bitmap: into the ones from
the bit pattern. All other bits remain the same.

example (from SPI, which I rewrote recently to use
the bitnames.frt words, currently only in the svn)

SPCR %00001100 bitmask: spi.mode
$0 constant spi.mode0  \ sample rising/--
$4 constant spi.mode1  \ --/sample falling
$8 constant spi.mode2  \ sample falling/--
$c constant spi.mode3  \ --/sample rising
: spi.setmode ( spi-mode -- ) spi.mode pin! ;

Used as 

spi.mode0 spi.setmode

Similiar the spi.setspeed word.

Note that the bit patterns from the different
modeX definitions already match the bitmap:
definition.

"high" and "low" change all bits which are set
to 1 in the bitmap: definition. They could be 
seen as

address bitmap bitmap: example
$ff example pin!  \ high
$00 example pin!  \ low

HTH
Matthias

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to