john120
Banned
- Joined
- Aug 13, 2011
- Messages
- 257
- Helped
- 11
- Reputation
- 22
- Reaction score
- 10
- Trophy points
- 1,298
- Activity points
- 0
hello very body I am reading a frequency of a square wave and took decisions accordingly,but my coding are not operating can you plz help me to solve the issue;solution is appreciable:
see some of my codes below:
function with switch case:
float kagabo(void)
{
switch(period)
{
case 100: period=160;
printf(lcd_putc,"\150%%");
delay_ms(2000);
break;
case 13rintf(lcd_putc,"\f16%%");
delay_ms(2000);
break;
case 14rintf(lcd_putc,"\f15%%");
delay_ms(2000);
break;
case 15rintf(lcd_putc,"\f14%%");
delay_ms(2000);
break;
case 16: printf(lcd_putc,"\f13%%");
break;
case 17: printf(lcd_putc,"\f12%%");
delay_ms(2000);
break;
case 18: printf(lcd_putc,"\f19%%");
delay_ms(2000);
break;
case 19: period=10;
printf(lcd_putc,"\f200%%");
delay_ms(2000);
break;
}
}
CCP1 stups:
setup_ccp1(CCP_CAPTURE_RE|CCP_CAPTURE_DIV_16); // Configure CCP1 to capture rise
setup_timer_1(T1_INTERNAL|T1_DIV_BY_8); // Start timer 1
enable_interrupts(INT_CCP1); // Setup interrupt on risining edge
enable_interrupts(GLOBAL);
output_low(PIN_B4);
Switch button which has to be activated for reading values in kagabo function from switch case statement:
if(input(PIN_C4)==0)
{
//kagaba();
tempdisplay();
kagabo();
if (input(PIN_C4)==0)//&&(period<100))
{
delay_ms(100);
printf(lcd_putc,"\f%3.0f",voltsf);
delay_ms(1200);
printf(lcd_putc "\12%%");
delay_ms(1000);
}
}
see some of my codes below:
function with switch case:
float kagabo(void)
{
switch(period)
{
case 100: period=160;
printf(lcd_putc,"\150%%");
delay_ms(2000);
break;
case 13rintf(lcd_putc,"\f16%%");
delay_ms(2000);
break;
case 14rintf(lcd_putc,"\f15%%");
delay_ms(2000);
break;
case 15rintf(lcd_putc,"\f14%%");
delay_ms(2000);
break;
case 16: printf(lcd_putc,"\f13%%");
break;
case 17: printf(lcd_putc,"\f12%%");
delay_ms(2000);
break;
case 18: printf(lcd_putc,"\f19%%");
delay_ms(2000);
break;
case 19: period=10;
printf(lcd_putc,"\f200%%");
delay_ms(2000);
break;
}
}
CCP1 stups:
setup_ccp1(CCP_CAPTURE_RE|CCP_CAPTURE_DIV_16); // Configure CCP1 to capture rise
setup_timer_1(T1_INTERNAL|T1_DIV_BY_8); // Start timer 1
enable_interrupts(INT_CCP1); // Setup interrupt on risining edge
enable_interrupts(GLOBAL);
output_low(PIN_B4);
Switch button which has to be activated for reading values in kagabo function from switch case statement:
if(input(PIN_C4)==0)
{
//kagaba();
tempdisplay();
kagabo();
if (input(PIN_C4)==0)//&&(period<100))
{
delay_ms(100);
printf(lcd_putc,"\f%3.0f",voltsf);
delay_ms(1200);
printf(lcd_putc "\12%%");
delay_ms(1000);
}
}