Skip to main content

Reply to "Arduino TMCC signalling"

Hi David - replying to your post on this thread, but continuing here to keep everything in one place.

Let's take this one step at a time.  First let's see if we can successfully compile the two zip files I posted above. (Apologies if this seems elementary, but I'm not sure where the hangups are).

When you expand each zip file you should get a folder. The TMCC_Snippets folder should go on your computer at Documents/Arduino/ (hopefully you already have this folder).  The ByteBuffer2 folder is a library, so it should go in Documents/Arduino/libraries.

Now go to the TMCC_Snippets folder and open the TMCC_snippets.ino file.  Hopefully that should launch the Arduino IDE, and you should get a sketch with three tabs.  Can you compile that sketch?



Second, let's make sure you have a working serial connection to the Command Base. Here is a simple echo program.  It assumes you have your Arduino serial monitor connected to Serial, and your RS232 converter from the Command Base connected to the Mega Serial1 TX and RX pins (you can use Serial2 or Serial3 as well).

#define TMCCPort Serial1

void setup() {
Serial.begin(115200);
Serial.println("Echo starting");
TMCCPort.begin(9600);
}

void loop() {
if (TMCCPort.available()) {
Serial.print(TMCCPort.read(), HEX);
Serial.print(" ");
}
}

Run this program and use your Legacy CAB remote to send some TMCC commands (doesn't matter what they are).  Do you see commands being echoed to your computer screen?  If they are TMCC commands they should be in the form of three bytes,  FE XX XX.

I have attached a few pictures. I finally got my serial port to at least acknowledge the connection to the Mega. I don't know where the 0's came from. They appear when I press the Mega reset. Nothing happens when I make the train horn sound by using the hand-held controller. I have tried reversing the Tx1 and Rx1 at the Mega and I tried using the Tx0, Rx0 (without changing the sketch). I get nothing further on the screen. I disconnected the Rx and Tx leads from the Mega and measured voltage to ground. On the Tx lead from the MAX reading is 0.5v and the Rx reading is 3.3v. I have the MAX connected to the 3.5 volt pin. When I connect the Tx and Rx to the Mega the readings are: Tx = 5v, Rx =3.3v. When I reverse the Tx and Rx leads the readings become Tx = 0.5v and Rx= 5.  I am wondering if there is something I need do to make the RS232 at the CAB-1 work, but I didn't see anything in the manual about the RS232 physical operation. I hope you can find what I am doing wrong.

Attachments

Images (4)
  • COMPUTER SCREEN
  • MAX Connections
  • MAX 232
  • MEGA
OGR Publishing, Inc., 1310 Eastside Centre Ct, Suite 6, Mountain Home, AR 72653
330-757-3020

www.ogaugerr.com
×
×
×
×
×