getting problem in code
Discussion in "PIC Microcontroller Discussion" started by kingrosekhan123 Oct 18, 2014.
Sat Oct 18 2014, 07:16 pm
i try this code but i dnt know where is the problem. i didnt understand the error.
please check that.
am using Hi-tech compiler along with MPLAB LDE 8.90
please check that.
am using Hi-tech compiler along with MPLAB LDE 8.90
#include<htc.h> __CONFIG(1, OSCSDIS & HSPLL); // Config word 2 __CONFIG(2, BORDIS & PWRTDIS & WDTDIS); // Config word 3 __CONFIG(3, CCP2RC1); // Config word 4 __CONFIG(4, LVPEN & STVREN); // Config word 5, 6 and 7 (protection configuration) __CONFIG(5, UNPROTECT); __CONFIG(6, WRTEN); __CONFIG(7, TRU); void main() { TRISB=0; PORTB=0X00; while(1) { test(a) __delay_ms(1000); switch(a) { case 0: a=0; break; case 1: a=1; break; case 2: a=2; break; } } } void test() { switch(int a) { case 1: PORTB=0x55; break; case 2: PORTB=0xAA; break; case 3: PORTB=0xFF; break; } }
Mon Oct 20 2014, 04:42 pm
I think you need to first check your code what exactly are you doing. Is it the first time you are writing C code? Where is variable a defined?
Tue Oct 21 2014, 11:38 pm
i didnt understand the error
where is error is that syntax error or something else
look like program is not complete
[ Edited Tue Oct 21 2014, 11:41 pm ]
Powered by e107 Forum System