Go Down

Topic: PLEASE HELP ME! ATMEGA328p DATASHEET and OSCİLLATOR DESİGN İSİS PROTEUS (Read 877 times) previous topic - next topic


Are you asking us to help you cheat?

If you have a specific question with a detail from a datasheet that you do not understand or would like a recommendation on a design choice, I am sure many will be happy to help you.

But asking us to do your work for you, is not the task your teacher has set out for you. What will you do when your future manager gives you a task?


Sounds like you just need to take over timer1 and use one of the output compare channels, with the WGM that uses the ICR1 register to set TOP, and set that along with the prescaler for the timer (controlled by the CS bits in the control registers) to get the desired frequency, then set the output compare register to half of that so it's a square wave with 50% duty cycle? See the chapter of the datasheet on Timer1. Obviously this means that if the value of TOP is set such that the number of clocks per overflow is odd, you can't get 50% duty cycle.

Be aware that you're limited as to the resolution at high frequencies, as the minimum length of a high or low can only be a multiple of 1/F_CPU, eg with 16MHz oscillator, you could count up to 16 to get 1MHz output, or up to 18 (trying to keep 50% duty cycle as noted above) to get 0.88MHz output, but you can't get, say, 0.95MHz. This is a limitation of the hardware, if you need more resolution, you need a microcontroller that has a higher clock speed (or which allows you to clock the timers from an on-chip PLL like the tiny85/861, which have a high speed timer that can be clocked off the PLL at 64MHz - though that is derived from the internal oscillator which isn't nearly as accurate as a crystal would be unless you calibrate it). 
ATTinyCore for x4/x5/x61/x7/x8/x41/1634/828/x313 megaTinyCore for the megaavr ATtinies - Board Manager:
ATtiny breakouts, mosfets, awesome prototyping board in my store http://tindie.com/stores/DrAzzy


i don't understand english.
I cannot design microcontrollers.
Can you design this and send me a picture?
I really need. Please


If you have to live some day regarding your degree, you have really to know everything regarding your job. Assume you need to design medical device which failing can risk patient life! Do you expect that some strangers on some forums design that for you? Who will be responsible for patient death?

This is not a game. You have to understand what you are doing and do that yourself. Otherwise,  your future diploma have no value, nor anyone should relying on it.


Start by getting the arduino cookbook and reading it, you may have to give up a few parties to do this. Also on line there are many videos etc showing the arduino and how to do what you want.  As far as giving you an answer, no. You payed for the course to learn, If you do not, that was part of the agreement with the school you will fail.  The assignment is actually very simple and part of the basics. This response is to help you get started in solving your problem, not solve it for you.
Good Luck & Have Fun!


I am a student of mechatronics engineering.
i don't understand english.
You are going to be in a very bad situation if that is still the case when you leave university.

Almost all documentation for engineers is now in English because it is a fast moving global world. Many here including myself are nonnative English speakers.

Here is my recommendation for the next 6 month

- Stop reading anything in your language that is available in English
- Stop watching any TV, movies, YouTube whatever, except in English
- Find some friends that can talk to you in English
- Watch some Arduino getting started videos
- Watch other engineering stuff on YouTube
- Read some application notes, datasheets and other documents for your area of interest

Go Up