fl hex { PropForth4.6 06/10/2011 21:38:33 BigFont This is used to display BigFont(3Character X 2Line) on character-LCD. Dispay character: ! " ' ( ) * + , - . / 0 to 9 A to Z : ; < = > a to z Characters[# $ % & ? @] is not defined. } wvariable big_font \ ! " # $ % & ' ( ) * + , - . / 20 c, 20 c, 20 c, 20 c, 20 c, 20 c, 20 c, ff c, 20 c, 20 c, 02 c, 20 c, 03 c, 03 c, 20 c, 20 c, 20 c, 20 c, 20 c, 20 c, 20 c, 20 c, 20 c, 20 c, 20 c, 20 c, 20 c, 20 c, 20 c, 20 c, 20 c, 20 c, 20 c, 20 c, 20 c, 20 c, 20 c, 20 c, 20 c, 20 c, 20 c, 20 c, 02 c, 04 c, 20 c, 20 c, 20 c, 20 c, 02 c, 01 c, 20 c, 01 c, 02 c, 20 c, 20 c, 01 c, 02 c, 20 c, 02 c, 01 c, 05 c, ff c, 05 c, 05 c, ff c, 05 c, 20 c, 03 c, 20 c, 01 c, ff c, 01 c, 20 c, 20 c, 20 c, 02 c, 04 c, 20 c, 20 c, 20 c, 20 c, 01 c, 01 c, 01 c, 20 c, 20 c, 20 c, 03 c, 20 c, 20 c, 20 c, 20 c, 03 c, 03 c, 01 c, 20 c, \ 0 - 9 02 c, 05 c, 03 c, ff c, 02 c, 04 c, 02 c, 03 c, 20 c, 20 c, ff c, 20 c, 05 c, 05 c, 03 c, ff c, 00 c, 00 c, 05 c, 05 c, 03 c, 00 c, 00 c, ff c, 03 c, 20 c, 03 c, 01 c, 01 c, ff c, 03 c, 05 c, 05 c, 00 c, 00 c, ff c, 03 c, 05 c, 05 c, ff c, 00 c, ff c, 05 c, 05 c, 03 c, 20 c, 20 c, ff c, 03 c, 05 c, 03 c, ff c, 00 c, ff c, 03 c, 05 c, 03 c, 00 c, 00 c, ff c, \ : ; < = > ? @ 20 c, 05 c, 20 c, 20 c, 05 c, 20 c, 20 c, 05 c, 20 c, 02 c, 05 c, 20 c, 20 c, 02 c, 05 c, 01 c, 05 c, 02 c, 05 c, 05 c, 05 c, 02 c, 02 c, 02 c, 05 c, 02 c, 20 c, 02 c, 05 c, 01 c, 20 c, 20 c, 20 c, 20 c, 20 c, 20 c, 20 c, 20 c, 20 c, 20 c, 20 c, 20 c, \ A - Z 03 c, 05 c, 03 c, ff c, 01 c, ff c, 03 c, 05 c, 03 c, ff c, 00 c, 03 c, 03 c, 05 c, 05 c, ff c, 02 c, 02 c, 03 c, 05 c, 02 c, ff c, 02 c, 04 c, 03 c, 05 c, 05 c, ff c, 00 c, 00 c, 03 c, 05 c, 05 c, ff c, 01 c, 01 c, 03 c, 05 c, 05 c, ff c, 02 c, ff c, 03 c, 20 c, 03 c, ff c, 01 c, ff c, 05 c, 03 c, 05 c, 02 c, ff c, 02 c, 05 c, 05 c, 03 c, 03 c, 02 c, ff c, 03 c, 20 c, 03 c, ff c, 01 c, 03 c, 03 c, 20 c, 20 c, ff c, 02 c, 02 c, 03 c, 02 c, 03 c, ff c, 01 c, ff c, 03 c, 05 c, 03 c, ff c, 20 c, ff c, 03 c, 05 c, 03 c, ff c, 02 c, ff c, 03 c, 05 c, 03 c, ff c, 01 c, 01 c, 03 c, 05 c, 03 c, 01 c, 01 c, ff c, 03 c, 05 c, 03 c, ff c, 01 c, 03 c, 03 c, 05 c, 05 c, 00 c, 00 c, ff c, 05 c, 03 c, 05 c, 20 c, ff c, 20 c, 03 c, 20 c, 03 c, ff c, 02 c, ff c, 03 c, 20 c, 03 c, 04 c, 02 c, 04 c, 03 c, 20 c, 03 c, ff c, 04 c, ff c, 03 c, 20 c, 03 c, 03 c, 01 c, 03 c, 03 c, 20 c, 03 c, 01 c, ff c, 01 c, 05 c, 05 c, 03 c, 03 c, 00 c, 02 c, \ [ \ ] ^ _ ` ff c, 01 c, 20 c, ff c, 02 c, 20 c, 03 c, 20 c, 20 c, 20 c, 01 c, 03 c, 20 c, 01 c, ff c, 20 c, 02 c, ff c, 20 c, 02 c, 20 c, 01 c, 20 c, 01 c, 20 c, 20 c, 20 c, 02 c, 02 c, 02 c, 20 c, 01 c, 05 c, 20 c, 20 c, 20 c, \ a - z 05 c, 05 c, 03 c, 05 c, 00 c, ff c, 03 c, 02 c, 20 c, ff c, 02 c, 04 c, 02 c, 05 c, 05 c, 04 c, 02 c, 02 c, 20 c, 02 c, 03 c, 04 c, 02 c, ff c, 02 c, 05 c, 02 c, 04 c, 00 c, 00 c, 20 c, 02 c, 05 c, 01 c, ff c, 01 c, 02 c, 05 c, 02 c, 02 c, 00 c, 04 c, 03 c, 02 c, 20 c, ff c, 20 c, ff c, 20 c, 05 c, 20 c, 20 c, ff c, 20 c, 20 c, 20 c, 05 c, 03 c, 02 c, 04 c, 03 c, 20 c, 02 c, ff c, 04 c, 02 c, 03 c, 20 c, 20 c, 04 c, 02 c, 02 c, 03 c, 03 c, 02 c, ff c, 01 c, ff c, 03 c, 05 c, 02 c, ff c, 20 c, ff c, 02 c, 05 c, 02 c, 04 c, 02 c, 04 c, 03 c, 05 c, 02 c, ff c, 01 c, 20 c, 02 c, 05 c, 03 c, 20 c, 01 c, ff c, 02 c, 05 c, 05 c, ff c, 20 c, 20 c, 02 c, 05 c, 05 c, 02 c, 00 c, 05 c, 02 c, 03 c, 02 c, 20 c, 04 c, 02 c, 03 c, 20 c, 03 c, 04 c, 02 c, ff c, 03 c, 20 c, 03 c, 04 c, 02 c, 04 c, 03 c, 20 c, 03 c, 04 c, ff c, ff c, 03 c, 20 c, 03 c, 03 c, 01 c, 03 c, 03 c, 20 c, 03 c, 02 c, 00 c, 04 c, 05 c, 05 c, 03 c, 03 c, 00 c, 02 c, wvariable char_segment 1f c, 1f c, 1f c, 00 c, 00 c, 1f c, 1f c, 1f c, 1f c, 1f c, 1f c, 00 c, 00 c, 00 c, 00 c, 00 c, 00 c, 00 c, 00 c, 00 c, 00 c, 1f c, 1f c, 1f c, 00 c, 00 c, 00 c, 1f c, 1f c, 1f c, 1f c, 1f c, 1f c, 1f c, 1f c, 1f c, 1f c, 00 c, 00 c, 00 c, 00 c, 00 c, 00 c, 1f c, 1f c, 00 c, 00 c, 00 c, wvariable bigfont_x \ position for bigfont's x wvariable bigfont_y \ position for bigfont's y 1 bigfont_x W! 1 bigfont_y W! wvariable bf_line \ line-number for BigFont wvariable bf_char \ character-number for BigFont \ ( -- ) set character from 0x0 to 0x05 : set_char_segment char_segment 2+ 40 6 0 do 8 0 do dup lcd_com \ command for character to CG-RAM 1+ swap C@++ lcd_char \ write data swap loop loop 2drop ; \ ( c -- ) display big_font c:character code : set_big_font 20 - 6 u* big_font 2+ + \ get big_font's address 2 0 do 3 0 do C@++ lcd_char loop \ print 1-line for bigfont bigfont_x W@ 1- 2 lshift 1+ \ next x lcd_pos bigfont_y W@ 1- 1 lshift 2+ \ next y lcd-pos lcd_pos loop drop ; \ ( x y -- ) convert position for BogFont to lcd_pos : bf_pos dup bigfont_y W! 1- 1 lshift 1+ swap dup bigfont_x W! 1- 2 lshift 1+ swap lcd_pos ; \ ( -- ) clear BigFont LCD : bf_clear lcd_init 1 bigfont_x W! 1 bigfont_y W! ; \ ( -- ) set number of BigFont's characters and lines : bf_set line W@ 1 rshift bf_line W! char W@ 2 rshift bf_char W! ; \ ( -- ) move to next bigfont position : next_bigfont_pos bigfont_x W@ 1+ dup bf_char W@ > if drop 1 bigfont_x W! bigfont_y W@ 1+ dup bf_line W@ > if drop 1 then bigfont_y W! else bigfont_x W! then bigfont_x W@ bigfont_y W@ bf_pos ; \ display BigFont string ( cstr -- ) : bf_str C@++ dup if bounds do i C@ set_big_font \ put big_font next_bigfont_pos \ calculate next bigfont position loop else 2drop then ; : bf_dec 0 result W! 3b9aca00 tmp L! dup 80000000 and if invert 1+ 2d set_big_font next_bigfont_pos then \ check minus? a 0 do dup tmp L@ >= if tmp L@ u/mod 30 + set_big_font next_bigfont_pos 1 result W! else result W@ tmp L@ 1 = or if 30 set_big_font next_bigfont_pos then then tmp L@ a u/ tmp L! loop drop ; : demo lcd_init 10 4 lcd_setup \ 16characters 4line \ Defsult setting is 16Charcters & 2Lines bf_set set_char_segment bf_clear 20 \ first ascii code b 0 do bf_line W@ 0 do bf_char W@ 0 do \ i 1+ j 1+ bf_pos dup set_big_font next_bigfont_pos 1+ 100 delms loop loop loop drop bf_clear c" ABCDEF" bf_str ; decimal