Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 23:26 24 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : 2 sine different phase

Author Message
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2120
Posted: 06:38pm 16 Aug 2024
Copy link to clipboard 
Print this post

Is it possible to generate two 100Hz sinewaves and vary the phase of one to the other without hardware? I fancy Lissajous x/y but sampling a-d.
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1113
Posted: 06:59pm 16 Aug 2024
Copy link to clipboard 
Print this post

Page 122 PicoMite User Manual

PLAY SOUND soundno,channelno, type [,frequency][,volume]
so try

Play SOUND 1,B,S,100,25
Pause 2 'try 1 to 9
Play SOUND 2,B,S,100,25

at 100 Hz you got 100 oscillations per second that means every oscillation is 10 milliseconds long. If I start the 2nd tone 2 ms late the waves should be shifted.
Edited 2024-08-17 05:04 by Martin H.
'no comment
 
Andy-g0poy
Regular Member

Joined: 07/03/2023
Location: United Kingdom
Posts: 56
Posted: 07:21pm 16 Aug 2024
Copy link to clipboard 
Print this post

Another method of doing this, is to generate a table of all the sine amplitude values. Choose the number of samples to suit the resolution you need. (make it such that it divides easily)

Read the table at the required frequency needed and output the value to whatever I/O system you are using.

That gives you a single sinewave.

However if you also read the table twice with a specific increment then you can generate multiple sinewaves at a specific phase.



e.g.
If the table is 100 samples long, then reading from the table at position(x) and position (x+25) will give you two sinewaves 90 degree phase shift between them.

Andy
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024