Followers 0

# Making a sine wave output in rslogix 5000

## 36 posts in this topic

Don't worry about FIFO or FSC, you don't need them for this basic task. You will need ADD, MOVE and one of compare instructions only As you are dealing with controllogix you can simplify this just by using a periodic task. With periodic task you simply skip this step. Edit: I hope your instuctor knows periodic tasks , if not keep interval timer. I think we need to add step 5: 5. Configure analog output scaling in module properties to match table values. Edited by Contr_Conn

##### Share on other sites
Good hints Conn hopefully miles can post a program soon.

##### Share on other sites
Ok, I got it. I used a different method from what you guys were saying. i figured out that if i used the 2-D array i would not be able to adjust the frequency. so i decided to use a counter to count from 1 to 360, the output of the counter went to a math function (deg to radians) then to a trig function (convert RAD to SIN) then a multiplier (x10) so the output voltage would be between 0v and 10v. that was phase one. second phase i i used a addition function, i added 2.09 RAD ( which is 120 deg) to the result from the deg to rad. then this result to a sin function then to a multiplier. phase three was done the same way as phase two, but i added 4.18 RAD (240 deg) to the result . After testing this program using an oscilloscope, the output was three sin waves, each wave was seperated by 120 degrees. Thanks for all the help!

##### Share on other sites
Thanks for the reply I'll try and look when I get to work.

##### Share on other sites
Good job with math! Few questions: - I don't see any analog modules in your program. How you implemented this? - I also don't see how CTU will be going up? Timer will time only once. Something is missing here. Controllogix has a better way to change frequency and rates - it is called periodic task. You should try it as well.

##### Share on other sites
the progrram i posted was loded from my computer ,which is not setup for the plc in college so it wont let me setup the correct module.the counter counts up to 360 then resets. ill have a look into the peridic task. i'll load up the program i used to run the circuit tomorrow from the computer in college. thats all setup for the analog output module.

##### Share on other sites
Post the code once you completed & tested

##### Share on other sites
This is the full program. tested circuit today and it works. let me know what you think! test1.ACD

##### Share on other sites
It may or may not be good enough for your project but one thing I see is it is very scan time dependant. I would suggest you research Contr_Conn's suggestion of a periodic task to help with this

##### Share on other sites
Timer with preset of 1 ms is useless as well as using reset command for TON. Try to use periodic task, remove rung 0, replace CTU with ADD, modify rung 2 to reset ADD operand instead Also you can remove 3 MUL instructions and set engineering units in module configuration to +1 and -1 Also 3 math instructions in a row can be replaced with one compute. Can you handle this change?