Guest pkstone Posted August 23, 2003 Report Share Posted August 23, 2003 Hi Thorsten,I've been working on the Axe-Thing project I mentioned months ago - I asked you a question about scanning some custom switches from MIOS and you pointed me at USER_SR_Service_Finish. I have a few more specific questions now that my custom design is almost finished, if you don't mind.How much time would you estimate I have in a custom function called by the USER_SR_Service_Finish hook? Time enough to scan 32 switches addressed by a couple of 4-bit counters? Can I manipulate RC0-3 directly in this function to control the counters? Can I read J14 directly at each iteration of this 32-switch scan? (I'm trying to keep SID pins available, but don't need any MF stuff).(I have to use this method of scanning due to the design of the Axe-Thing's neck switches. I'll figure out a way to show you this part of my circuit if this question makes no sense).In general, I'm curious about the timing of your background analog/digital scanning and update thread, and the impact the scanning of another 32 inputs in a custom USER_SR_Service_Finish routine wouldhave on other MIOS functions. Thanks!Phil Quote Link to comment Share on other sites More sharing options...
TK. Posted August 23, 2003 Report Share Posted August 23, 2003 Hi Phil,you've enough time to scan all switches in the USER_SR_Service_Finish hook - for comparison: this hook is also used by MIOS to handle with up to 64 rotary encoders, it takes 400 uS in worst case and loads the CPU by 40% (since the hook is called every milisecond)RC0-3 can be controlled by the ISR. They are also controlled by the AIN driver, but only when the multiplexers are enabledJ14 is controlled by the SRIO driver, by setting bit "TRISD, 4" you can use it as input pin w/o conflicts.Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
Guest pkstone Posted August 25, 2003 Report Share Posted August 25, 2003 Thanks, Thorsten. I'm continually impressed and pleased by how versatile MIOS is. One question...RC0-3 can be controlled by the ISR. They are also controlled by the AIN driver, but only when the multiplexers are enabledI'm sorry, what's the ISR? It looks like a PIC register, but I don't see it in my PIC docs - or the MIOS docs. (I'm probably missing something obvious).Thanks, Phil Quote Link to comment Share on other sites More sharing options...
TK. Posted August 25, 2003 Report Share Posted August 25, 2003 Hi Phil,ISR means Interrupt service routine - a function which interrupts your mainprogram and therefore require some special care (see function description of USER_SR_Service_Finish)Btw.: more detailed informations about dedicated registers for mainprograms/ISR, and about shared registers:Following registers are dedicated for mainprograms, they will not be automatically saved before an interrupt call: TMP1...TMP5 and FSR0Following registers are dedicated for interrupt service routines, they shouldn't be used by mainprograms:IRQ_TMP1...IRQ_TMP5 and FSR2Following registers are stored automatically by the interrupt handler before a hook will be called, and they will be restored before the interrupt will be finished - therefore they can be used by the mainprogram and by ISRs without conflicts:FSR1, TBLPTRL, TBLPTRH, TABLAT, MIOS_PARAMETER1...MIOS_PARAMETER3Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
stryd_one Posted July 13, 2006 Report Share Posted July 13, 2006 Since MIOS V1.8, FSR2 is saved as well, and FSR0 is saved by the C wrapperMost of the older docs are inconsistent in the meantime, I know... biggest problem is, that all ISR related comments in the main.asm file are not correct anymore... just ignore itBest Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.