programming language c using atmega328p

Go To Last Post
69 posts / 0 new

Pages

Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello
I am learning programming in Embedded, but there are some days I am left with a task which I have no idea how to solve, if you can help me
This task to be written in programming language c using atmega328p.

 

There is an automatic system which is controlled by two robots. Each robot is controlled by a controller implemented in Atmega328p.

 

In the program of robot controller 1 there is the function unsing char robo1 (void) which commands the work by reading the sensors from the environment around it.

The robo1 () function is implemented - you just have to use it.

Implement the program for Robot 1 which:

Executes the function robo1 () periodically with a period of 1 sec.
At the end of the function execution, it sends the return value of the function via UART to Robot 2 (assuming that robots 1 and 2 are connected to each other via a serial communication line through UART) to implement the periodic execution to be used interrupt Service and Output Compare Timer interrupt in normal mode (free running). Select the parameters for communication via UART with the maximum speed for communication which support the controller in question. Implement parity bit for error checking.
The use of Arduino IDE functions is not allowed and the use of delay () functions is not allowed. The oscillator frequency is 4 Mhz.

roboti1.c

unsigned char robo1(void);

 

int init_robo1 (void) {

 

 

}
int main (void) {

 

 

 

}

In Robot 2 there is a function: unsingned char robo2(unsigned char input) which commands the work of robot 2 by reading the sensors from the environment around it and taking into account the input variable - which is the value of the message received by Robot 1 through UART.

The robo2 (..) function is implemented-- you just have to use it.

Implement the program for robot 2 which:
Executes the robo2 () function whenever it receives a message from Robot 1.
Use the UART Rx Interrupt for signaling about message reception.
Select the UART communication settings that are compatible with the maximum communication speeds that support the controller in question.
Implement parity bit for error checking.
If the value of the received message is less than half the maximum possible message size then a red LED should light up on pin 3 of port d otherwise it should be lit on the green LED connected to pin 2 of port B.
The oscillator frequency is 4 Mhz.

roboti2.c

usingned char robo2 (unsigned char input);

ISR () {

}
int main (void) {

}

This topic has a solution.

M.K

Last Edited: Mon. Jul 27, 2020 - 11:22 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Is this a homework/coursework question?

 

What work have you done yourself? What happens? What doesn't happen?

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No, it is not a school assignment, I took this assignment online, where I am preparing to enroll in October in a faculty in Computer Science and Engineering
I need your help

M.K

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Metro1 wrote:
I am left with a task which I have no idea how to solve

So you need two programs,

in one you need to set up a timer, either timer0 or timer1 with a one second timeout (overflow).

You also need to set up the usart to send data (TX).

 

In program 2, you also need to setup the usart to receive data.

and be able to turn on/off one of two LEDs.

 

I would start with program 2, show us how you would setup the init_usart() function, and how to init the port pins to drive two LEDs.

Begin with a schematic of this M328, show how you would connect the two LEDs with series current limiting resistors.

 

Jim

Note: since the above problem description does not include how the h/w is setup, just show how the two micro's would be connected together and how the leds will be connected, don't worry about how the micro's are powered, bypass caps ect as that is not a requirement of the assignment.

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

Last Edited: Sun. Jul 26, 2020 - 06:58 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you Jim

Can you write me the Code, because I do not know much in the UART part.

M.K

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

We are professionals who are paid to write programs, we don't provide code for free.

However, we will help you with your code, show what you have so far and we can help you get it right.

 

Jim

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Here is a basic send character function, you will need to init the usart to match the requirements stated above.

//-----------------------
int putc(char c){
//put char to usart0... dont add lf after cr

  while(!(UCSR0A & UDRE0)){};	//wait for data reg empty
  UDR0=c; //send char
  return c;
}

You need to set the baud rate register and change the default no parity to odd or even parity (your choice) and enable the usart TX.

 

Jim

edit: corrections to syntax for M328

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

Last Edited: Sun. Jul 26, 2020 - 07:28 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 2

Well, some will do free code, if they have an itch to scratch. But this sounds like an assignment to determine readiness. It is for your good to solve it yourself if you cannot, then you are not yet ready for the class.

my projects: https://github.com/epccs

Debugging is harder than programming - don’t write code you can’t debug! https://www.avrfreaks.net/forum/help-it-doesnt-work

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I took this assignment online, where I am preparing to enroll in October in a faculty in Computer Science and Engineering, It is not a project
I need your help

M.K

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It is true that I have never studied microcontroller programming in high school, I have tried for many days to solve this task myself, but I need help to gain motivation to enroll in university in computer science

M.K

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is the first part of the program

M.K

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Metro1 wrote:
I took this assignment online

Go to the Microchip website and download the datasheet for the Atmega328p, spend some time reading the timer sections and usart sections, come back with any questions you have.

It may be easier to just google atmega328p datasheet!

 

Jim

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

See if this ebook will give you the basics you need to meet the entrance requirements.

https://www.google.com/url?sa=t&...

Jim

 

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you so mach 

M.K

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have no idea how to read the datasheet of atmga328p,
Please help me solve this task .

M.K

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

There is an automatic system which is controlled by two robots.

I have no idea how to read the datasheet of atmga328p,  

It should be a piece of cake then. Glad it's only a simple project, not as complicated, say, as to flashing a LED.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Can you help me to solver this task

M.K

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, go and do a university or college course for a few YEARS that teaches you the subjects. What is the point of anyone doing YOUR work if you don't know what you are doing?

 

What happens at you next exam? Will you ask someone to sit it for you?

 

We surely can help but you must show what you have done.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It is true what you say, that if you do not solve it yourself then who will help me in the exam, I have been trying for several days to solve this task myself, but now I am tired and I am asking for help from you, I i want to see the code and then analyze how the program this project is.

Please understand me.

M.K

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

We understand you. We get lots of similar questions. Unfortunately, you have exposed yourself as someone who wants to cheat. Is this how you want to be viewed?
Think about the question you are asking as the answer you seek will not help you.
If you want to help yourself, then do some research on the interwebs. Asking these questions on a forum is not good for you - your identity can be easily traced.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It does not matter that my identity can be easily traced, I am not doing any deception, I am just asking for help in solving a task that I have some days that I can not solve, so. If what I am saying is deception then I will leave this forum.

M.K

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You have asked us to provide you code so that you can submit it under your name in an entrance exam. Is this not what you have asked? If not, this is how it has been interpreted. Go back and read what you posted.
I’d suggest your actions are ethically challenged.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry my english is not good,
This task will not be in the University entrance exam, I am just preparing by solving tasks which have been in the exams in the past years

M.K

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You keep on changing your story. How long do you want to continue this?
Help yourself - google has the answers you seek.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am also searching on google I have learned some things in programming, but in the part with timer and UART I can not understand them and for this reason I asked for your help.

M.K

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Metro1...

 

Perhaps, some hints may help. 

 

You have stated what you want.

 

The NEXT step is to think of what big pieces you need in order for that to happen. Send characters? Receive characters? Start or stop various robot pieces?  Just list the major tasks. Now, you have started to DESIGN your software.

 

A possible next step is to create functions in C that actually do these things. For example you might have

 

void run_motor(uint8_t motornum, uint8_t speed);

Assuming that there is more than one motor, you would write it to control several motors by number, each with its own speed. You could have speed of zero to mean STOP. There are many examples of character transmitting and receiving functions scattered around the internet. You can certainly find examples since Mega328 is so common. These are examples. You will probably have functions to do other things. For example, you might have one that checks received characters and looks for patterns (called "parsing") that are used to choose which function to call for each serial input string. Probably quite a few more.

 

BUT, now lets take a step back. This is how you would do it. HOWEVER, you have to learn the low level basics first. I highly recommend that you do some kind of "flash LED" program filrst. These are often called "blinky" programs. This will introduce you to different ways of controlling port pins, which you surely need.

 

The simple fact is that the project you are trying to do is totally inappropriate for someone who has only been learning the abstract concepts of C. It is as big a job to learn the hardware. And, it is just as important. It is completely unrealistic to make the jump from the abstraction of the C langauge into a hardware intensive project without learning basics. PLEASE take the little step, first.

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you so much for the suggestions and help, I will start trying again in solving this task

M.K

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

... to implement the periodic execution to be used interrupt Service and Output Compare Timer interrupt in normal mode (free running).

 

This doesn't make any sense at all.  I'll go out on a limb and assume that Robot 2 has a OC Timer IRQ that goes off at "heartbeat" rates like every 1 millisecond.

And this ISR checks to see if any new data byte has arrived on the USART from Robot 1.   If a new data byte has arrived, the OC ISR reads this data byte into a volatile global one byte variable and sets a flag for the main code that a new command has arrived from Robot1 and it needs servicing.

 

The fact that the "customer" i.e the person who defined the situation that you need to program for forbids using Arduino and delay() functions only shows that this is a academic/test example and not a real-world situation because it if were then you would always use Arduino as a platform when the AVR device is a Mega328P.  Because Arduino is an easier way to go for this one AVR device {the mega328p, which is used by the UNO and Nano, the two cheapest and most common Arduino platforms}.

 

Start by making charts and diagrams:  what gets sent from one Robot to the other?   When?   How does each robot react to data coming from the other robot?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I can't help thinking there is something "missing" from this whole picture. Sure the task involves using timers in interrupt mode and UARTs to send/receive so the general structure is going to be:

// robot 1
int main(void) {
    init_uart();
    start_timer();
    enable_interrupts();
    while(1) {
    }
}

ISR(timer) {
    tosend = robo1();
    uart_send(tosend);
}
// robot 2
int main(void) {
    init_uart();
    enable_interrupts();
    while(1) {
    }
}

ISR(UART_rx) {
    robo2(UDR);
}

but this is just the "high level" design. To actually implement this you need to know what ini_uart(), start_timer(), enable_interrupts(), uart_send() actually look like. Unless you are telepathic this is not something that just magically pops into your brain. There must surely be course notes asscoiated with the exam? The usual pattern of exams is that you do several months of learning being guided by a tutor who in a well design/structured way builds up your knowledge from the simplest things to the complex. You then take that on board. Maybe run some experiments trying each of the things in turn (timers, polled UART, interrupt UART etc) and when you have all the "building blocks" of knowledge you put that all together in the exam at the very end of the course to prove that you have understood the details of all that you were taught and have understood and taken on board.

 

What you can't do is just jump straight to the exam and somehow magically pluck all the knowledge out of no where.

 

So surely the missing bit is the course work/teaching/slides/books/presentations that would imbue the knowledge into you?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Metro1 wrote:
No, it is not a school assignment, I took this assignment online

Give a link to this online "course" - If you've got to this stage "without a clue", it might be complete rubbish. Many are, we freaks could suggest better examples but we need some idea of your experience and competence level.

 

Last Edited: Mon. Jul 27, 2020 - 08:56 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I have no idea how to read the datasheet of atmga328p,
Please help me solve this task 

Well, maybe you are not yet ready for microcontroller work yet.

what things do you already know about the AVR?

What things are you already able to do with an AVR?

Have you ever used any microcontroller at all?  Which ones? 

 

I am learning programming in Embedded,

We wouldn't want to give you the wrong advice, so you must list everything you have learned so far about embedded programming, with a brief explanation and example of each concept.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Mon. Jul 27, 2020 - 09:11 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Metro1 wrote:
I am learning programming in Embedded

Do you already have any experience with programming in any other context?

 

If not, it would be far easier to start by learning the 'C' (or C++) programming language on a PC - away from all the added complications & restrictions of embedded microcontrollers.

 

An essential part of programming embedded microcontrollers is, at least, a working understanding of electronics.

 

See Tip #6 in my signature, below, for some beginner getting started info ...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you 

The reason I have problems in programming in Embedded is that I have been in the direction of natural sciences in high school, while the exam to be admitted to the University in computer science is built based on the knowledge that students have gained in high school in electronic directions, mathematics and computer science ... etc. and not for students of natural sciences.

M.K

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Metro1 wrote:
while the exam to be admitted to the University in computer science is built based on the knowledge that students have gained in high school in electronic directions, mathematics and computer science ...
Then you have to do that course first before you stand any chance of knowing how to do this. 

 

(I would like to be a virtuoso concert pianist but I recognize I probably need to practice the piano for another 10-20 years before they'll hire me. Just because you can pick out "Frere Jacques" with one finger does not qualify you to play Carnegie Hall !)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Metro1 wrote:
the exam to be admitted to the University in computer science is built based on the knowledge that students have gained in high school in electronic directions, mathematics and computer science ... etc. and not for students of natural sciences

Perhaps you should be discussing with the University's Admissions people how they suggest that you proceed ?

 

Clearly, as others have said, you do need to have done the necessary preparation, and laid the necessary foundations, before you start!

 

That's not something you're going to get from a few forum posts.

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My wish is to be a programmer, I know well the front-end and back-end part in building a website, I am not so interested in embedded programming development subjects, but to be accepted in The university has to pass the exam where there will also be tasks from programming to embedded.

I was just asking for your help to solve this task, so that I could continue to understand as little as possible.

M.K

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My wish is to be a programmer, I know well the front-end and back-end part in building a website, I am not so interested in embedded programming development subjects, but to be accepted in The university has to pass the exam where there will also be tasks from programming to embedded.

I was just asking for your help to solve this task, so that I could continue to understand as little as possible.

I was at university and I asked if it would be the same exam for students of mathematics and science students, they told me that there will be no division of exams for certain areas.

M.K

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Metro1 wrote:
My wish is to be a programmer, I know well the front-end and back-end part in building a website, I am not so interested in embedded programming development subjects, but to be accepted in The university has to pass the exam where there will also be tasks from programming to embedded.
Then this is the WRONG COURSE you are trying to join. Surely there must be courses that speciialise in only server-side programming (PHP, Perl, Ajax, Javascript, etc etc)? "Web programming" and "embedded programming" are as different as learning chinese or serbo-croat, a course that concentrates on one will be of no use in learning the other.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is my goal to continue my specialization in server programming after being accepted to the University, but I must first pass the exam in embedded.

M.K

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry but that does not make any sense. It's like training to be a car mechanic so you can captain a yacht. Surely some university near you must run web programming degrees?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There are universities with internet programming, but they are private universities and the cost of studies is very high, where I want to enroll is a public university.

M.K

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you want to be a Chinese interpreter what would be the point in learning Serbo_Croat just because the course to do it is free?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Then you're just going to have to put the work in to pass this assessment!

 

It's really not hard - the question seems to be basically just to do serial comms between two computers (the fact that they are called "robots" is irrelevant).

 

Using a UART is one of the most basic tasks of using a microcontroller - so it really shouldn't be hard to find beginner's tutorials for this.

 

If you're serious about being a programmer - embedded or otherwise - you really need to learn how to work this stuff out for yourself by studying documentation, searching for examples, tutorials, etc.

 

Even as a server programmer, you are going to be faced with new interfaces, APIs, frameworks, etc that you've never used before - so you are going to need the skills to work them out.

 

https://www.avrfreaks.net/commen...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Mon. Jul 27, 2020 - 12:33 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

All right, what you say is true.
I begged you if you could help me solve any task

M.K

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My problem is that I do not know English well and many videos on Youtube are in English and I do not understand how UART and TIMER are used.

Please if you can only solve the first part for me while the other part I will try to solve it myself by looking at your solution and how to use TIMER and UART

M.K

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Metro1 wrote:
I begged you if you could help me solve any task

Remember:

In #8 ron_sutherland wrote:
But this sounds like an assignment to determine readiness. It is for your good to solve it yourself if you cannot, then you are not yet ready for the class

 

So you have 2 choices:

  1. get down to some serious study so that you are able to do this assignment, or
  2. choose another course and/or University.

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Metro1 wrote:
... while the exam to be admitted to the University in computer science is built based on the knowledge that students have gained in high school in electronic directions, mathematics and computer science ... etc. and not for students of natural sciences.
Excellent goal (all kinds to make the world)

The authors of AoE recognize the issue of students having to acquire knowledge in electronics and embedded systems.

The ECE department in an engineering college may have a course in embedded systems (electronics + software)

 

The Art of Electronics 3rd Edition | by Horowitz and Hill

PREFACE TO THE FIRST EDITION

[second paragraph]

If the third edition is too expensive then consider the second edition in e-book form.

The Art Of Electronics | Download eBook pdf, epub, tuebl, mobi

 

ECE - Electrical and Computer Engineering

 

edit : on sale

The Art of Electronics 3rd Edition by Paul Horowitz (eBook PDF)

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Mon. Jul 27, 2020 - 01:28 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Please guys
Will you help me solve the first part of the task that has to do with the robot1?
I'm tired of trying but not understanding the part with UART and TIMER.

I thought you would give me the motivation to continue learning for the entrance exam in Computer Science.

M.K

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Metro1 wrote:
Will you help me solve the first part of the task that has to do with the robot1?

What, exactly, do you mean by "the first part"?

 

Restate the problem clearly.

 

Then tell us what you have tried; and where, specifically, you are stuck.

 

I'm tired of trying but not understanding the part with UART and TIMER.

So what, exactly, have you tried in order to learn those things?

 

And where, exactly, are you stuck?

 

Again, you are going to have to work this kind of thing out even for "server programming"

 

Working out how to use a UART or Timer is no more difficult than working out how to use some API.

 

You could think of the UART as just an API - which is defined in terms of "registers" ...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The only one that can give you motivation is you..........

The problem is going to be that once you get in the class with answers we given you are close to be an exert... now The first assignment in that class you again will have to get help from us, or fail miserably......

These entry exams are not there for nothing.

 

I suggest you take the datasheet of the chip you have to use and first go through that from top to bottom, and get to grips with what peripheral blocks it has. No need to go in to detail yet and do that before you go of to doing anything else....

Then read again through all the comments ( I have not read them all, but have seen suggestions on how you need to go forth......

break your overal system up into blocks.......

After that take each block and see if you can manage that with one or more peripherals inside the cpu if you can write down that you need to use those.

if you have done that for all items you could for fun start coding, but at this moment that would not be wise as it might distract you from the next thing and that is to make a layer that combines functions.

so you have to continue your way up the program. Once you have done this paper only exercise you can start making the program flow in pseudo code and then block by block replace that with real code.

 

I usually do this in a text file were each drop in the level of the code is one or two indentations.

Then during making and testing of each code block and when it is OK I remove it from that description file as in the project then you have the real code to continue working with.

 

Keep in mind that writing code starts with thinking on how to do it. If you cannot do that, then those courses will be hell for you as you will be running behind all the time.

 

Also keep in mind that when you tested code blocks and run into problems you can always come here and ask, but it is you that is doing the coding we are only going to give advice, perhaps more than you bargained for......

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Metro1 wrote:
... I know well the front-end and back-end part in building a website, I am not so interested in embedded programming development subjects, but ...
Yet, the two can be combined.

 

WebUSB :

WebSocket :

 

P.S.

Metro1 wrote:
... so that I could continue to understand as little as possible.
indecision

Consider comprehension wink

 

"Dare to be naïve." - Buckminster Fuller

Pages

Topic locked