Quick Question: Periodic Interrupts AND pin-triggered interrupt?
Unfortunately, I don't have my dev board with me, and I need to select a chip for a layout.
for a project, I need to do a PWM output, and I need to monitor a portB pin to trigger an interrupt.
Can I use the SX-28 and set the Interrupt to be periodic (to run a pwm) *AND* still trigger an interrupt from the PortB Pins (to execute other interrupt code)?...or do I need to use the SX-48 and have the·PWM running in a different section?
Sorry for asking.· I wish I had my chips in front of me to find out myself, but I don't.· [noparse]:([/noparse]
·
for a project, I need to do a PWM output, and I need to monitor a portB pin to trigger an interrupt.
Can I use the SX-28 and set the Interrupt to be periodic (to run a pwm) *AND* still trigger an interrupt from the PortB Pins (to execute other interrupt code)?...or do I need to use the SX-48 and have the·PWM running in a different section?
Sorry for asking.· I wish I had my chips in front of me to find out myself, but I don't.· [noparse]:([/noparse]
·

Comments
-Phil
Addendum: Here's the ISR structure I use to accommodate both kinds of interrupts (assumes turbo mode and 1:4 RTCC prescaler):
ORG isrPG ISR MOV W,#2 ;If RTCC low enough, then must be timer interrupt... MOV W,RTCC-W BANK sysREGS JNC :RTCISR ;Yup, must be timer interrupt. ; MOV RTCCQ,W ;Nope, save current value minus 2 for later check. ; MODE M_WKPND ;Access port B pending registers... (M IS NOT RESTORED!!!) MOV !RB,#%00000000 AND W,#SCLKM ;The interrupt we're interested in. ; JZ :CKRTC ;If no serial clock interrupt, we're done here. ;------------------------------------------------------------------------------------------- ; Code for pin interrupt goes here (synchronous serial clock, in this case). ;------------------------------------------------------------------------------------------- :CKRTC MOV W,#3 ;Will a timer rollover occur before the RETI? ADD W,RTCC JC :CKRTC ; Yes. Wait for it. (No carry when RTCC hits zero.) MOV W,#2 ;Look at ISR entry value of RTCC. ADD W,RTCCQ MOV W,RTCC-W ;Is the current value lower? SNC ; Yes: A rollover has occured. RETI ; No: No rollover. Just get out. :RTCISR ;------------------------------------------------------------------------------------------- ; Code for timer interrupt goes here. ;------------------------------------------------------------------------------------------- :RTCEND MOV W,#RTCON ;Add constant to RTCC on way out for proper rate... RETIWPost Edited (Phil Pilgrim (PhiPi)) : 9/18/2008 9:37:54 PM GMT
I forgot to note: my code example is for turbo mode with a 1:4 prescaler on RTCC. Other settings will entail changing some constants in the code.
-Phil