Re: [Flashforth-devel] interrupt on input change - one solution
Brought to you by:
oh2aun
From: Mikael N. <mik...@pp...> - 2013-02-04 20:25:53
|
Great Bob, I was going to answer you that you do not need to modify the FF core. But you figured it out. Any idea where to find hi resolution shaft encoders with an analog feel to them ? I think 128 or 256 pulses per revolution should be enough. I am putting together a DDS synthesized HF receiver and a tuning knob would be nice. 73s de oh2aun /Mike On Mon, 2013-02-04 at 19:22 +0000, Bob Edwards wrote: > Hi Folks, > > Having asked about an interrupt driven shaft encoder I had a go > at programming with success on a PIC18F4450. This is my solution: - > > \ interrupt driven shaft encoder connected to portb bits 6 and 7 > \ free to use at your own risk - Bob Edwards G4BBY > > rbie intcon mclr > false di is irq ei > > -knob > marker -knob > > > $fff2 con intcon > $ff81 con portb > $ff93 con trisb > > > $1 con rbif > $8 con rbie > > > ram variable knobcount > ram variable oldportb > ram variable oldticks > > > : knob_int ( -- ) > [i > rbif intcon mtst > if > rbif intcon mclr > oldportb @ portb c@ $c0 and dup oldportb ! 2dup <> > if > 2/ xor $40 and > if > 1 > else > -1 > then > knobcount +! > else > 2drop > then > then > i] > ;i > > : knobgo ( -- ) > \ install knob interrupt > $c0 trisb mset > ['] knob_int is irq > rbie intcon mset > ; > > : readknob ( -- n1 n2) > \ n2 knob counts recieved in the last n1 milliseconds > di > ticks oldticks 2dup @ > - dup ?negate > >r ! r> > knobcount @ > 0 knobcount ! > ei > ; > > : knobstop ( -- ) > \ remove knob interrupt > rbie intcon mclr > false di is irq ei > ; > > Cheers, Bob > > > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_jan > _______________________________________________ Flashforth-devel mailing list Fla...@li... https://lists.sourceforge.net/lists/listinfo/flashforth-devel |