Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

From Sinewave to Quasi-Squarewave

2 posters

Go down  Message [Page 1 of 1]

1From Sinewave to Quasi-Squarewave Empty From Sinewave to Quasi-Squarewave Sun Nov 06, 2022 10:43 pm

KerimF

KerimF

This is the first time I use a reactive component (a capacitor).

On the schematic, test_2a.sim1, the RC LPF (940K and 220pF) is simply used to set an interrupt flag (when necessary) at a zero crossing of the mains voltage (220V, 50Hz). At pin D3 (INT1 here) the high amplitude sinewave wave is clipped, after RC, by the MCU internal two diodes, one connected to Vcc and the other to GND). This produces a quasi-squarewave at that pin.

To just monitor the clipped voltage at pin D3, an infinite loop was added to the previous ‘test_1.asm’ at its beginning. This lets the remaining instructions out of reach. The new attached asm is ‘test_2a.asm’.

I wonder what the optimum settings could be in order to monitor properly the signal at pin3. Although I have the impression that this is somehow a silly question, I like to save time for other tests.

Please note that the circuit of test_2a.sim1 is just a small part of a bigger one after removing all other parts.
Attachments
From Sinewave to Quasi-Squarewave Attachmenttest_01_ATmega8_4.zip
You don't have permission to download attachments.
(42 Kb) Downloaded 1 times

2From Sinewave to Quasi-Squarewave Empty Re: From Sinewave to Quasi-Squarewave Mon Nov 07, 2022 1:52 am

arcachofo

arcachofo

the high amplitude sinewave wave is clipped, after RC, by the MCU internal two diodes
SimulIDE does not simulate clamping diodes, so you need to add them externally.
And the MCU does not check for overvoltage: if voltage > 2.5 v state = HIGH, else state = LOW, that's all.

I wonder what the optimum settings could be in order to monitor properly the signal at pin3.
Not sure about what exactly you need to monitor and what kind of precision you need.

If you only need to check if there is a signal F>40Hz then everything is ok i guess.
If you need to synchronize with that signal then you might need to consider some factors like the "Quality" of the sine wave and reactive steps.

3From Sinewave to Quasi-Squarewave Empty Re: From Sinewave to Quasi-Squarewave Mon Nov 07, 2022 8:54 am

KerimF

KerimF

arcachofo wrote:
the high amplitude sinewave wave is clipped, after RC, by the MCU internal two diodes
SimulIDE does not simulate clamping diodes, so you need to add them externally.
And the MCU does not check for overvoltage: if voltage > 2.5 v state = HIGH, else state = LOW, that's all.

I see. There is a need to add two external diodes to simulate the internal ones.

Thank you.

4From Sinewave to Quasi-Squarewave Empty Re: From Sinewave to Quasi-Squarewave Mon Nov 07, 2022 9:11 am

KerimF

KerimF

arcachofo wrote:
I wonder what the optimum settings could be in order to monitor properly the signal at pin3.
Not sure about what exactly you need to monitor and what kind of precision you need.
If you only need to check if there is a signal F>40Hz then everything is ok i guess.

I will add the two external diodes and see if I can get a clean squarewave at pin D3 on the scope.

arcachofo wrote:If you need to synchronize with that signal then you might need to consider some factors like the "Quality" of the sine wave and reactive steps.

I will search (the files) where I can get help to understand the supposed effects of the two parameters 'Quality' and 'reactive steps' on the signal.

5From Sinewave to Quasi-Squarewave Empty Re: From Sinewave to Quasi-Squarewave Mon Nov 07, 2022 10:26 am

arcachofo

arcachofo

I will search (the files) where I can get help to understand the supposed effects of the two parameters 'Quality' and 'reactive steps' on the signal.
"Quality" is basically the number of steps, a sine wave in the simulator is not continuous.
Just change it to 10 for example and have a look at the oscilloscope.
The more steps the more accurate but slower simulation.

For "Reactive Steps" have a look here: https://simulide.forumotion.com/t938-simulation-speed-reactive-components

Sponsored content



Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum