This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Interrupt Sample code for C167CS

Hi all,

I am learning microprocessor programming.
I need some sample code for interrupt routine for C167CS.
It should be as simple as e.g. every second print time on display.

Thanks for help
regards
/M

Parents
  • I tried to understand TxI with the help of Timer/counter x Input selection table but couldn't understand well.

    Actually the time between two interrupts is set by T01CON and T0REL - read the whole section on CAPCOM timers in the microcontroller manual. With such simple approach and using timer 0 that time can be increased to about 2 seconds (at 25MHz CPU clock). To get 1 minute or 1 hour you will have to count the number of interrupts and react accordingly every 60 or 3600 (or whatever) interrupts.

Reply
  • I tried to understand TxI with the help of Timer/counter x Input selection table but couldn't understand well.

    Actually the time between two interrupts is set by T01CON and T0REL - read the whole section on CAPCOM timers in the microcontroller manual. With such simple approach and using timer 0 that time can be increased to about 2 seconds (at 25MHz CPU clock). To get 1 minute or 1 hour you will have to count the number of interrupts and react accordingly every 60 or 3600 (or whatever) interrupts.

Children
  • Hi all,

    Jon wrote:

    Well. ASC0 is NOT initialized to work when the C16x resets, so something initialized it. Are you using MON166 or another target monitor to download and run your code? If so, the monitor already initialized the serial port.

    I am using C167CS and there was a miss in my previous mail that I mentioned I use the same code for simulated and target environment which is not true.
    I noticed in my code later that I use one additinal "init_display()"statement in my code in the very beginning and it is where ASC0 is initialized (sorry for that miss),though it deals with P2 and not with P3(as in Hello world application).
    Now my simulated application work after I have added the code from Hello world application( thanks Jon for tips).

    Thanks to Mike for my next question regarding timing for interrupt routine.
    Thanks all of you for being so helpful.

    regards
    /M