\ ********************************************************************* \ Blinker for FlashForth * \ Filename: blink.fth * \ Date: 10.10.2007 * \ File Version: 3.0 * \ Copyright: Mikael Nordman * \ Author: Mikael Nordman * \ ********************************************************************* \ FlashForth is licensed acording to the GNU General Public License* \ ********************************************************************* -blink marker -blink hex ram \ Needed assembler definitions 0 constant w, \ Destination W register 1 constant f, \ Destination File 0 constant a, \ Force Acces Bank 1 constant b, \ Force Bank Select Register $90 as3 bcf, ( f b a -- ) $80 as3 bsf, ( f b a -- ) $ff82 constant portc $ff94 constant trisc $ff8b constant latc : blink ( n -- ) [ trisc 1 0 bcf, ] begin [ portc 1 a, bcf, ] dup ms [ portc 1 a, bsf, ] dup ms key? until key 2drop ; ram : 99blink 99 blink ; ' 99blink is turnkey warm \ Test the toggling speed of a few implementations -speed marker -speed : speed ( -- ) \ 833 KHz @ 12 MHz [ trisc 2 0 bcf, begin, portc 2 0 bcf, portc 2 0 bsf, again, ; : set0 [ portc 2 0 bcf, ] ; : set1 [ portc 2 0 bsf, ] ; : speed2 ( -- ) \ 277 KHz@12 MHz 4 trisc mclr begin set1 set0 again ; : speed3 ( -- ) \ 32,2 Khz @ 12Mhz 4 trisc mclr begin 4 portc mset 4 portc mclr again ;