Any help with this will be deeply appreciated thanks. This program will make use
ID: 3766047 • Letter: A
Question
Any help with this will be deeply appreciated thanks.
This program will make use of the USART0 peripheral to create a remote EEprom interface using the serial monitor program and the Arduino. Configure the USART0 port to receive and transmit data with 8-bits data, 1 stop bit and no parity at any baud rate of your choosing (except 9600 bps) using interrupts. Your program will process the received data as commands. Your program will be able to robustly parse commands as they are sent from the host PC program (Serial Monitor). The supported command(s) instruct the ATmega328P to read or write bytes in the EEprom’s memory. Process each input command then execute the associated action and if necessary return the result by writing it out the serial port. Obviously the Arduino Serial.begin(), Serial.write(), etc library functions are not allowed.
1. The command structure is a special character, R, W, B, followed by a number(s) in decimal format.
(a) The R character instructs the ATmega328P to read from the EEprom at a specified byte address and return the result in decimal format to the serial monitor. It will be followed by 3 characters indicating the read address in decimal. (e.g. R000, R010, R123 will read from EEprom addresses 0, 10 and 123 respectively and return the contents)
(b) The W character instructs the ATmega328P to write to the EEprom at a specified address. It will be followed by 3 characters indicating the address in decimal, a space, then 3 characters specifying the value. (e.g. W000 123 will write 123 to EEprom address 0)
(c) The B character instructs the ATmega328P to perform a burst read of the EEprom at a specified byte address for a number of bytes. It will be followed by 3 characters indicating the address in decimal, a space, then 3 characters specifying the number of bytes. (e.g. B100 010 will read 10 bytes starting at address 100)
2. Design your program to ignore incorrect command formats and continue to operate.
Explanation / Answer
// The baudrate has two modes; standard and fast. If speedMode is 0 then the // baudrate is in standard mode and the variables are updated accordingly, // else if speedMode is 1 then the baudrate is in high speed mode. char speedMode = 1; char calcVar; if (speedMode == 1) { calcVar = 4; } else { calcVar = 16; } // Define pin used to transmit data (PPS does not overide TRIS). TRISBbits.TRISB7 = 1;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.