Liste des Groupes | Revenir à cl forth |
Waldek Hebisch <antispam@fricas.org> wrote:<SNIP>
Milkv Duos have 5 GPIO ports, formally 32-bit but many lines are
not connected to outputs. One port in RTC block and has
base address 0x05021000, the other ports are at 0x03020000 + n*0x1000
where n is port number. Output register is at offset 0, at offset
4 is direction register (setting bit to 1 means that line is an
output). At offset 0x50 is input register. Other registers
deal with interrupts.
>
ATM I have the following:
>
HEX
: LBIS DUP L@ ROT OR SWAP L! ;
: LBIC DUP L@ ROT INVERT AND SWAP L! ;
: gpio-base DUP 4 = IF DROP 2001000 ELSE 1000 * THEN VMA-IO @ + 20000 + ;
: bit-data 20 /MOD SWAP 1 SWAP LSHIFT SWAP gpio-base ;
: gpio-on bit-data LBIS ;
: gpio-off bit-data LBIC ;
>
which outputs bits to data register. To get actual output one
need to set direction register and associate PIN with GPIO function.
--
Waldek Hebisch
Les messages affichés proviennent d'usenet.