Answer the question
In order to leave comments, you need to log in
How to send UART commands between mega and pic?
There is a mega 2560 and pic 18F4620 and at the peak the "higher" programmers have already written the firmware, leaving me only the grail with instructions. The bottom line is that I can’t execute these commands and I have no idea how to do it. The circuit is assembled and it definitely works, but the peak does not want to answer me. What to do and where to dig? I've been suffering for a couple of weeks now and have tried many options.
Command example
Command Response
F5 01 00 55 FE FA 01 00 55 FE
My code
void setup() {
Serial.begin(19200, SERIAL_8N1);
Serial1.begin(19200, SERIAL_8N1);
void loop() {
if (Serial.available()) {
Serial.write(Serial.read());
}
if (Serial1.available()) {
Serial.write(Serial1.read());
}
Serial1.write("F5110055FE");
delay(20);
Answer the question
In order to leave comments, you need to log in
1. Take a USB UART adapter, poke the PIC and try sending data with the handles. At the same time, decide where RX, TX
2 is. Do not forget to send HEXADECIMAL data, not a string
byte message[] = {0xF5, 0x01, 0x00};
Serial1.write(message, sizeof(message));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question