hardyboy_86
Junior Member level 2
I am using 16f877a , but problem is that it is not generating Clock,, i have changed many crystals (20MHZ) but no result,, i have checked the crystal frequency ( it was showing 193 KHZ) ,I have programmed it in C and have used NOWDT , and HS Mode in fuses, also i have programmed in PIC C Compiler and burnt it in University Lab Programmer,, i have connected pic in its minimum configuration and used Pull-Up resistor with MCLR,, I have noticed that 193 KHZ Frequency is remain present at the pin 13 and 14 instead when no crystal was connected to it..
and Pulsating 1.3V is present at all ports.
Please Help!!
I am Programing a line follower Robot, and My Program is
and Pulsating 1.3V is present at all ports.
Please Help!!
I am Programing a line follower Robot, and My Program is
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 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 #include <16F877a.h> #device adc=8 #fuses NOWDT,HS,NOPROTECT,NOLVP #use Delay(clock=20000000) #include <C:\Users\Faizan\Desktop\Autonomous Line Following Robot\Program\ROBO WORKSHOP\LCD DRIVER FILE.c> float v0,v1,v2,v3,v4; void rightside() { set_PWM1_duty(180); setup_timer_2(T2_div_by_16,127,1); set_PWM2_duty(0); setup_timer_2(T2_div_by_16,127,1); } void leftside() { set_PWM1_duty(0); setup_timer_2(T2_div_by_16,127,1); set_PWM2_duty(180); setup_timer_2(T2_div_by_16,127,1); } void straight() { set_PWM1_duty(180); setup_timer_2(T2_div_by_16,127,1); set_PWM2_duty(180); setup_timer_2(T2_div_by_16,127,1); } //----------------------------------------------------------------- void main(void) { setup_ccp1(CCP_PWM); setup_ccp2(CCP_PWM); setup_adc_ports(ALL_ANALOG); setup_adc(ADC_CLOCK_INTERNAL); lcd_init(); lcd_gotoxy(1,1); printf(lcd_putc,"START"); while(1) { //--------------Right Side------------------------------ set_adc_channel(1); delay_us(5); v1=read_adc(); v1=v1/51; if(v1<2 & v2>2 & v3>2 ) { rightside(); lcd_gotoxy(1,1); printf(lcd_putc,"RIGHT SIDE"); } //-------------------STRAIGHT---------------------------- set_adc_channel(2); delay_us(5); v2=read_adc(); v2=v2/51; if(v1>2 & v2<2 & v3>2 ) { straight(); lcd_gotoxy(1,1); printf(lcd_putc,"STRAIGHT"); } //-----------------LeftSide-------------------------------- set_adc_channel(3); delay_us(5); v3=read_adc(); v3=v3/51; if(v1>2 & v2>2 & v3<2 ) { leftside(); lcd_gotoxy(1,1); printf(lcd_putc,"LEFTSIDE"); } } }
Last edited by a moderator: