NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Microcontroller Programming » Just built a 7 segment interface
December 28, 2010 by lefam |
Hello guys. I have just built a 7 segment interface with the NerdKits microcontroller. I needed 7 output PINs to drive the 7 segment display. So, I first tried to use PORTD because it has 8 PINs. But the pins PD0 and PD1 where not working as output. So, I ended up using PORTC pins (PC0-PC5) and PD7. Well, the 7 segment display counter is working. I WOULD LIKE TO KNOW WHY THE PD0 AND PD1 PINS DIDN'T ACT AS OUTPUT. Notes: PD0 and PD1 are the pins the USB cable is connected to. I disconnected the USB cable after uploading the program. First I did: DDRD = 0xFF PORTD = 0x00 But PD0 and PD1 did not output anything. |
---|---|
December 28, 2010 by bretm |
The bootloader runs before your program does, and the bootloader on the MCU that comes with the NerdKits enables the serial port module of the MCU, which takes over PD0 and PD1. You need to disable the serial port by doing
at the start of your program. |
December 28, 2010 by Hexorg |
lefam, or you can get a BCD to 7-segment driver like this, or any other 7447 family. This way you will need only 4 pins of mcu. |
December 28, 2010 by bretm |
Or get this and control four digits with 1 pin. But that's way less fun than doing it yourself. :-) |
December 29, 2010 by lefam |
Thank you guys. @bretm - I suspected it had something to do with the bootloader. So every time we need to use 8 pins and we are not using the serial port module, can we safely disable the serial port? |
December 29, 2010 by mv2112 |
Did you directly connect the pins to the 7-segment? Im trying to do the same and it isnt working, but, when i connect a wire to 5v and one of the pins on the 7-segment, it lights up... |
December 30, 2010 by lefam |
I didnt connect the pins directly to the 7 segment. I used jumper wires. Well, it is impossible to connect directly my 7-segment, because it has the format of a DIP package (with pins in the sides like the microcontroller). I think that even with other 7-segments with the other format it is impossible to connect directly all of their pins to the microcontroller. My 7-segment is common anode. So, I light the segments by connecting them to GND (with exception to the common pin going to +5v). Is your 7-segment common cathode? Please, show us the pin connections you did with your 7-segment and show us your code. |
Please log in to post a reply.
Did you know that you can aim and fire a servo-controlled water gun from your computer? Learn more...
|