Hello Guest it is April 20, 2024, 11:26:20 AM

Author Topic: Need help to generate a sine wave  (Read 2892 times)

0 Members and 1 Guest are viewing this topic.

Need help to generate a sine wave
« on: December 08, 2010, 07:45:07 AM »
I am running mach 3 to control two stepper motors in the x and y planes. I have calibrated and am now trying to input a sine wave on one axis at a time.

I am not sure how to do this, would a while loop within a subroutine be the best way....?, i am having difficulty with the syntax and not really getting anywhere.

Ideally i want a loop that has variables defined so i can alter the frequency and amplitude of the wave input.

So how can i input for example

Maximum wave amplitude x sin(wave frequency x t)

so i can change these parameters and loop them.

I am a complete noob, and using mach for a university project.

Thanks in advance
 
Jono

Offline Graham Waterworth

*
  • *
  •  2,672 2,672
  • Yorkshire Dales, England
    • View Profile
Re: Need help to generate a sine wave
« Reply #1 on: December 08, 2010, 07:56:58 AM »
The best way is to write it as VB macro and save it as an M code so you can call it from g-code.

Search the forum there are many examples of creating macros.

Graham
Without engineers the world stops
Re: Need help to generate a sine wave
« Reply #2 on: December 08, 2010, 08:01:09 AM »
Thanks for your speedy response!!

I will give that a go.

Jono