Mhadhu
Junior Member level 2
Whenever i dump a code in PIC board the code works good for certain instants but the code after few minutes doesn't work properly. Is there any problem with my code or with the development board?
my code is to turn on an led whenever a digital input is obtained.
CODE:
my code is to turn on an led whenever a digital input is obtained.
CODE:
Code C - [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 #include <p18f97j60.h> #include<delays.h> #include<usart.h> #pragma config XINST=OFF #pragma config WDT=OFF, FOSC2=ON, FOSC=HSPLL, ETHLED=OFF #pragma config WDTPS=256 void data(); int a; void main(void) { OSCTUNE = 0x40; TRISC = 1; TRISJ = 0; PORTJ = 0X00; TRISG = 0; PORTG = 0X00; ADCON1 = 0X0F; // dISABLING ANALOG INPUTS CMCON = 0X07; //disabling comparator while (1) { PORTG = 0X40; data(); } } void data() { a=PORTCbits.RC2; if (a==1) { LATJ =0x02;; } }
Last edited by a moderator: