Hello I am interfacing my PIC16F874a microchip to a SP03 text to speech module (http://www.robotstorehk.com/SP03Tech.pdf), and I wrote my code using printf to output the commands to the chip. I have two problems: 1) it is not working, and 2) I would like to re-write it using "puts" to save code space on my PIC. I beleive I am calling my USART function correctly and my rs232 circuit it correct, so I beleive it is an error in my code. I also do not know how to use any type of "put" function ( I am just starting with C), so I was wondering if I can get help and suggestions on how to do this. I basically just have to output starting commands, then the ASCII I need to send, followed by 2 more commands. Thank you.
Code:
#include <pic.h>
#include <stdio.h>
#include "delay.h"
#include "usart.h"
void speech(char c)
{
int cnum;
cnum=c;
printf("%c", cnum);
DelayMs(1);
}
void Writespeech(const char* s)
{
while(*s)
speech(*s++);
}
main()
{
int i;
INTCON=0; // purpose of disabling the interrupts.
init_comms(); // set up the USART - settings defined in usart.h
printf("%c",0x80);
DelayMs(1);
printf("%c",0x00);
DelayMs(1);
printf("%c",0x04);
DelayMs(1);
printf("%c",0x02);
DelayMs(1);
Writespeech("How are You");
DelayMs(1);
printf("%c",0x1A);
DelayMs(1);
printf("%c",0x00);
DelayMs(1);
for(i=0;i<=35;i++)
{
DelayMs(200);
}
For(;;);
}