8/2/2017 5:03 PM | |
Joined: 5/11/2017 Last visit: 2/16/2024 Posts: 16 Rating:
|
Thank you for the reply. The thing is I'm quite new to TIA and PLC programming. It's the first time when I try SCL :). I have understand partially what you explain above. let me show some prints to see exactly what I'm trying to do. AttachmentPictures.zip (91 Downloads) |
8/3/2017 4:39 PM | |
Joined: 7/7/2010 Last visit: 8/16/2024 Posts: 15092 Rating:
|
I guess what I am suggesting is another DB with a 2 arrays of bools. If you are allowing #'s, you need these arrays to be of size [36, 5], and if alphabetic only (A..Z), size [26,4]. These 2 arrays would be dot : array[1..26,1..4], dash : array[1..26,1..4] (for alpha support only). Then when the character is read, you then do the look up in these tables to match the dots/dashes that make up that character, like shown in the top table here : https://en.wikipedia.org/wiki/Morse_code For 'A', the 1st character, it the array would be set up like this (as a constant): dot[1,1] = 1 dot[1,2] = 0 dot[1,3] = 0 dot[1,4] = 0 dash[1,1] = 0 dash[1,2] = 1 dash[1,3] = 0 dash[1,4] = 0 Then you can sequence / loop through each dot/dash array to trigger your existing code to produce the encoded output. Many ways to accomplish it. The way I mentioned previously is a simple search and detect whether dot/dash is required, but harder to maintain and enhance. This approach is simpler to expand and extend.
|
science guy |
|
Follow us on