array in ccs c compiler with pic16f877A

Status
Not open for further replies.

john120

Banned
Joined
Aug 13, 2011
Messages
257
Helped
11
Reputation
22
Reaction score
10
Trophy points
1,298
Activity points
0
Hello every body,can you plz help me to handle the following issue;I want to display on the lcd 7.0%; 7.1%; 7.2%............. depending on the value read on the T1CKI of pic16f877A that number read is compared to two numbers of two different arrays and then those 7.0% ; 7.1% ...are printed:
see my codes:
#include <16F877A.h>
#DEVICE ADC=10
#fuses HS,NOWDT,NOPROTECT,NOLVP,NOBROWNOUT
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)
#include "lcd.c"
//#define ARRAY_SIZE 7
#define ARRAY_SIZE 9


int search,i,vals;
float value1,value;
float l;

float FindIndex();

float FindIndex(int *vals, int size, int search)
//int *vals, int size, int search

{
const float k[]={100,121,125,156.3,180,190.2,200};
const float j[]={605.2,608,780,790,800,800.5,900};
int i;
for ( i =0; i <size ; i++)
if((value1<= j)&&(k<=value1))
{
l=(0.1*i)+7;

lcd_gotoxy(11,1);
printf(lcd_putc,"\f%2.1f",l);
printf(lcd_putc,"\%%");
delay_ms(1500);
//return l;
}
}

void main(void)
{
set_tris_c(0xff);
set_tris_b(0x00);
lcd_init();
delay_us(200);

while(1)
{
set_timer1(0);
setup_timer_1(t1_external | T1_DIV_BY_1);
delay_ms(1000);
setup_timer_1(T1_DISABLED);
value=get_timer1();

value1=value;

float FindIndex(k,size,i);
printf(lcd_putc,"\f%2.1f",l);
printf(lcd_putc,"\%%");
delay_ms(2500);
}
}

Help me plz
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…