use of pin-change interrupt would be suitable I think.