11/3/2018 6:30 PM | |
Posts: 2826 Rating: (686) |
Hello. The attached code demonstrate how one timer block could be used for program sequencing. Rename the file from "TimedSteps.scl.txt" to "TimedSteps.scl" before attempting to import the code block into Step7. The #code tag is an array that stores the frequency of the note while #times stores the delay for each individual step. The #code tag could be replaced by something else like a bit field that can be used to trigger individual outputs. Another approach would be to have a fixed time between steps. Call it a sampling rate. This principle can be seen in the encoding and decoding of MP3 music (original versions). When keeping a note you only need to cover more steps. BR AttachmentTimedSteps.scl.txt (293 Downloads) |
This contribution was helpful to1 thankful Users |
11/29/2018 11:41 PM | |
Joined: 6/25/2018 Last visit: 10/26/2024 Posts: 60 Rating: (1) |
Hi, I thought your project was a litlle interesting, so i sat down tonight and wrote a rough example the way i would have dealt with it(if i understand correctly what you are trying to do) I'm new to siemens too, so my code might well be far from ideal and possibly inefficient, but i have simulated it ok. i have one 'song' datablock that consist of the current song, and a menu of 10 songs, each song 100 steps max lenght. each step has 7 notes which can all be turned on or off for that particular step (7note polyphony). i have one function block that deals with playing the current song. 2 timers are used, one for note duration and one for pause between steps. You could easily update the datablock to carry different values for the times for each step--> pause and note duration could relate to each step. I have TIA V15 update4 and used an S7-1214 for the example, attached the zipped project let me know if there is an easier way to share the project. Frank AttachmentMusicBox.zip (206 Downloads) |
This contribution was helpful to1 thankful Users |
11/30/2018 12:26 AM | |
Joined: 6/25/2018 Last visit: 10/26/2024 Posts: 60 Rating: (1) |
attached a pdf printout of the music function and song datablock
AttachmentMusic_Function.pdf (255 Downloads) |
12/8/2018 6:50 PM | |
Joined: 6/25/2018 Last visit: 10/26/2024 Posts: 60 Rating: (1) |
Did any of the contributions you received for this help you? Would be nice to get an update... |
Follow us on