LOCODUINO

Aide
Forum de discussion
Dépôt GIT Locoduino
Flux RSS

samedi 30 mars 2024

Visiteurs connectés : 31

Un décodeur d’accessoires universel (3)

. Par : Thierry

Résumé des épisodes précédents... Universal Accessory Decoder, UAD pour les amis, est une bibliothèque destinée à piloter des accessoires via des circuits de puissances commandés par un Arduino. Les ordres peuvent être reçus par des codes DCC en écoutant les rails, ou par des boutons à actionner manuellement, comme un TCO (Tableau de (...)

Retourner à l'article

Vous répondez à :

Un décodeur d’accessoires universel (3) 17 février 2016 21:52, par Gabor

Dear Thierry,

does the address calculation always work for you ? Because I found out, that - at least in case of using Multimaus -, basic accessory addressing and DCC_Decode::GetAddress, the address calculated by this function is not OK. In case of address 5 on Maus (in reality : 1), it’s okay, but for address 6,7,8 (reality : 2, 3, 4) this does not work. The real calculated address was 3, 5, 7, 13 and so on...

But after having a look at the address calculation in the other function DCC_Decoder::State_Execute I adapted the code and changed the calculation to Wolfgang Kufer’s (opendcc.de).
The original code lines were :
address = gPacket[1] & 0x70 ;
address = (address<<2) + (gPacket[0] & 0x3F) ;

The new code lines are (only the second one is changed) :
address = gPacket[1] & 0x70 ;
address = (address<<1) | (gPacket[0] & 0x3F) ;

I tested some addresses and now I get the following "real" addresses :
Multimaus / variable "address" (should be "Multimaus" minus 4)
5 / 1
6 / 2
7 / 3
20 / 16
So for me, it look OK :) And I’m interested, if this also works for e.g. Trix or other controllers (if you have some free time to test it :) )

Thanks,
Gabor

Qui êtes-vous ?
Votre message

Pour créer des paragraphes, laissez simplement des lignes vides.

Lien hypertexte

(Si votre message se réfère à un article publié sur le Web, ou à une page fournissant plus d’informations, vous pouvez indiquer ci-après le titre de la page et son adresse.)

31 Messages

Rubrique Bibliothèques

Bibliothèque Accessories (1)

Bibliothèque Accessories (2)

Un décodeur d’accessoires universel (1)

Un décodeur d’accessoires universel (2)

Un décodeur d’accessoires universel (3)

Bibliothèque LcdUi (1)

Bibliothèque LcdUi (2)

La bibliothèque Servo

Bibliothèque SoftWare Serial

Bibliothèque Serial

Bibliothèque EEPROM

Bibliothèque Wire : I2C

Bibliothèque LCD

La bibliothèque ScheduleTable

Bibliothèque MemoryUsage

Bibliothèque EEPROMextent

La bibliothèque SlowMotionServo

Bibliothèque Commanders

Bibliothèque DCCpp

Bibliothèque DcDccNanoController

La bibliothèque ACAN (1)

La bibliothèque ACAN (2)

Bibliothèque LightEffect

Les derniers articles

Bibliothèque LightEffect


Christian

La bibliothèque ACAN (2)


Jean-Luc

La bibliothèque ACAN (1)


Jean-Luc

La bibliothèque SlowMotionServo


Jean-Luc

Bibliothèque DCCpp


Thierry

Bibliothèque DcDccNanoController


Thierry

Bibliothèque LcdUi (2)


Thierry

Bibliothèque LcdUi (1)


Thierry

Bibliothèque Accessories (2)


Thierry

Bibliothèque Accessories (1)


Thierry

Les articles les plus lus

Bibliothèque Wire : I2C

La bibliothèque Servo

Bibliothèque SoftWare Serial

Bibliothèque LCD

La bibliothèque SlowMotionServo

Bibliothèque EEPROM

Bibliothèque Commanders

Bibliothèque MemoryUsage

Bibliothèque DCCpp

Bibliothèque DcDccNanoController