Sx28ac external interrupts (port b)
I am trying to enable an external interrupt on port pin B7 on an SX28AC processor. I have tried several combinations of instructions but cannot "prime" the input for operation. I only require one interrupt and do not need to parse the pending interrupts because there will only be one. Any help would be appreciated.
Thanks,
Ron Smith
ron@rs485.com
513-874-4796
Thanks,
Ron Smith
ron@rs485.com
513-874-4796
Comments
This is not tested. It is just what I have in my head. I think you will want to do something like this:
You did not specify the edge detection you desired so you may need to change it from what I have shown. Also, be sure to clear WKPND_B every time in your ISR so that the next interrupt will be processed.
- Sparks
There is Material on this subject in the SX-Key Manual and examples, but they are in Assembly.
Bill
- Sparks
You can just use:
Sensor PIN RB.7 INPUT INTR_RISE
This will setup the registers for you. All you need is the interrupt routine.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Teacher: What is the difference between ignorance and apathy ?
Student: I don't know and I don't care
Teacher: Correct !
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.hittconsulting.com
·
Way to take all the complication out of it!
I like learning from other people’s posts.
- Sparks
mode $09
clr w
mov !RB, w
With the MODE register set to $09, the mov !RB, w actually swaps the contents of w and the wake-up pending register, so after this instruction, all bits in the register are cleared, and in w, the bit is set which caused the recent. It is important to execute this sequence somewhere inside the interrupt routine before returning. If you don't do it, the interrupt will be immediately re-triggered again, no matter if a new edge at the rb port was detected or not.
It is also a good idea to execute this code once before the WKPEN_B register is configured, just to make sure that no "glitches" have set bits in the WKPND_B register.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Greetings from Germany,
G
WKPND_B = 0
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Teacher: What is the difference between ignorance and apathy ?
Student: I don't know and I don't care
Teacher: Correct !
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.hittconsulting.com
·
I thought I needed to clear out "WKED_B" or mode $0a directly and that $09 was only worked once and only in sleep. Now I see there is a process that starts with $09 and is fine tuned with WKED_B & WKEN_B, thats correct right?.
I just need to start the program,·while the Hall Sensor that creates the·interrupt·isn't aligned to the magnet, right? or would it be better not to use the simplified SX/B version of declaring it at the PIN statement area and initialize it @ Start: portion of the program in a short SASM statement?
Thanks again
Sincerely
Bill M.
Post Edited (Capt. Quirk) : 8/6/2007 3:21:18 AM GMT