Quantcast
Channel: Microcontrollers
Viewing all articles
Browse latest Browse all 4928

Timer0 problem with PIC16F1716

$
0
0
Hi all

I want to be able to create a 1ms delay using timer0 and have tried the below code.

Code (Text):
  1. #include <stdio.h>
  2. #include <pic16f1716.h>
  3. #include <xc.h>
  4. #include <stdlib.h>
  5. #pragma config FOSC = INTOSC
  6. #pragma config WDTE = OFF      
  7. #pragma config PWRTE = OFF
  8. #pragma config CLKOUTEN = ON  
  9.  
  10. void delay();
  11.  
  12. int main(int argc, char** argv)
  13. {
  14.    PORTB = LATB = ANSELB = TRISB = 0;
  15.    OSCCONbits.SCS = 0b10;
  16.    OSCCONbits.IRCF = 0b1111;
  17.    OPTION_REGbits.PSA = 0;
  18.    OPTION_REGbits.PS...
Timer0 problem with PIC16F1716

Viewing all articles
Browse latest Browse all 4928

Trending Articles