LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Concatenating strings from event

I am in the middle of a project where I am creating a morse code translator with LabView. I have a button that is set at "switch until release" and a timer that times how long the button has been held. I then compare that timer value with 350 ms. If the button is pressed for more than 350 ms, a dash will be produced, and if it is pressed for less than 350 ms, a dot will be produced. In the same while loop, I have 26 nested case structures that correspond to each pattern of dots and dashes with its Latin letter. I realize this isn't the best way to do things, especially if I want to make words. The best way I could think to create words was to have another button and string indicator. When this button is hit, the value that is currently in the letter string indicator gets appended to the new string indicator but I can't seem to get this to work. I have it in the third frame of the flat sequence. 

Below is the very messy VI. Please Help!

0 Kudos
Message 1 of 4
(870 Views)

I am in the middle of a project where I am creating a morse code translator with LabView. I have a button that is set at "switch until release" and a timer that times how long the button has been held. I then compare that timer value with 350 ms. If the button is pressed for more than 350 ms, a dash will be produced, and if it is pressed for less than 350 ms, a dot will be produced. In the same while loop, I have 26 nested case structures that correspond to each pattern of dots and dashes with its Latin letter. I realize this isn't the best way to do things, especially if I want to make words. The best way I could think to create words was to have another button and string indicator. When this button is hit, the value that is currently in the letter string indicator gets appended to the new string indicator but I can't seem to get this to work. I have it in the third frame of the flat sequence. 

Below is the very messy VI. Please Help!

0 Kudos
Message 2 of 4
(878 Views)

Please refrain from creating duplicate posts.

https://forums.ni.com/t5/LabVIEW/Concatenating-strings-from-event/td-p/4294531

 

Please post the VI in LabVIEW 2019 format as most users are not on the latest LabVIEW version.

 

In general, this is how I would approach the scenario,

  1. A timer to identify a dot from a dash
    1. Start timer when switch is pressed, stop timer when released (look for value change True->False, False->True)
    2. Based on timer value, store it in a shift register as a dot or a dash
  2. Keep track of dot or dash characters in a shift register
  3. Create a lookup table with the morse code equivalent for each character
  4. If timer exceeds 3 units, then lookup the current sequence of dot and dash against the table and transcribe into a character
  5. Keep track of characters
  6. If timer exceeds 7 units, concatenate a space character
Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 3 of 4
(871 Views)

In order to avoid mistakes: there is no such thing as a timer in LV. The common conception of a timer is something you can start, stop and reset arbitrarily and which would return the elapsed time after stop.  

0 Kudos
Message 4 of 4
(814 Views)