I bet you're using a keyboard encoder, and haven't set up either mame or cpwizard to your physical layout.
Mame doesn't have any keyboard keys mapped to p2b5 & p2b6 by default. So you have to map your buttons correctly in mame, setup cpwizard correctly to see the remap, and presto, it'll work.
*Note: I haven't used cpwizard in long time, and even then it was just for testing.