how to use Comparator(Comp) ?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

hello I want to use the Comp block in my project . to cheack if the block itself is working i want to connect to pin Vin a sine wave and then using the compartor to "cut"  the sine wave and basically getting square wave . How to do it ? this pic of what i want to do

Comp_explain.png

and this is my project so far :

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.

tomer.cccp,

Attached is working example project and associated libraries. It uses built-in sine generator and quad decoder to update sine amplitude and frequency. If you have external function generator, then extra libraries are not needed (delete them from the project and Project->Dependencies).

/odissey1

QuadDecoder library page: Quad Decoder with Button Switch component for rotary shaft encoders

Sine_clip_01b.png

sine clipped_01a.jpg

View solution in original post

0 Likes
10 Replies
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

tomer.cccp,

these are separate tasks: (a) convert analog (sine) to digital; (b) convert analog (sine) to analog with limits. Which one is yours?

/odissey1

0 Likes
Anonymous
Not applicable

I want to go get analog sine wave signal into the cypress board then compare the limits and '' cut '' the sine wave .

0 Likes

tomer.cccp,

so it is task (b), which is called "clipping". Should clipping amplitude (+/-1V) be adjustable or fixed? Should it be "soft" or "hard" clipping?

/odissey1 

0 Likes

how about a simple circuit?

Rockman_Distortion.gif

0 Likes
Anonymous
Not applicable

ok but the question is it possible doing only in the TopDesigh ? with out using external Componentes ?

0 Likes

Here is another example of the clamp amplifier circuit (Analog Devices AN-402), which can be realized with internal parts only. It would take 2 Comparators, 1 to 4 Opamps and analog Mux. Two DACs can be used for providing VH and VL. In basic implementation it is just an Analog Mux switching between 3 inputs depending on the truth table.

pastedImage_0.png

Anonymous
Not applicable

maeby will start somthing easy , for exmpale I want to get in to the board voltage of 2volt compare it to 1 volt and the out put will be 1 volt using comprator, is it possible ?

0 Likes

Something like this (untested). Schematics is for AC-coupled input. You can use a couple of VDACs to set voltages VH and VL. In this case you can use DC-coupled input. Notice that Analog Mux can only be connected to analog pins (no other connection possible), thus connection to a comparators has to be made externally through the second set of pins.

Sine_clip_01a.png

0 Likes

Just for completeness, there is very good article about audio clipping by Kendall Castor-Perry

https://www.planetanalog.com/author.asp?section_id=3066&doc_id=563331

K. Castor-Perry_soft clipping_1.jpg

K. Castor-Perry_soft clipping_2.jpg

0 Likes
lock attach
Attachments are accessible only for community members.

tomer.cccp,

Attached is working example project and associated libraries. It uses built-in sine generator and quad decoder to update sine amplitude and frequency. If you have external function generator, then extra libraries are not needed (delete them from the project and Project->Dependencies).

/odissey1

QuadDecoder library page: Quad Decoder with Button Switch component for rotary shaft encoders

Sine_clip_01b.png

sine clipped_01a.jpg

0 Likes