Skip to content

Latest commit

 

History

History
81 lines (55 loc) · 2.64 KB

README.md

File metadata and controls

81 lines (55 loc) · 2.64 KB

DAC-Piano

Created DAC Using R-2R Ladder Circuit To Implement Piano in TM4C. This project was done as the part of Embedded Systems course.

Components Used

  • TM4C123GH6PM

  • Buttons - 8

  • 10kΩ resistors - 8

  • 1kΩ resistors - 24

  • 500Ω resistor - 1

  • Potentiometer - 1

  • Speaker - 1

Pin Configurations:

TM4C Pin Circuit Connection
PE0 Button 1
PE1 Button 2
PE2 Button 3
PE3 Button 4
PF0 Button 5
PF1 Button 6
PF2 Button 7
PF3 Button 8
PB0 R-2R Bit 1
PB1 R-2R Bit 2
PB2 R-2R Bit 3
PB3 R-2R Bit 4
PB4 R-2R Bit 5
PB5 R-2R Bit 6
PB6 R-2R Bit 7
PB7 R-2R Bit 8

Circuit

Screenshot 2021-05-14 at 11 59 46

Screenshot 2021-05-14 at 12 00 08

Logic

  • Constructed R-2R Ladder Design for 8-bits in Tivac Board using resistors, wire connectors, and connected Multimeter and in the R-2R Ladder.

  • The 8-bit binary value is assigned to 8 ports of Port B

  • GPIO Ports (E and F) are initialized as digital pins and set to input mode.

  • Unlock PORT E and F and disable the analog function. We also clear the PCTL register for Ports E and F.

  • Configured the Tiva C board pin connections for resistors in the R-2R ladder (port B pins).

  • Each button corresponds with a different keynote and has a frequency index for each button.

  • By reading the corresponding PORTS (Port E and F) , the button pressed is found.

  • Pushbutton signals are sent to Tiva C pin connections ( VCC, GND, taking output signal from push buttons when pressed and feeding the input to Tiva C - 4 port E and 4 port F GPIO pins).

  • Binary input values (corresponding frequencies of piano notes) are sent from Tiva C to corresponding R-2R Ladder resistors in the circuit.

  • GPIO PE0-PE3 and PF0-PF3 ports are set from Tiva C to R-2R ladder DAC to Piezo to play the specific frequency.

  • GPIO Port B in range of PB0-PB7 Pin is read from R-2R Ladder to corresponding Tiva C Button Connected GPIO Port ranging from PE0-PE3 and PF0-PF3 Port.

  • Sine Waves are generated by setting frequency for 8 Basic notes in music to get through DAC R-2R Ladder.

Demo Link

https://drive.google.com/file/d/1T4WI3HeAmsE5nf2GBpMLfPKmT8kRCRYN/view?usp=sharing