Re: [Flashforth-devel] more fun with PIC18F46K22-s...
Brought to you by:
oh2aun
|
From: Mikael N. <mik...@fl...> - 2019-12-08 22:44:01
|
I am not sure I fully understand what you are doing, but...
I hope you are running at full clock speed.
To get more capacity I would use HW timers for the ADC and PWM.
That saves many cycles.
Remember that your user interrupt routine is checked
at every interrupt. Except in the latest FlashForths.
There the system tick will not check the user interrupt.
You can put the UART2 stuff in two background tasks.
Something like this.
I assume RX2 and TX2 calls PAUSE if they would block.
0 30 30 0 task: rx2.task
: rx2.loop
init.rx2
begin
rx2
processchar
again ;
0 30 30 0 task: tx2.task
: tx2.loop
init.tx2
begin
get.char.from.tx2.memory.queue
tx2
again
;
: main
init.uart2
['] rx2.loop rx2.task tinit
rx2.task run
['] tx2.loop tx2.task tinit
tx2.task run
begin
bla.bla
pause
put.char.to.tx2.memory.queue
again
;
Mikael
|