trigger KBI when press down or pull up button - MC1321x and Codewarrior6.1.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

trigger KBI when press down or pull up button - MC1321x and Codewarrior6.1.

1,108 Views
Beijing2008
Contributor I
Dear freescale expert:
 
  I'm using MC1321x and Codewarrior6.1.

  On my PCB,there is a button that connect with PTAx port.Enable the KBI and add interrupt routine KBI_IRQ() function in C language code.

  Now,if I pressed down the button ,then KBI_IRQ() was triggered.
  But I hope that the KBI_IRQ() will be called,whether the button was pressed down or pulled up.
  How to implement it? How to config the register?
 
 
Thanks for your reply.
 
Best regards,
Charly
 
 
 
Added p/n to subject.


Message Edited by NLFSJ on 2008-07-18 09:11 AM
Labels (1)
0 Kudos
1 Reply

244 Views
bigmac
Specialist III
Hello Charly,
 
The inputs PTA4 through to PTA7 are capable of having their triggering edge selected for either negative or positive transitions.  You do not say which pin you are attempting to use.  However, you will need to use an external pullup resistor, and disable the internal pull device.  This is because, when the triggering edge polarity is changed from negative to positive, the internal pullup becomes a pulldown.
 
Your code will also need to allow a debounce timeout period (perhaps 20 to 50ms) following each switch transition, and before changing the trigger edge, otherwise the results will be very confusing in the event of contact bounce occurring.
 
Regards,
Mac
 
0 Kudos