I use an Arduino Nano.
I put together a PWM test program (Look at the picture).
On the PD6 pin I want a PWM 2kHz frequency.
I measured the frequency with a Seale Logic Logic Analyzer. The frequency on the PD6 pin is 490.3Hz.
PWM is not working properly.
What am I doing wrong?
How to adjust the 2kHz frequency with the Arduino Nano (Atmega328)?
Thanks for the reply.
PWM doesn't work right - Arduino NANO
Moderator: Benj
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: PWM doesn't work right - Arduino NANO
Hello,
The ATMEGA328 used on the Nano does not have a period register and so it can only use the period overflow value 255. In later versions of Flowcode we generate a warning message to inform the user of the lack of hardware capability.
The ATMEGA328 used on the Nano does not have a period register and so it can only use the period overflow value 255. In later versions of Flowcode we generate a warning message to inform the user of the lack of hardware capability.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: PWM doesn't work right - Arduino NANO
Hi rradojko,
In addition to what Ben posted, coincidentally, I have just watched a video by Eevblog (I think it was on the series he did about the 3 cent MCU) he programmed a blink LED function and showed the output on the same type of logic analyser you are using -Silae and it's clones, He said that there are often issues "A trap for young players" as he called it that the timing of the sample rate and the corresponding output display values are wrong, they are not part of the 'proper' signal being investigated.
From memory I think these were mainly extended pulses or wrong period reading that type of thing.
In addition to what Ben posted, coincidentally, I have just watched a video by Eevblog (I think it was on the series he did about the 3 cent MCU) he programmed a blink LED function and showed the output on the same type of logic analyser you are using -Silae and it's clones, He said that there are often issues "A trap for young players" as he called it that the timing of the sample rate and the corresponding output display values are wrong, they are not part of the 'proper' signal being investigated.
From memory I think these were mainly extended pulses or wrong period reading that type of thing.
Re: PWM doesn't work right - Arduino NANO
Thanks for the reply.Benj wrote:Hello,
The ATMEGA328 used on the Nano does not have a period register and so it can only use the period overflow value 255. In later versions of Flowcode we generate a warning message to inform the user of the lack of hardware capability.
Is it possible to use timer 2 on Arduino Nano?
Thanks for the information. I'm using a Chinese clone logic analyzer. I'll look at EEVBlog.Docara wrote:Hi rradojko,
In addition to what Ben posted, coincidentally, I have just watched a video by Eevblog (I think it was on the series he did about the 3 cent MCU) he programmed a blink LED function and showed the output on the same type of logic analyser you are using -Silae and it's clones, He said that there are often issues "A trap for young players" as he called it that the timing of the sample rate and the corresponding output display values are wrong, they are not part of the 'proper' signal being investigated.
From memory I think these were mainly extended pulses or wrong period reading that type of thing.
I'll check the signal with an oscilloscope.