Page 53 - DEC40053 Ebook_Timer
P. 53

TEST


                               Y O U R S E L F











             Q1.  Write  a  C  program  to  toggle  all  the  bits  of


             PORTB continuously with 1ms delay. Use Timer0,


             16-bit mode, no prescaler options to generate the


             delay. (Assume XTAL=20MHz)












             Q2. Write a C program to toggle only the PORTB.4

             bit  continuously  every  50ms.  Use  Timer0,  16-bit


             mode  and  the  1:4  prescaler  to  create  the  delay.


             (Assume XTAL = 20MHz)











           Q3. Write a C18 program to toggle only the PORTC3


           bits continuously with some delay. Use Timer0, 16-

           bit mode, and no prescaler options to generate the


           delay  (square  wave  of  50%  duty  cycle).  Set  the


           register TMR0H = 35H and TMR0L = 00H.








                                                         -44-
   48   49   50   51   52   53   54   55   56   57   58