Hi
Please see the following post for an example of a periodic interrupt using a PIT rather than a 16 bit timer:
http://forums.freescale.com/freescale/board/message?board.id=16BITCOMM&message.id=3653Below is code which uses output compare 7 to generate an interrupt after a delay (msDelay ) which is used in the uTasker project. By comparing with what you have done so far you may find the reason why yours is not working correctly.
TSCR2 = (BUS_CLOCK_128 | TCRE); // Bus clock / 128
TIOS = (IOS7); // enable output compare
TC7_HI = TCNT_HI; // cause match to reset counter
TFLG1 = C7F; // Reset interrupt request flag
TC7_HI = msDelay * ((BUS_CLOCK / 128 / 1000)); // set ms unit compare rate (max is 167ms)
TTIE = C7I; // enable interrupt
TSCR1 = TEN; // enable timer
You may also like to take a look at the uTasker project for the NE64 (it is available as GNU, Codewarrior and IAR project set up). It includes everything required for matrix keyboards (you can set a define for the number or rows and columns and for which ports are used as input and scan output and the program does the rest) as well as an operating system, TCP/IP stack, LCD control etc. The uTasker simulator simulates the NE64 and these peripherals - you can simply add a Bitmap drawing of your keypad and it will immediately allow you to simulate with the grayhill keypad displayed on your PC (click on the keys with your mouse and see the scanning routine detect it, etc...).
Get all info from the web site below. The project is free for educational, hobby and other non-commercial use. It is used in a number of schools and universities for teaching purposes and is probably the best way to get up to speed with the NE64 - you can have your key pad working, which will for example send emails telling you which button has been pressed, all in an afternoon.
Best regards
Mark
www.uTasker.com