Hi TP, well that works well, I have just increased the baudrate to 38400, and do now also transmit F and S.
I just ordered these I2C LED-displays:
https://www.adafruit.com/products/1002Two are needed for one 8-digit display, and 10 in total for 5 displays.
Eight addresses can be selected with address-selection jumpers, so two I2C busses are required.
It is cheaper to implement this on the mbed platform:
https://developer.mbed.org/platforms/ST-Nucleo-F446RE/Those will be programmed in C++, using an online compiler. (registration required)
- Code: Select all
// Comport specification
string ComPort = "COM1";
int ComBaud = 38400;
// Get fields
string X = AS3.Getfield(226); // XposDRO
string Y = AS3.Getfield(227); // YposDRO
string Z = AS3.Getfield(228); // ZposDRO
string F1 = AS3.Getfield(867); // Setfeedrate
string F2 = AS3.Getfield(868); // Actfeedrate
string S1 = AS3.Getfield(869); // Setspindlespeed
string S2 = AS3.Getfield(870); // Actspindlespeed
// Form a string, separated by spaces, so it can be split easily on the remote platform
string XYZ = "X=" + X + " Y=" + Y + " Z=" + Z;
XYZ += " Fs=" + F1 + " Fa=" + F2;
XYZ += " Ss=" + S1 + " Sa=" + S2;
XYZ += Environment.NewLine; // This could as well be a space character, but it displays well in a terminal for debugging
// MessageBox.Show(""+XYZ);
// Create the Serial port object
System.IO.Ports.SerialPort myPort = new System.IO.Ports.SerialPort(ComPort, ComBaud);
if (!myPort.IsOpen) // If the serial port is not open, open it
{
// Open serial port
myPort.Open();
}
if (myPort.IsOpen)
{
// Send String through the serial port:
myPort.Write( XYZ );
// Close serial port
myPort.Close();
}