Kubilay
Newbie level 4
I'm using loops to check if button is 1 or 0. this process has to continue all time. but watchdog resets evrey 2 seconds. how can i deal with ? hıow can i disable it? or any otter suggestion
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Which Compiler are you using ? If you are using MPLAB then you can set the config bits in IDE which will be easier or you can use the #pragma derective in code and turn OFF WDT. You have to mention which PIC you are using.
__CONFIG(FOSC_HS & WDTE_OFF & PWRTE_ON & CP_OFF & BOREN_ON & LVP_OFF & CPD_OFF & DEBUG_OFF);
//
// Configuration mask definitions
//
// Config Register: CONFIG
#define CONFIG 0x2007
// Oscillator Selection bits
// RC oscillator
#define FOSC_EXTRC 0xFFFF
// HS oscillator
#define FOSC_HS 0xFFFE
// XT oscillator
#define FOSC_XT 0xFFFD
// LP oscillator
#define FOSC_LP 0xFFFC
// Watchdog Timer
// WDT enabled
#define WDTE_ON 0xFFFF
// WDT disabled
#define WDTE_OFF 0xFFFB
// Power-up Timer Enable bit
// Power-up Timer is disabled
#define PWRTE_OFF 0xFFFF
// Power-up Timer is enabled
#define PWRTE_ON 0xFFF7
// Code Protection bit
// Code protection disabled
#define CP_OFF 0xFFFF
// All program memory is code protected
#define CP_ON 0xC00F
// CONFIG
#pragma config FOSC = HS // Oscillator Selection bits (HS oscillator)
#pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled)
#pragma config PWRTE = ON // Power-up Timer Enable bit (PWRT enabled)
#pragma config BOREN = ON // Brown-out Reset Enable bit (BOR enabled)
#pragma config LVP = OFF // Low-Voltage (Single-Supply) In-Circuit Serial Programming Enable bit (RB3 is digital I/O, HV on MCLR must be used for programming)
#pragma config CPD = OFF // Data EEPROM Memory Code Protection bit (Data EEPROM code protection off)
#pragma config WRT = OFF // Flash Program Memory Write Enable bits (Write protection off; all program memory may be written to by EECON control)
#pragma config CP = OFF // Flash Program Memory Code Protection bit (Code protection off)
Code ASM - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 ;********************************************************************** ; * ; This file is a basic code template for assembly code generation * ; on the PIC16F84A. This file contains the basic code * ; building blocks to build upon. * ; * ; Refer to the MPASM User's Guide for additional information on * ; features of the assembler (Document DS33014). * ; * ; Refer to the respective PIC data sheet for additional * ; information on the instruction set. * ; * ;********************************************************************** ; * ; Filename: xxx.asm * ; Date: * ; File Version: * ; * ; Author: * ; Company: * ; * ; * ;********************************************************************** ; * ; Files required: P16F84A.INC * ; * ; * ; * ;********************************************************************** ; * ; Notes: * ; * ; * ; * ; * ;********************************************************************** list p=16F84A ; list directive to define processor #include <p16F84a.inc> ; processor specific variable definitions __CONFIG _CP_OFF & _WDT_ON & _PWRTE_ON & _RC_OSC ; '__CONFIG' directive is used to embed configuration data within .asm file. ; The lables following the directive are located in the respective .inc file. ; See respective data sheet for additional information on configuration word. ;***** VARIABLE DEFINITIONS w_temp EQU 0x0C ; variable used for context saving status_temp EQU 0x0D ; variable used for context saving ;********************************************************************** RESET_VECTOR CODE 0x0000 ; processor reset vector goto start ; go to beginning of program ISR CODE 0x0004 ; interrupt vector location Interrupt: movwf w_temp ; save off current W register contents movf STATUS,w ; move status register into W register movwf status_temp ; save off contents of STATUS register ; Place ISR Here movf status_temp,w ; retrieve copy of STATUS register movwf STATUS ; restore pre-isr STATUS register contents swapf w_temp,f swapf w_temp,w ; restore pre-isr W register contents retfie ; return from interrupt MAIN_PROGRAM CODE start: LIST P=PIC16F84A __CONFIG_XT_OSC STATUS EQU 0X03 PORTA EQU 0X05 PORTB EQU 0X06 TRISA EQU 0X85 TRISB EQU 0X86 SAYAC EQU 0X0D TMR0 EQU 0X01 BSF STATUS,5 BSF TRISB,0 CLRF TRISA BCF STATUS,5 CLRF SAYAC CLRF PORTA GENEL BTFSS PORTB,0 GOTO GENEL CLRF TMR0 INCF SAYAC,F MOVF SAYAC,W MOVWF PORTA GOTO TEST TEST BTFSS PORTB,0 GOTO GENEL GOTO TEST goto $ END
__CONFIG _FOSC_EXTRC & [COLOR="#FF0000"]_WDTE_OFF[/COLOR] & _PWRTE_OFF & _CP_OFF