Would you like to answer one of these unanswered questions instead? Here is a link to a video I made on instagram of mine working using this schematic: Each segment on a 7-segment display is designated a letter A-G. Pin 5 should go to GND. Danny Sebahar 9.
|Published (Last):||4 October 2009|
|PDF File Size:||12.97 Mb|
|ePub File Size:||6.11 Mb|
|Price:||Free* [*Free Regsitration Required]|
If you are using a different Arduino model or computer setup, the vast majority of this tutorial should still apply, however, some minor changes may be necessary.
This chip decodes binary coded decimal BCD , which is just basic binary numbers for the decimal digits, into the individual LED segments of a 7-segment display. See the 74LS47 datasheet for more information. If you prefer to use a common cathode display instead, replace the 74LS47 decoder IC with a 74LS48 chip and make sure to connect the common terminals of the display to ground instead of power. If you need assistance with your particular setup, post a question in the comments section below and I, or someone else, can try to help you.
Building The Circuit Before connecting any circuitry to your Arduino board, disconnect the Arduino from power and your computer. This avoids accidental damage during wiring. Place the components and wire up the circuit on a breadboard according to the schematic diagram shown below and then connect it to your Arduino. Note, you may come across other 7-segment display circuits using only one resistor at the common terminal s , but using resistors across all the segments, as done here, ensures a constant level of brightness regardless of how many segments are lit.
The circuit should look similar to the one shown below once completed. Note, I used a two digit display that I had available in my circuit, but I only connected one digit. Once the circuit is built, you can connect your Arduino to your computer with the USB cable. All rights reserved. The bcdA through bcdD pins represent the A through D BCD inputs of the 74LS47 chip, which itself subsequently drives the a through g segment inputs of the 7-segment display.
The first instance is on line 40 where I am setting up the interrupt service routine that triggers a call to the resetCount function when the button is pressed. Typically we would use the digitalPinToInterrupt function to translate the pin number to the interrupt number. However, that function does not work as expected for the WiFi Rev2 board.
Luckily, no translation is required for the WiFi Rev2, so we can just simply use button. The second usage is on line 69 and deals with a change made to the argument types of the digitalWrite function.
For the WiFi Rev2, we need to add a PinStatus cast since the underlying type is no longer an integer as is returned by the bitRead function. Speaking of bitRead , this function just translates a number into its individual binary bits.
For example bitRead 5, 0 will return 1 since the least significant bit in the number 5, in binary, is 1. Likewise, bitRead 5, 1 will return 0. This is how we are sending our values to the BCD decoder chip. Buttons used within circuits are notoriously noisy, meaning once pressed they can take a little while for their contacts to settle down to a known state. For instance, the interrupt service routine we are using can actually get called multiple times for a single button press.
In software we can handle this by waiting a short amount of time, usually around ms or so. In our program this is handled within the resetCount function and I have conservatively set a debounce wait time of ms. Running And Testing The System Now that our circuit is built and our software is written, it is time to run and test our creation. When it reaches 9, it should reset back to 0. Press the pushbutton on the breadboard at anytime and the display should reset back to 0. The final source code and schematic used for this tutorial is located on GitHub.
Thank you for joining me in this journey and I hope you enjoyed the experience. Please feel free to share your thoughts in the comments section below.
74ls47中文资料汇总（74ls47引脚图及功能_工作原理及应用电路） - 全文
How does a 74LS47 works basically?
Contador con 74LS47