Skip to main content

EUREKA!

I got it all working.  Below is a screenshot of what I've done so far.  If anyone is interested in the code or the Excel file, please just drop me a message with your email.

I really want to thank Harvy Ackermans for all of his help and encouragement!  I highly recommend his product (eTCC).  I've used it for a couple of years, and it inspired me to want to make a GUI for switch control.  Thanks again Harvy!

Attachments

Images (1)
  • Yard Master screenshot

Folks,

Sanity check please.  OK, i've got the FE (orF8) 1st byte and the 00 for engine command.  It was calculating the 2nd byte with the TMCC ID that was driving me crazy.  The TMCC ID is calculated using 7 bits 64-32-16-8-4-2-1. The 2nd byte LSB bit would get shifted right 1 bit to the MSB of the 3rd byte.  Calculate the 2nd byte using 8 bits.  Add the bits for command and action and calculate the 3rd byte including the 2nd byte LSB as the 3rd byte MSB.  Am I'm finally getting this?  Geez, I hope so or I'm breaking out the extra strength Ibuprofen again.  Thanks for any info, insights, pointers or suggestions.

bd

Last edited by barnun

BillYo, I wish I could tell you precisely.  It got to the point I was just trying all sorts of permutations of the setup and such.  The key though was I used some free software to monitor the strings being sent to the com port.  I found with it that I was sending "00" in between the bytes needed.  Then, I just started experimenting with every way I could google to get VBA to open a port and communicate without sending those in between bytes.  Eventually, I just got lucky!

Barnun, here is my VBA code to parse a basic engine command and send it.  Maybe this will help.

Dim CmdByte(2) As Byte

TMCC1String = "11111110"
EngineNum = Dec2Bin(EngNumber, 7)
CmdString = "00" & EngineNum & "00" & CommandVal
CmdStringLeft = Left(CmdString, 8)
CmdStringRight = Right(CmdString, 8)
CmdByte(0) = WorksheetFunction.Bin2Dec(TMCC1String)
CmdByte(1) = WorksheetFunction.Bin2Dec(CmdStringLeft)
CmdByte(2) = WorksheetFunction.Bin2Dec(CmdStringRight)
Open "COM3:9600,N,8,1,X" For Binary Access Read Write As #1
Put #1, , CmdByte
Close #1

Add Reply

Post

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

×
×
×
×
Link copied to your clipboard.
×
×