Skip to main content

Reply to "Sending TMCC Commands to Legacy Base over Serial Connections"

The B is simply a binary number designator used in C/Arduino language, similar to using 0x before a Hex number.  

0xFE4D9F is correct to send a throw out command to switch 27.  

On the arduino you would simple say Serial.write(0xFE4D9F, HEX)  the AtMega will handle the rest with its serial buffer.  I tend to send out the decimal equivalent numbers because I suck at doing HEX math in my head, but can do Binary and Decimal pretty well.  I would make my life simpler by sending the data in two parts, first the 0xFE start byte, then the actual data.  this will let you use an unsigned int as your variable which is real easy to work with.  seems to be what you already have figured out.  Ex:  

> unsigned int switchCommand = 0x4D9F;

>Serial.write(0xFE);

>Serial.write(switchCommand);

The project I am working on only reads from the TMCC base, so I can help quite a bit if you need a subroutine that can do that.  As for your actual connection, if you have an RS232 shield laying around, it is a simple solution.  if not, if you are using an original TMCC base, NOT A LEGACY BASE!, you can use a 7404 inverter to flip the highs and lows and connect directly to the port at logic level.  The original TMCC base uses logic level signals of 0 and 5 volts.  the legacy base uses more or less true RS232 voltages of +/- 8 volts.  

It seems your project should be pretty straight forward with one subroutine that says 'if button pressed, serial.write(thatSwitchThrow) and turn on a light'.  and a second routine that says 'if serial.read = thatSwitchThrow, then turn on the light.'  

If you need help with code, let me know.  

JGL

 

 

 

OGR Publishing, Inc., 1310 Eastside Centre Ct, Suite 6, Mountain Home, AR 72653
800-980-OGRR (6477)
www.ogaugerr.com

×
×
×
×
×