Interface serial TTL??

Forum de support pour les locuteurs de la langue française qui souhaitent écrire dans leur langue maternelle.

Moderator: Benj

Post Reply
tech
Posts: 353
Joined: Tue Sep 23, 2008 9:39 am
Been thanked: 9 times

Interface serial TTL??

Post by tech »

Bonjours,

Je suis à la recherche d’aide et d'information sur l'utilisation du serial TTL sous FC4. Je voudrais a partir du TTL contrôler un lecteur MP3 (MP3 Trigger) de sparkfun voir le lien (https://www.sparkfun.com/products/11029?) et pour le manuel (http://dlnmh9ip6v2uc.cloudfront.net/dat ... -02-01.pdf)

Je n'ai jamais utilisé le TTL donc je voudrais savoir comment je dois l'envoyer du data à partir de FC4???

Merci à tous

Christian

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Interface serial TTL??

Post by Benj »

Bonjour,

Dispositif TTL peut être relié directement aux broches du microcontrôleur et basculé à l'aide des icônes d'organigramme d'E / S. Vérifier que la tension du microcontrôleur correspond à la tension des MP3 broches E / S ou vous aurez besoin de changer la tension à l'aide d'un décaleur de tension ou d'un tampon collecteur ouvert.

Hello,

A TTL device can be connected directly to the microcontroller pins and toggled using the I/O flowchart icons. Check that the microcontroller's voltage matches the voltage of the MP3 I/O pins or you will need to shift the voltage using a voltage shifter or open collector buffer.

tech
Posts: 353
Joined: Tue Sep 23, 2008 9:39 am
Been thanked: 9 times

Re: Interface serial TTL??

Post by tech »

Bonjour Ben,

Voici un aperçu du programme sous FC4, j'utilise un PIC16F88. Pourriez-vous me dire si c’est la bonne manière d'envoyer du data en sériel TTL???

Merci :?

Christian
Attachments
PIC16F88 MP3 v1.fcf
(10.5 KiB) Downloaded 307 times

tech
Posts: 353
Joined: Tue Sep 23, 2008 9:39 am
Been thanked: 9 times

Re: Interface serial TTL??

Post by tech »

Bonjour,

Je cherche de l'aide pour le protocole TTL. Je ne comprends pas très bien comment je dois envoyer le data!???

Voici ce qui est écrit dans le manuel (voir plus bas), mais je ne saisis pas bien la logique??

Merci de votres aide :?

Serial Control Protocol
The MP3 Trigger v2 comes with a full duplex 3.3-5V serial TTL interface that allows for control of all the MP3 tracks
(up to 256) on the microSD card as well as volume, and for monitoring input trigger activity. You can use our FTDI
Basic (DEV-09115) or connect to any serial interface that uses the format: 8-bits, 1-start, 1-stop, no parity, flow
control = none. The serial port baud rate defaults to 38.4kbps, but can be changed using the initialization file. All
commands to the MP3 Trigger v2 are 1 or 2 bytes in length.

1-byte commands are upper case ASCII characters.

2-byte commands start with an ASCII character. Those starting with an upper case character use an ASCII value (‘0’
– ‘9’) as the second byte. (These commands can be typed on a keyboard.) 2-byte commands starting with a lower
case character require a binary value (0 – 255) as the second byte.

Bytes sent to the MP3 Trigger v2 are not echoed. If echoing is required, set your terminal program to echo locally.

Command Summary

Command: Navigation – Start/Stop
Number of bytes: 1
Command byte: ‘O’
Data byte: none
Comments: This command performs the same function as pushing the on-board nav switch center position. If the
current track is playing, it stops. If the current track is stopped, it will restart from the beginning

Command: Navigation – Forward
Number of bytes: 1
Command byte: ‘F’
Data byte: none
Comments: This command performs the same function as pushing the on-board nav switch right position. The next
MP3 track in the directory will be started.

Command: Navigation – Reverse
Number of bytes: 1
Command byte: ‘R’
Data byte: none
Comments: This command performs the same function as pushing the on-board nav switch left position. The
previous MP3 track in the directory will be started.

Command: Trigger (ASCII)
Number of bytes: 2
Command byte: ‘T’
Data byte: N = ASCII ‘1’ through ‘9’
Comments: If it exists, the track with the filename “00Nxxxx.MP3” will be started, where N is the data byte. xxxx can
be any valid filename characters of any length.

Command: Trigger (binary)
Number of bytes: 2
Command byte: ‘t’
Data byte: n = 1 to 255
Comments: If it exists, the track with the filename “NNNxxxx.MP3” will be started, where NNN is the ASCII equivalent
of the data byte n with leading 0s. xxxx can be any valid filename characters of any length.

Command: Play (binary)
Number of bytes: 2
Command byte: ‘p’
Data byte: n = 0 to 255
Comments: If it exists, the nth track in the directory will be played. The total number of available tracks in the
directory can be retrieved using Status Request command below.

Command: Set Volume (binary)
Number of bytes: 2
Command byte: ‘v’
Data byte: n = 0 to 255
Comments: The VS1053 volume will be set to the value n. Per the VS1053 datasheet, maximum volume is 0x00, and
values much above 0x40 are too low to be audible.

Command: Status Request (ASCII)
Number of bytes: 2
Command byte: ‘S’
Data byte: N = ASCII ‘0’ through ‘1’
Comments: If N = ‘0’, the MP3 Trigger will respond with a version string. If N = ‘1’, the MP3 Trigger v2 will respond
with the total number of tracks on the installed microSD card, in ASCII. Both responses will be preceded by the ‘=’
character.

Command: Quiet Mode (ASCII)
Number of bytes: 2
Command byte: ‘Q’
Data byte: N = ASCII ‘0’ or ‘1’
Comments: If N=’1’, Quiet mode is turned on. If N=’0’, Quiet mode is turned off. Default state is off.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Interface serial TTL??

Post by Benj »

Bonjour,

Droit, il ressemble à l'interface de bus série est que vous pouvez utiliser le composant Flowcode RS232 pour ce faire. Il suffit d'ajouter le composant RS232, puis connectez les broches MP3 pour les broches TX et RX du microcontrôleur contrôle de la tension est correcte. Ensuite, utilisez les macros de composants pour référencer la fonction d'envoi RS232. Vous pouvez envoyer les octets de données en ajoutant des guillemets simples autour du personnage.

par exemple.

RS232_Send_Byte - Paramètre 'O'


Hello,

Right it looks like the interface bus is serial so you can use the Flowcode RS232 component to do this. Simply add the RS232 component and then connect the MP3 pins to the TX and RX pins of the microcontroller checking the voltage is correct. Then use component macros to reference the RS232 send function. YOu can send the data bytes by adding single speech marks around the character.

eg.

RS232_Send_Byte - Parameter 'O'

tech
Posts: 353
Joined: Tue Sep 23, 2008 9:39 am
Been thanked: 9 times

Re: Interface serial TTL??

Post by tech »

Bonjour Ben,

Dois-je envoyer 8-bit???

Pourriez-vous me donner un exemple???

Si on prend l'exemple la commende "Play"

Merci de votre aide :?

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Interface serial TTL??

Post by Benj »

Bonjour,

Votre fichier semble être correcte mais vous avez réglé la vitesse d'horloge dans les options du projet à 4000000 ou 4MHz et la configuration de RC interne.

Les valeurs par défaut internes RC à 32 KHz afin de changer ce à 4MHz, vous devez ajouter la ligne de code suivante dans une icône C tout en haut de votre macro principale.

Code: Select all

osccon = 0x60;
Vous pouvez vérifier l'appareil fonctionne à la bonne vitesse en effectuant un second test clignotant LED.



Hello,

Your file looks to be correct however you have set the clock speed in the project options to 4000000 or 4MHz and the config to internal RC.

The internal RC defaults to 32KHz so to change this to 4MHz you need to add the following line of code in a C icon at the very top of your main macro.

Code: Select all

osccon = 0x60;
You can confirm the device is running at the right speed by performing a one second LED flasher test.

tech
Posts: 353
Joined: Tue Sep 23, 2008 9:39 am
Been thanked: 9 times

Re: Interface serial TTL??

Post by tech »

Oui j'ai corrigé ce problème apprêt avoir publier le fichier!

Mais mon problème et au niveau de l'envoie du data pour un command dans quel ordre dois-je l'envoyer??

j'aurais juste besoin d'un exemple (faire jouer un fichier audio)!??

Merci :?

tech
Posts: 353
Joined: Tue Sep 23, 2008 9:39 am
Been thanked: 9 times

Re: Interface serial TTL??

Post by tech »

Ben,

J'ai effectué d'autres tests avec un PIC16F876A et ça fonction très bien, mais ça ne fonctionne pas avec le PIC16F88. Aurait-il un Bug au niveau de la macro RS232 pour le PIC16F88???

Merci :wink:

Christian

Post Reply