Introduction: Letter to Morse Code Translator
Seeing Morse Code representations online to learn it is helpful, but cannot be compared to seeing it in person with real flashing lights/sounds. This translator will allow you to pick the letter you want to learn in Morse Code, and translate it right in front of your eyes by flashing LED's in the pattern it represents for that specific letter! This Translator takes in a binary representation of a letter in the alphabet, (a chart can be seen later on for each letters' binary equivalent, but assume that A - 01, B - 10, C - 11, and so on) and converts it into a Morse code equivalent by flashing lights for the user. The Decimal version of the number is also displayed on a seven segment display however, to let you know that you are creating the correct binary equivalent.
The binary number is created with the switches on the right hand side, and ascends from the least significant bit, much like you would expect when creating a binary number. The number you create is shown on the seven segment display as stated before and is located on the left of the board, it will simply tell you whether you made a mistake or not in representing the binary number with the switches, or confirm that you made the correct number. It takes in 1 letter at a time, stores it in memory, and then prints out the Morse code when the user is ready by activating the "Print switch" found on the far left of the BASYS3 board (this is simply another switch that we assigned to be the "Print Switch", or another switch if using a different type of FPGA board and assign a different switch (See step 3). It is recommended that you use a BASYS3 Board for simplicity, but it is not required.
Step 1: Step 1: Gather Your Materials
For this project, you will only need the following:
- Basys3 Board (Or an equivalent FPGA that you can wire accordingly)
-(OPTIONAL) Wires if you are planning on connecting extra LED's or different switches to an alternate FPGA
-Vivado Design Suite (We recommend 2014+)
Step 2: Step 2: Create a File
This is the file written in VHDL to run the Morse Code 1 Bit translator in Vivado . This file works with all versions of Vivado. If there are problems with the file download, a text representation of the code can be found in another file below and can easily be copy pasted into the file folder you are creating. Make sure that both the Main source and the constraints file are present and in their own separate sources before trying to generate a bitstream or synthesize anything. For those who want to understand a more in-depth explanation of the code and what it's really doing, check out step 3. If you simply want to get to the point and start translating, skip ahead to section 4.
Step 3: Step 3: the Code
Our code features 4 separate processes that all run simultaneously. Each of the following sub sections in this step will go more in depth into what each of them does.
The first process we created utilized a clock divider to make the seven segment display work for two segments in order to show the binary equivalent of the letter that the person was creating. We needed to make sure that the clock was correctly displaying the number to the correct seven segment sections we wanted. We assigned the segments accordingly, so that they would display certain digits when we asked them too, and had it cycle through the last 2 digits because we only needed 2 to show all of the numbers in the alphabet. We made the seven segment display in the Decimal Number System so that it was easier for people to see what letter they were trying to represent, since the majority of the population uses base 10 number systems.
The second process creates our clock for the LED's to run at, so that we can see the pulses clearly and differentiate between the Dot and Dash, along with have adequate time in between each section of Morse code. We utilized a signal to pass a Bus full of Morse Code LED outputs outside of the process and onto the LED's on the board so that we could light up multiple ones at once, rather than just have one LED flash.
Our third process looks at the switches current states, and assigns the letter to whatever binary representation is being displayed at that time. This goes through each of the letters, along with a space, a period, and a comma. This process ends here, and the all the parts are collected into the fourth process to finish off the translation.
The fourth process is the "translator" process, which takes in all the information we have gathered so far, such as whether or not the store button has been activated, whether or not the print switch is on or off, and what number is being represented by the switches. This then looks into an array we made, that has Morse code representations of what the output would be with 1's and 0's equaling On/Off commands for the LED's. Instead of using two separate duty cycle'd clocks, we made a single 50% duty cycle clock that we felt was a good speed for Morse code, and had it perform a Dot with 1 high "pulse" and a Dash for 3 high "pulses." To simplify the code and make it run faster, we just made a Dot equal to "010" and a Dash equal to "01110".
Step 4: Step 4: Generate the Bistream and Implement
This project is very easy to set up if you have a BASYS3 Board since all of the switches and buttons required are already present on the board for you to use, along with the constraints pre-set to the pins you want them. If you are using a different FPGA, you will need to go into the code and find the constraints and re-route them to the correct constraints for your FPGA. This is also true if you are planning on connecting other LED's and switches to your board for use. We won't go into examples of this, but using the instruction manual of your specific FPGA would be very helpful in determining how to wire and route everything to the correct pins.
At this point, once you have the code downloaded, and the file open, simply generate the bitstream in Vivado and program your device. Once you have, you will be able to begin inputting letters to be translated to Morse Code! Enjoy!
*NOTE: The "Print Switch" is located on the far left of the board (Switch R2 for the BASYS3 Board) and the "Store Button" is button U18 (The center button in the BASYS3 Board) if the constraints are taken directly from our example code.
Step 5: Problems/Troubleshooting
If you are having problems downloading the file, you can copy paste the code in manually from this word file. There is also an attachment for you to check out for easy conversions between binary to the letter, and what the letter should represent, so we recommend you check them out! If you are using the BASYS3 Board, you should be able to follow these instructions and download the code without any issues, and implement it without problems once you have connected the board and programmed it.
*NOTE: if you find that your translator seems like it is running slow, this is normal! There is a small time delay between when you hit print, and when you see the Morse Code representation of it. If you pause the cycle by turning off the print switch, the code will have to complete the cycle before printing out the new letter, leaving you waiting for the cycle to finish and the next letter to start.