#define UBRR_BAUD_9600 ((F_CPU/(16*BAUD_LOW))-1)
BAUD_LOW stimmt sicher nicht, oder?
#define UBRR_BAUD_9600 ((F_CPU/(16*BAUD_LOW))-1)
BAUD_LOW stimmt sicher nicht, oder?
![]()
Atmel’s products are not intended, authorized, or warranted for use
as components in applications intended to support or sustain life!
Habs mal so reinkopiert aber jetzt seh ich es auch erst. Kannst du mir da bitte weiter helfen? bin mit so was doch leicht überfordert. Bin eher noch ein Einsteiger in der Materie. Wie ist des mit dem writeChar kann man denn TTS IC so ansteuern?
MFG
Roandl
Hallo
Da BAUD_LOW in der Library des RP6 definiert wird kommt beim Kompilieren keine Fehlermeldung, aber der RP6 kommuniziert dann nicht mit 9600 sondern mit 38400 Baud. Richtiger wäre es so:
(ungetestet)Code:#define BAUD_9600 9600 // 9600 Baud #define UBRR_BAUD_9600 ((F_CPU/(16*BAUD_9600))-1) UBRRH = UBRR_BAUD_9600 >> 8; // Baudrate ist 9600 UBRRL = (uint8_t) UBRR_BAUD_9600;
Mit writeChar() kannst du einzelne Zeichen (=Buchstaben) senden, mit writeSting() ist sogar ein ganzes Wort möglich:
writeString("Hello");
Gruß
mic
![]()
Atmel’s products are not intended, authorized, or warranted for use
as components in applications intended to support or sustain life!
Servus
Hab jetzt den Befehl umgeschrieben aber funktionieren tuts immer noch nicht. Hab mir mal des Datasheet von dem TTS256 durchgelesen und da bin ich auf was gestoßen.
Operation:
Communications parameters of the serial port are set to 9600 Baud N81. The host
processors send up to 128 character the TTS256’s serial port on pin 18 (RX).
Text is spoken when the TTS256 receives a new line character (0x0A)
or the maximum number of 128 characters has been received.
Wie soll ich des deiner Meinung nach als Befehl schreiben vielleicht so?
writeString("Hello");
writeChar(0x0A);
Danke für die Antwort.
Das sollte so funktionieren. Oder du hängst das Linefeed als Steuerzeichen direkt an die Zeichenkette:
writeString("Hello\n");
![]()
Atmel’s products are not intended, authorized, or warranted for use
as components in applications intended to support or sustain life!
Komm nicht dahinter warum es nicht geht. Gibt es ne möglichkeit zu überprüfen ob der TTS256 überhaupt daten bekommt?
Hab mal ein Beispielprogramm gefunden ist aber für arduino.
Werd aber nicht schlau drauß.Code:TTS256 Speakjet Interface Chip Demo Sketch Written by Ryan Owens SparkFun Electronics Uses the Voice Box Shield and the TTS256 Text To Speech Processor to turn text input on an Arduino to a voice output. A speaker can be plugged directly into the SPK+ and - pins on the shield. See the tutorial for more information on how to connect the TTS256 to the Voice Box Shield. SparkFun Product Links: TTS256: Arduino Duemilanove: Voicebox Shield: Speaker: */ //Soft serial library used to send serial commands on pin 2 instead of regular serial pin. #include <SoftwareSerial.h> //Define the Pin Numbers for the sketch. #define E0 5 #define E1 6 #define E2 7 #define E3 8 #define E4 9 #define E5 10 #define E6 11 #define E7 12 #define RDY 13 #define RES 3 #define SPK 4 #define txPin 2 //Create a SoftSerial Objet #include "WProgram.h" void setup(); void loop(); void getMessage(char * message); SoftwareSerial speakjet = SoftwareSerial(0, txPin); //Create a message buffer to hold the ascii message to be converted to sound char message[128]=""; void setup() { //Configure the pins for the SpeakJet module pinMode(txPin, OUTPUT); pinMode(SPK, INPUT); //Set up a serial port to talk from Arduino to the SpeakJet module on pin 3. speakjet.begin(9600); //Set up a serial port to get the ascii message from the host Serial.begin(9600); //Configure the Ready pin as an input pinMode(RDY, INPUT); //Configure Reset line as an output pinMode(RES, OUTPUT); //Configure all of the Event pins as outputs from Arduino, and set them Low. for(int i=E0; i<=E7; i++) { pinMode(i, OUTPUT); digitalWrite(i, LOW); } //All I/O pins are configured. Reset the SpeakJet module digitalWrite(RES, LOW); delay(100); digitalWrite(RES, HIGH); } void loop() { //Get a message from the serial port getMessage(message); //Send the message to the TTS256 speakjet.println(message); Serial.println(message); //Wait 12ms before checking the ready line delay(12); //Wait for the Speakjet to become 'ready' before sending more text. while(digitalRead(RDY)==0); } void getMessage(char * message) { char in_char=0; while(Serial.available() <=0); in_char=Serial.read(); while(in_char != 0x0D){ *message++=in_char; while(Serial.available() <=0); in_char = Serial.read(); } *message++='\r'; *message='\0'; return; } int main(void) { init(); setup(); for (;;) loop(); return 0; }
"Hab alle Eingänge richtig angeschlossen." Das behaupten immer alle!
Und das ist auch sehr spannend:
"(note: The correct character to append to the end of text is 0x0D and not 0x0A as listed)"
Zu finden ist das auf der sparkfun-Produktseite bei "Documents" hinter "Datasheed": https://www.sparkfun.com/products/9811
Der TTS256 sendet nach dem Einschalten/Reset seine Firmwareversion an den Host (=dein RP6). Das könntest du auswerten. Wenn ich mich recht erinnere, dann hat die RP6-Library ein Problem mit dem ReceptionBuffer. Hier ein Ansatz für den Empfang von 10 Zeichen, das kannst du sicher etwas "aufbohren" um eine unbegrenzte Anzahl von Zeichen (die Zeichen vom TTS256) zu empfangen. Vermutlich sendet der auch am Ende einen Zeilenvorschub \n oder ein Carrige-Return \r
https://www.roboternetz.de/community...l=1#post366767
Aufbohren:
char eingang[15];
und
}while((i<10) && (eingang[i-1] != '\n')); // oder \r
wird zu
char eingang[200];
und
}while((i<200) && (eingang[i-1] != '\n')); // oder \r
![]()
Atmel’s products are not intended, authorized, or warranted for use
as components in applications intended to support or sustain life!
Lesezeichen