[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions_content.php on line 1014: Undefined array key 3
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions_content.php on line 1014: Undefined array key 3
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions_content.php on line 1014: Undefined array key 3
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions_content.php on line 1014: Undefined array key 3
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4130: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3009)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4130: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3009)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4130: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3009)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4130: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3009)
Controlling your World the Easy Way • SERINP$ and Text-to-Speech module in my project...???
Page 1 of 1

SERINP$ and Text-to-Speech module in my project...???

Posted: Sat Jul 13, 2013 4:40 pm
by RBSe
Greetings All,

For a project I'm working on I purchased an Emic 2 Text-to-Speech module that takes a 9600 baud serial text string and converts it to speech, very nicely i might add. ((( Listen ))) ( Manual )

My problem is I don't understand how to use SERINP$ to get a response from the text-to-speech module.
What i would like to have is a small routine that would allow me to enter a text string and get a response back from the module using control basic.
According to what i read in the manual this shoud work, but it doesn't.
Any help is greatly appreciated...

Code: Select all

'talk test

PINMODE 36, OUT
PINMODE 37, IN
SERINIT 1,9600,8,1,0 ' port 1, 9600 bps, 8 data bits, 1 stop bit, no parity
CRLF$ = CHR$(13) + CHR$(10) ' for CR & LF

TXtalk$ = "testing."

SOUT$ = "s" + TXtalk$ + CRLF$ ' combine "s", text & CRLF
x = SEROUT(1, SOUT$) ' Sends SOUT$ to serial port 1 (pin 36)
END
:?:
Robert
.

Re: SERINP$ and Text-to-Speech module in my project...???

Posted: Sun Jul 14, 2013 7:34 am
by Andries Pretorius
Hi Robert

Unfortunately I don't have access to an Emic 2 module and I therefore am unable to test your code and advise.

But browsing through the Emic 2 documentation and programs, I read the following:
when the Emic 2 powers on, it takes about 3 seconds for it to successfully
intialize. It then sends a ":" character to indicate it's ready to accept
commands. If the Emic 2 is already initialized, a CR will also cause it
to send a ":"
All the example programs on the Parallax website for the Emic 2 include routines checking that the module has sent a ":" , before proceeding to send the data string for text to speech conversion. I don't see such a routine in your program.

In the Emic 2 manual, the following is Indicated:
Status Indicator
A visual indication of Emic 2’s operating state is given with the on-board light-emitting diode (LED):
1. Green: Idle state. Waiting for a valid command to be sent by the host.
2. Red: Active state. For example, during a text-to-speech conversion.
3. Orange (Solid): Initialization state. Occurs on power-up only. Emic 2 takes approximately three
seconds to properly initialize on power-up before it is ready to receive commands.
4. Orange (Blinking): Error state. Emic 2 has malfunctioned due to an on-board communication
error. If a power cycle of Emic 2 does not remedy the situation, please contact Parallax technical
support for further assistance.
A stable green LED on the Emic 2 module therefore will indicate that the initialization process has been completed and that it is waiting for the master (EZSBC1) to send the text to speech data.

According to my guess, you must either include a routine to check that the module has sent a ":" before sending the text data to the module, or wait for the LED on the module to be a stable green before sending.

Just a few thoughts.

Best regards

Andries

Re: SERINP$ and Text-to-Speech module in my project...???

Posted: Sun Jul 14, 2013 10:40 am
by RBSe
Good morning Andries,

My concern is not the Emic 2 as from what i read it is doing what it suppose to do, the 3 second boot only happens on power up.
The returned ":" is not critical for simply sending the text-to-speech module a string to convert, it's just a response to trigger events in my code.
The red LED is on during conversion and i have yet to see that happen, so the serial comm is not working.
I'm convinced once i understand the syntax and use of the control basic commands "SERINP$" & "SEROUT"i will be successful.
Again, the EzSBC1 manual is not clear on how to use the SERINP$ & SEROUT commands.
The example of the SERINIT command is incorrect in the manual also.
Your help to clarify this is requested.

Thanks for your help Andries,

Robert
.

Re: SERINP$ and Text-to-Speech module in my project...???

Posted: Sun Jul 14, 2013 11:53 am
by Andries Pretorius
Thanks for coming back Robert.

In my neck of the woods it is already late Sunday evening and it's nearly bedtime for me.

I appreciate that reception of the ":" character is not critical to initiate a conversion process, as long as the initialization process is complete and the green LED is stable.

Because I have exclusively used I2C, SPI, SHIFTIN/SHIFTOUT for serial communication with the EZSBC up to now, I have not yet had any experience with SERIN$/SEROUT$, and its syntax, on the EZSBC at all and I am not up to date on the correct syntax.

But I will have a look in the morning and see if I can come up with something that might be helpful .

Have a good day!!

Andries

Re: SERINP$ and Text-to-Speech module in my project...???

Posted: Sun Jul 14, 2013 12:02 pm
by RBSe
Thanks for getting back to me so quickly Andries.
I appreciate your help in assisting me, and your great communications.
I look forward to what you discover...
Sleep well,

Robert
.

Re: SERINP$ and Text-to-Speech module in my project...???

Posted: Sun Jul 14, 2013 9:42 pm
by Andries Pretorius
Good mornig Robert

I have looked at the Control Basic SERINIT, SERINP$ and SEROUT commands and functions, and also studied the example Basic Stamp and Arduino programs on the Parallax website. To me it seems that your program should work, provided all the hardware connections are correct.

Firstly, I tested the syntax of SERINT and SEROUT with the following program:

Code: Select all

SERINIT 0,57600,8,1,0 ' port 0 (USB port), 57600 bps (As Configured), 8 data bits, 1 stop bit, no parity
CR$ = CHR$(13) 'Carrier Return
LF$ = CHR$(10) 'Line feed

x = SEROUT(0, "S")             ' Send the Command Code
x = SEROUT(0, "The Quick Brown Fox Jumps over the Lazy Dog") ' Send Text String
x = SEROUT(0, CHR$(13)) ' Send CR

END
This program simply sends The Command Code, the text string and a CR to the Tera Term Console via the on-board USB - Serial interface. In line with the example programs I have sent the Command Code, the text string and the CR seperately, although I don't believe that combining all three into one text string (as you have done) should make any difference.

When I run the program, I get the following display in the Tera Term console:
Control BASIC v0.xx
R-Run S-Step L-List E-Edit C-Configure B-Bank D-Download K-Reset T-Time & Date
Start program
SThe Quick Brown Fox Jumps over the Lazy Dog
Program Ended.
Which shows that the syntax used for SERINIT and SEROUT is fine.

I believe that the following little program should be adequate to coax the desired output from the module, unless I'm missing something:

Code: Select all

PINMODE 36, OUT
PINMODE 37, IN
SERINIT 1,9600,8,1,0 ' port 1, 9600 bps, 8 data bits, 1 stop bit, no parity
CR$ = CHR$(13) 'Carrier Return
LF$ = CHR$(10) 'Line feed

x = SEROUT(1, "S")      ' Send the Command Code
x = SEROUT(1, "The Quick Brown Fox Jumps over the Lazy Dog") ' Send Text String
x = SEROUT(1, CHR$(13)) ' Send CR

END
However, the prudent programmer will include a programmatic check for the ":" character to ensure that the module is ready to receive a command.
Such a program may look like this:

Code: Select all

PINMODE 36, OUT
PINMODE 37, IN

SERINIT 1,9600,8,1,0 ' port 1, 9600 bps, 8 data bits, 1 stop bit, no parity
CR$ = CHR$(13) 'Carrier Return
LF$ = CHR$(10) 'Line feed

REPEAT
        x=SEROUT(1, CHR$(13))                   ' Send a CR to Emic and
        x$= SERINP$(1, 1,ASCII(":"),50000)   ' check if a ":" is returned
                                                               ' to show Emic is ready to receive
UNTIL x$ = ":"                                           ' a command

' Send command, text string and CR to module.
x = SEROUT(1, "S")              ' Send the Command Code
x = SEROUT(1, "The Quick Brown Fox Jumps over the Lazy Dog")
x = SEROUT(1, CHR$(13)) ' Send CR
END
As I said before, I don't have access to an EMIC2 module, so there is no way that I can test the integrity of my code snippets.

Have a great evening!!!

Regards

Andries

Re: SERINP$ and Text-to-Speech module in my project...???

Posted: Mon Jul 15, 2013 11:45 am
by RBSe
Hi Andries,

You are so helpful, i can't thank you enough for your assistance.
Your code snippet works fine... :D
What i noticed is that i had inserted a LF, AND a CR where only 1 is required, i thought it was both.
The fact that you separated the SEROUT commands i think made a difference too.
The point is i'm a very happy man thanks to your help Andries.

On another note, do you program for a living, if not may i ask what you do, if i'm not intruding...???
I have a specific project i'm working on and i'd like your advice on it...
Contact me here via this email: ezsbc1@rbse.us
I look forward to hearing from you.

Thanks again Andries,
Enjoy Your Day!

Robert
.

Re: SERINP$ and Text-to-Speech module in my project...???

Posted: Mon Jul 15, 2013 10:36 pm
by Andries Pretorius
Good morning Robert.

It is only a pleasure to have been of assistance!! There are few things as gratifying as a project, over which you have toiled over for hours, suddenly springing to life and doing what it is supposed to.

No Robert, I don't do programming for a living. In fact, I am now retired after a 40 year non-technical career, but being very inquisitive, I have a keen interest in everything electronic and computer related, among other things. Trying to program embedded controllers is just one of the ways I keep my brain occupied and alive during retirement.

As for now, I'm off on my weekly hike in the local botanical garden. I will contact you by e-mail when I'm back.

Best regards

Andries