C code in EMIC TEXT TO SPEECH
hello:
am using emic text to speech module takibg the results from 16f877 pic
am using c lang, the problem is when it says the results it stops without completing the sentence
my statement to be clear: printf("say=temperature is %s degrees",x);
the word "degrees" will not appear·EMIC stops before·saying it..
i tried to separate printf but also same
·printf("say=temperature is %s",x);
printf("say=degrees");
also ot work..
wut should i do???
am using emic text to speech module takibg the results from 16f877 pic
am using c lang, the problem is when it says the results it stops without completing the sentence
my statement to be clear: printf("say=temperature is %s degrees",x);
the word "degrees" will not appear·EMIC stops before·saying it..
i tried to separate printf but also same
·printf("say=temperature is %s",x);
printf("say=degrees");
also ot work..
wut should i do???
Comments
Harrison
i used sprintf(x,s);
which s is the value i wana display so %S is correct...
the word "degrees" will not appear EMIC stops before saying it..
i tried to separate printf but also same
printf("say=temperature is %s",x);
printf("say=degrees");
And then...
[noparse][[/noparse]quote]i used sprintf(x,s);
which s is the value i wana display so %S is correct...
It will help us help you if you give us correct information to start with.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
void main() {
char sv1[noparse][[/noparse]8];
unsigned int8 v1;
setup_port_a( ALL_ANALOG );
setup_adc( ADC_CLOCK_INTERNAL );
set_adc_channel( 0 );
v1=(Read_ADC()/255)*100;
sprintf(sv1,"%03U\r\n",v1);
printf("say=temperature is %S degrees celsuis",sv1);
}
the module stops after saying the value!!!
Likely the \r\n characters in your sprintf statement are causing the behavior you describe.
Divide the problem in half: try the statement
printf("say=temperature is 100 degrees celsuis");
If that works, then the difficulty is with the sv1 variable, not the printf statement.
As advised, acually examining the serial string sent to the EMIC would be useful. Hyperterm is on every Windows PC. I prefer a product you can find on the web called Bray's Terminal for these things.
Daniel
sprintf(sv1,"%03U\r\n",v1);
sprintf(sv1,"%03U",v1);
it will say
printf("say=temperature is %S degrees celsuis",sv1);
????
sprintf(sv1,"%03U\r\n",v1);
is, among other things, appending a CR and a LF to the formatted value.
Perhaps you should review your C compiler's documentation of the escape sequences for character constants.
Have you tried the experiment of:
printf("say=temperature is 100 degrees celsuis");
If not, give it a chance; at least it will tell you if the problem lies with a longish string being sent to the emic, or if there is a problem somewhere before the printf() function.
Capture the output from your device and make sure it is what you, and especially the EMIC, expect.
Daniel