Hi guys, i really need help with my work. I dont understand to Serial´s things, how to use that. This is the work:
“Build an electrical connection with two MCUs, a 16x4 LCD display and 4x buttons. Connect the buttons to the first MCU. Connect an LCD display to the second MCU, which will display an “X” at the initial coordinate when started. Connect the two MCUs to each other using a UART (Serial) peripheral. The character will be redrawn on the LCD to the new coordinates depending on which key is pressed. When the first key is pressed, the character moves one column to the right. When the second key is pressed, the character moves one column to the left. If the third key is pressed, the character moves down one line. When the fourth key is pressed, the character moves up one line. Only one character will be shown on the LCD display at a time and this “X” character must not get outside the coordinates of the display. When programming, use registers, not functions (such as pinMode, digitalWrite, digitalRead). Use the Pin Change Interrupt peripheral to process all buttons!”
Can you help me to connection this arduino´s and buttons ? Thank you (btw sorry for my english)
Your English is perfect for this activity.
It is very clearly a school exercise so you should only expect some information to get you in the right direction.
In principle, you have 2 Arduinos (or other MCUs). One is a master and one is a slave.
The master sends information about keypresses to the slave and the slave processes these and displas something. You have been told to use serial communication between the 2 MCUs (Serial means Tx, Rx, Uart etc.). The exercise is a bit tougher because you have to use direct port access instead of all the comfortable functions like digitalRead() etc. for reading the buttons.
Get to the stage with MCU1 where you can read 4 buttons and write a line to the serial console when any is pressed.
Get to the stage with MCU2 that you can write the phrase "Hello World" onto the LCD screen.
Once you have got so far, look at Serial.print() / Serial.read() etc. for transmitting information from one MCU to the other.
If you get that far, the manipulation of the X on the screen is quite simple.
look at Serial.print() / Serial.read() etc. for transmitting information from one MCU to the other.
I wonder if the “such as” in:
use registers, not functions (such as pinMode, digitalWrite, digitalRead).
… means that even the serial comms has to be done from first principles?
Maybe it is a complete “bare metal” exercise. Even so, my suggestion would be to get something working with Arduino facilities then, at a later phase, start using more basic commands to replace these.
If nothing else, it's given me an interesting project (not for credit ) to think about. Afaicr, I've never accessed a register on an Arduino....
Maybe it is a complete "bare metal" exercise. Even so, my suggestion would be to get something working with Arduino facilities then, at a later phase, start using more basic commands to replace these.
I agree, but it might be worth the OP's time checking with the faculty to see if ALL programming has to be done from first principles.
Right now I'd need to get my thinking cap on (and consult the manual, ofc) to just do the buttons on one Arduino, and perhaps confirm them with leds. Talking to another Arduino and an LCD at the bare metal (silicone?) level would be a whole new ball game of a different colour of fish.
Use the Pin Change Interrupt peripheral to process all buttons!"
Making it deliberately excessively complex! Teaching bad programming!