[Flashforth-devel] Interpreted mode vs turnkey mode
Brought to you by:
oh2aun
|
From: Rüdiger E. <Rue...@gs...> - 2014-07-28 11:52:07
|
\ **********************************************************************
\ Filename: 7seg.txt *
\ Date: 26.07.2014 *
\ FF Version: 5.0 *
\ Copyright: Mikael Nordman *
\ Author: Rüdiger Ehret *
\ **********************************************************************
\ FlashForth is licensed acording to the GNU General Public License *
\ **********************************************************************
\ pic18f2550,
\ Xtal 4MHZ, PLLDIV = 1, CPUDIV = OSC1_PLL2, clock=d'2000000' ; Hz
\ minicom over usb /dev/ttyACM0
\ 7 segment countdown on 4 digits
-7seg
marker -7seg
hex ram
\ The needed PIC registers
$ff80 constant porta
$ff81 constant portb
$ff89 constant lata
$ff8a constant latb
$ff92 constant trisa
$ff93 constant trisb
$fff1 constant intcon2
#0 constant bit0
#1 constant bit1
#2 constant bit2
#3 constant bit3
$0100 as1 movlb, ( k -- )
: (bit)
:
over $f040 $ff60 within
if
over #8 rshift $f and movlb,
1 \ Banked ram
else
0 \ Access ram
then
;
: bit0:
(bit) bcf, $12 i, postpone [
;
: bit1:
(bit) bsf, $12 i, postpone [
;
porta bit0 bit0: digit0_on inlined
porta bit0 bit1: digit0_off inlined
porta bit1 bit0: digit1_on inlined
porta bit1 bit1: digit1_off inlined
porta bit2 bit0: digit2_on inlined
porta bit2 bit1: digit2_off inlined
porta bit3 bit0: digit3_on inlined
porta bit3 bit1: digit3_off inlined
create number $3f c, $06 c, $5b c, $4f c, $66 c, $6d c, $7d c, $07 c, $7f c, $6f c,
: init
cwd
$0f trisa mclr \ for digit enabling
$ff trisb mclr \ for 7 segments
$ff porta c! \ digits all off / low aktiv
$00 portb c! \ segments all off / high aktiv
;
: dispDigit ( n --- )
number + c@ portb c!
;
: digit_countdown ( -- )
#10
begin
1-
dup .
dup dispDigit
500 ms
dup 0=
until
drop
;
: digits_all ( -- )
cr ." countdown digit one position" cr
digit0_on
digit_countdown
digit0_off
cr ." countdown digit ten position" cr
digit1_on
digit_countdown
digit1_off
cr ." countdown digit hundred position" cr
digit2_on
digit_countdown
digit2_off
cr ." countdown digit thousand position" cr
digit3_on
digit_countdown
digit3_off
;
: main ( -- )
init
digits_all
;
' main is turnkey
warm
\ ?????
\ - interpreted main start
\ works correct
\ - after modifying and sending
\ as a turnkey application
\ or
\ using warm
\ portb doesn't work correct
\ no bit banging will shown
\ ?????
|