Bingo!
Next is to restore the systik using TMR0. Strip out all of the old firmware PWM stuff. I would set the time to 5-10 ms for now using the defines. Wiggle an unused output on each interrupt to confirm the timing. If you set the output when you enter the IRQ service and clear it when you leave you'll also get an idea of how much time is spent in the IRQ service routine. Nice to know.
Once that is working, fix up the beeper on/off control. Then the beeper pattern thing should work. If you don't need patterns you can still have an easy beeper control by passing an ON time to a beepON() function, set a derived timer and have the beeper task turn it off then the timer runs out.
This would be a good time to get the switch debouncing updated and running off the systik, too.
Once all that is going, we'll take a look a the LCD - it will be useful to debug the ADC. You should sketch up a list of displays it needs to show, how often etc. so that we can get an idea the best way to do it. For example, I found in my charger work that I had to shadow the ports due to the ambient noise - that would eliminate the use of MikroC's libraries. Maybe I'm being too paranoid, though. At least we could start with the LCD libs using one of the patches discussed above then port to our own if necessary. We should have a pow-wow with @MMcLaren and decide on the best way to do it.
Nice work!
Next is to restore the systik using TMR0. Strip out all of the old firmware PWM stuff. I would set the time to 5-10 ms for now using the defines. Wiggle an unused output on each interrupt to confirm the timing. If you set the output when you enter the IRQ service and clear it when you leave you'll also get an idea of how much time is spent in the IRQ service routine. Nice to know.
Once that is working, fix up the beeper on/off control. Then the beeper pattern thing should work. If you don't need patterns you can still have an easy beeper control by passing an ON time to a beepON() function, set a derived timer and have the beeper task turn it off then the timer runs out.
This would be a good time to get the switch debouncing updated and running off the systik, too.
Once all that is going, we'll take a look a the LCD - it will be useful to debug the ADC. You should sketch up a list of displays it needs to show, how often etc. so that we can get an idea the best way to do it. For example, I found in my charger work that I had to shadow the ports due to the ambient noise - that would eliminate the use of MikroC's libraries. Maybe I'm being too paranoid, though. At least we could start with the LCD libs using one of the patches discussed above then port to our own if necessary. We should have a pow-wow with @MMcLaren and decide on the best way to do it.
Nice work!
Last edited:



