spilios Τετ Οκτ 26, 2011 5:49 pm
Καλησπέρα, χρόνια πολλά σε όλους τους εορτάζοντες, γυναικες και ανδρες.
Συνέδεσα το module του ήχου με την sd21 της parallax, ως εξής
Εχει 3 i2c πόρτες, χρησιμοποίησα την πάνω (αυτή που είναι κοντα στην τροφοδοσία).
Χρησιμοποίησα το παρακάτω πρόγραμμα και όλα οκ
'{$STAMP BS2p}
'***********************************************************
'** **
'** I2C Routines for the Basic Stamp BS2p **
'** Controlling SP03 Speech Synthesizer **
'** **
'** Copyright 2002 - Devantech Ltd **
'** Commercial use of this software is prohibited **
'** Private and educational use only is permitted **
'** **
'** Written by Gerald Coe - August 2002 **
'** **
'***********************************************************
SCL CON 1 ' I2C clock
SDA CON 0 ' I2C data
NOP CON 0 ' No Operation command
status VAR Byte
Main:
' The following shows how easy it is to use the BS2p with the Speech Module,
' a single line command is all that is required to speak any of the 30
' pre-loaded phrases. The example below shows how to speak phrase number 21.
I2COUT SDA, $c4, 0, [21] ' speak phrase number 21
' You can also send your own Text to Speech messages to the module to be spoken.
' The first data byte is the command, in this case a NOP, since we just need to
' load the buffer. The 2nd value is Volume (0-7) which works backwards - 0 is
' loudest and 7 is quiet. The 3rd value is Pitch (0-7) which it is best to just
' try it and see. The 4th value is Speed (0-3) with 3 being fastest.
' You then place the text you wish spoken in inverted comma's and finally the
' $1a character and a 0.
GOSUB wait4shutup ' wait for last phrase to finish speaking
I2COUT SDA, $c4, 0, [NOP, 2,5,3, "merry cristmas", $1a, 0]
' The above loads the modules internal buffer. You then need to send a command to
' speak the phrase you just loaded.
I2COUT SDA, $c4, 0, [$40]
' And thats it.
' The following completes the program so that you can run it.
forever: GOTO forever
wait4shutup:
I2CIN SDA, $c4, 0, [status]
IF status>0 THEN wait4shutup
RETURN
Οτάν το ανάβω μου λέει κάτι που δεν το καταλαβαίνω, ακούγεται σαν denger, αλλά είναι ασαφές. Μετά λέει και ότι του γράψω.
Δεν μου λέει το [21] που είναι στην αρχή, και δεν ξέρω η εντολή "forever: GOTO forever" τι ρόλο παίζει
Αν ξέρει κανείς κάτι γι αυτά, τα λέμε.