Hello, I went through some documentation and think I am not sure about a couple of things.
Can I use any interrupt vectors for my program?
How is this affected when I want to start a task? Can I use any interrupts in the task?
Does ms word somehow affect the interrupt routines?
I have several reasons for asking.
One is that if I want to write to a PCD8544 display or AD9850 DDS it might be useful to use interrupt routine to provide the next byte to SPI as there is no built-in tx buffer.
Second reason is related to use of timers for timing and frequency generation - such as using a combination of timers for sidetone generation and keyer timing in electronic keyer, where the CPU would go into some idle state before change of key output would be handled by an interrupt routine.
If I use an interrupt, I don't want to mess up with another interrupt already set up by interpreter or task scheduler. Somehow I could not find this in the documentation, maybe I was looking in the wrong section.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You can use any interrupts except the ones precompiled FF for UNO is using.
Those are:
UART RX interrupt
Timer1 is used for CPU load measurement
Timer0 interrupt is used for MS.
By recompiling FF you can free timer1 and choose which timer(0,1,2) is used for MS.
So FF needs at least one timer to work, since FF is using the MS word also internally.
Tasks do not use any interrupts. Tasks are just scheduled cooperatively by PAUSE.
The stacks of all tasks have to be large enough to handle also the interrupt frames.
The FF core interrupt routines do not nest interrupts.
You need to build the SPI TX interrupt queue yourself.
Or you can just dedicate a background task for polling and queueing to the SPI.
Just call PAUSE in the BG task while polling the SPI to become free.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I see, not much was left to play with timers ;-) but in general it is very good that other interrupts are free. I think especially the SPI interrupt for feeding PCD8544 display continuously when outputting a string or progress bar (or S-meter bar or whatever) could be very useful. I will continue playing during the weekend :-) Using FF looks very elegant compared to Arduino. I previously used some other forth but one day it froze and remained so until I reflashed it by FF image.
Last edit: Jindrich Vavruska 2016-11-25
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In the latest ready made hex files the CPU load measurement has been left out.
So timer 1 and 2 are free for application use.
The load led is still there.
I hope you cannot get FF to freeze :-)
Reset + (Escape +) EMPTY + WARM should always give you clean a FlashForth.
I think FF is pretty elegant too :-) Although I have never used the Arduino IDE or programming language.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello, I went through some documentation and think I am not sure about a couple of things.
Can I use any interrupt vectors for my program?
How is this affected when I want to start a task? Can I use any interrupts in the task?
Does ms word somehow affect the interrupt routines?
I have several reasons for asking.
One is that if I want to write to a PCD8544 display or AD9850 DDS it might be useful to use interrupt routine to provide the next byte to SPI as there is no built-in tx buffer.
Second reason is related to use of timers for timing and frequency generation - such as using a combination of timers for sidetone generation and keyer timing in electronic keyer, where the CPU would go into some idle state before change of key output would be handled by an interrupt routine.
If I use an interrupt, I don't want to mess up with another interrupt already set up by interpreter or task scheduler. Somehow I could not find this in the documentation, maybe I was looking in the wrong section.
You can use any interrupts except the ones precompiled FF for UNO is using.
Those are:
UART RX interrupt
Timer1 is used for CPU load measurement
Timer0 interrupt is used for MS.
By recompiling FF you can free timer1 and choose which timer(0,1,2) is used for MS.
So FF needs at least one timer to work, since FF is using the MS word also internally.
Tasks do not use any interrupts. Tasks are just scheduled cooperatively by PAUSE.
The stacks of all tasks have to be large enough to handle also the interrupt frames.
The FF core interrupt routines do not nest interrupts.
You need to build the SPI TX interrupt queue yourself.
Or you can just dedicate a background task for polling and queueing to the SPI.
Just call PAUSE in the BG task while polling the SPI to become free.
I see, not much was left to play with timers ;-) but in general it is very good that other interrupts are free. I think especially the SPI interrupt for feeding PCD8544 display continuously when outputting a string or progress bar (or S-meter bar or whatever) could be very useful. I will continue playing during the weekend :-) Using FF looks very elegant compared to Arduino. I previously used some other forth but one day it froze and remained so until I reflashed it by FF image.
Last edit: Jindrich Vavruska 2016-11-25
In the latest ready made hex files the CPU load measurement has been left out.
So timer 1 and 2 are free for application use.
The load led is still there.
I hope you cannot get FF to freeze :-)
Reset + (Escape +) EMPTY + WARM should always give you clean a FlashForth.
I think FF is pretty elegant too :-) Although I have never used the Arduino IDE or programming language.