john120
Banned
- Joined
- Aug 13, 2011
- Messages
- 257
- Helped
- 11
- Reputation
- 22
- Reaction score
- 10
- Trophy points
- 1,298
- Activity points
- 0
hi here you go..........
I think this is all and you have write function for lcd........Code:main() { float value; int i,size; char str[16]; lcd init(); size = (sizeof(k)/sizeof(float)); while(1) { value = frequency(); // Read frequency for(i=0; i<size; i++) { if( (k[i] <= value) && (j[i] >= value) ) // find the match (k is the low value and j is the big value boundries ) break; } if(i != size) // some value match found (if no value matches i will reach size and no need to print wrong info) { sprintf(str,"index = %d",i); put_lcd((void*)str); } } }
I belive this will work for sure..
- - - Updated - - -
don forget to include stdio.h (for sprintf)..
Hello Sir,thanks for the codes you proposed unfortunately I did not write any additional lcd function because I am not able;I am using the ordinary file of the Lcd coming with ccs c setup;so I am having problem when compiling the codes you give;I am having error on put_lcd((void*)str); line can you please help me to print that using the normal lcd command:printf(lcd_putc," ");
Are those codes display the index when the value reads is between two numbers of the same index from two differents arrays,J and K.
Thanks and waiting for the positive reply.
- - - Updated - - -
Hello Sir,thanks for the codes you proposed unfortunately I did not write any additional lcd function because I am not able;I am using the ordinary file of the Lcd coming with ccs c setup;so I am having problem when compiling the codes you give;I am having error on put_lcd((void*)str); line can you please help me to print that using the normal lcd commandrintf(lcd_putc," ");hi here you go..........
I think this is all and you have write function for lcd........Code:main() { float value; int i,size; char str[16]; lcd init(); size = (sizeof(k)/sizeof(float)); while(1) { value = frequency(); // Read frequency for(i=0; i<size; i++) { if( (k[i] <= value) && (j[i] >= value) ) // find the match (k is the low value and j is the big value boundries ) break; } if(i != size) // some value match found (if no value matches i will reach size and no need to print wrong info) { sprintf(str,"index = %d",i); put_lcd((void*)str); } } }
I belive this will work for sure..
- - - Updated - - -
don forget to include stdio.h (for sprintf)..
Are those codes display the index when the value reads is between two numbers of the same index from two differents arrays,J and K.
Thanks and waiting for the positive reply.
- - - Updated - - -
Did you try the second code I gave?
Yeah ,I did but no result ,can you add the instructions for printing on the lcd then I try all of them;just the combination of the previous codes and the instructions for printing on the lcd.
Thanks