Hello Dave,
I changed the calls to subs and still nothing runs in main while the interrupt is enabled. I can't even get a simple portb.0 set / reset to give me anything on the I/O.
Nick
Hello Dave,
I changed the calls to subs and still nothing runs in main while the interrupt is enabled. I can't even get a simple portb.0 set / reset to give me anything on the I/O.
Nick
Last edited by Macgman2000; - 19th October 2011 at 19:41.
CALL or GOSUB doesn't make any difference.
But you cannot run Basic Language statements in an Assembly Language interrupt.
Re-use of PBP's system variables will corrupt the main programs flow.
If you want to use Basic statements in ASM interrupts, you need to either use ON INTERRUPT or DT_INTS.
DT
Darrel,
How would I structure my code using your interrupt include file? I want to accomplish the following:
1). update 4 servo's with a refresh rate of 16ms. Pulse width on the servos range between 1 ~ 2 ms based on reading 5 ADC channels.
Best Regards,
Nick
I found this in the new PBP3 Reference Manual on page 264
"Whenever a block of inline Assembly Language is entered, PBP sets the bank-select register to BANK0".
So, why does Nick have to manually select BANK0 using BANKSEL T1CON? It's true that all of the registers in his ISR are in BANK0. And yes, all his A to D registers are in BANK1, but why isn't PBP doing the switch to BANK0?
Good catch! Looks like I updated pbp but not my brain. Yet another good reason to upgrade
Darrel are you referring to the pauseus? If so are the rest non system variable things?
Last edited by cncmachineguy; - 20th October 2011 at 04:26.
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
if adcval < 4 and adcval2 < 4 and adcval3 <4 and adcval4 < 4 and adcval5 < 4 then
That is a compound if statement, meaning there is more than one condition to be tested.
That requires it to store intermediate results in T? temp variables, which are part of PBP's system vaiables.
The compares themselves will call a library function that uses R? system vars.
PAUSEUS will overwrite the R0 system variable.
PAUSE would use R0 and R1.
It's very difficult to know which statements will interfere with which system variables.
So it's best not to tempt fate.
Last edited by Darrel Taylor; - 20th October 2011 at 04:55.
DT
Thanks Darrel
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
I guess the structure would look a lot like the examples found here ... http://www.darreltaylor.com/DT_INTS-14/hello.html
Look at the Hello World, Blinky Light, Elapsed Timer and then how they are combined 1-3.
DT
Bookmarks