Datasheet-DMG80480C070_04W.zip (4.3 MB)
MY DISPLAY DATASHEET
#include <max6675.h> // Include the MAX6675 library
// MAX6675 Thermocouple Pin Connections
int thermoDO = 41;
int thermoCS = 39;
int thermoCLK = 37;
// Initialize MAX6675 thermocouple
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
// Variable to store current temperature
int curent_temp;
// Function to send temperature data to the curve graph
void sendTemperatureToGraph() {
// Read temperature from thermocouple
curent_temp = (int)thermocouple.readCelsius();
// Prepare the curve graph command
byte curve_graph[16] = {
0x5A, 0xA5, // Frame header
0x0D, // Data length (13 bytes)
0x82, // Write instruction
0x99, 0x00, // VP address (0x9900)
0x5A, 0xA5, // Start curve buffer writing operation
0x01, 0x00, // Number of curve data blocks (1 block)
0x00, 0x02, // Channel 0, 2 data words
highByte(curent_temp), lowByte(curent_temp), // Temperature value (high and low bytes)
0x00, 0x00 // Placeholder for second data point (optional)
};
// Print the command to Serial Monitor for debugging
Serial.println("Sending Command to DWIN Display:");
for (int i = 0; i < 16; i++) {
Serial.print("0x");
if (curve_graph[i] < 0x10) Serial.print("0"); // Add leading zero for single-digit hex values
Serial.print(curve_graph[i], HEX);
Serial.print(" ");
}
Serial.println();
// Send the command to the DWIN display
Serial1.write(curve_graph, 16);
// Wait for a response from the DWIN display
delay(100); // Adjust delay based on response time
if (Serial1.available()) {
Serial.println("Response from DWIN Display:");
while (Serial1.available()) {
char response = Serial1.read();
Serial.print("0x");
if (response < 0x10) Serial.print("0"); // Add leading zero for single-digit hex values
Serial.print(response, HEX);
Serial.print(" ");
}
Serial.println();
} else {
Serial.println("No response from DWIN Display.");
}
// Print temperature to Serial Monitor for debugging
Serial.print("Temperature: ");
Serial.print(curent_temp);
Serial.println(" °C");
// Delay for stability
delay(500); // Increased delay to 500ms for better graph updates
}
void setup() {
// Initialize Serial Monitor for debugging
Serial.begin(9600);
// Initialize Serial1 for communication with DWIN display
Serial1.begin(115200);
// Wait for MAX6675 to stabilize
delay(500);
Serial.println("Initialization complete. Starting temperature readings...");
}
void loop() {
// Send temperature data to the DWIN display
sendTemperatureToGraph();
} THIS IS MY TEST CODE