Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] How can i interface 7 seg with atmega8 without using PORTD?

Status
Not open for further replies.

hardik.patel

Member level 5
Member level 5
Joined
Aug 15, 2012
Messages
94
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
2,008
Hi all,

i want to interface 7 seg display(max. 4 piece using multiplexed method) using atmega8.

If i use PORTD as data port n any other 4 pin as control then its simple.

But in my application i also need to receive serial data on serial port(RXD pin--PD0) so i cant use complete PORTD as data, so by force i need to do something like divide the data pins on 2 different ports n control pins on other port.

So does its possible ?? how?
(i already done RTC,EEPROM,UART, n basic I/O operations in this application, so no issue regarding basic understanding.)
 

hi,
If the displays are only 7 segment you only need 7, PORTD pins for the segments and another PORT's 4 pins for digit select.
This will leave PORTD.0 free for the serial RXD.

Example image;
ULN drivers were used as they were very large LED's
E
 

Attachments

  • AAesp04.gif
    AAesp04.gif
    14.2 KB · Views: 112

My problem is I have to free PORTD due to RXD.
Or atleast RXD pin,
But your image is not the solution.

Even I don't want to use ".dot"

So now can I do free PORTD?
 

See attached image for the circuit. See below code.

Code:
char mask[] = {...};

PORTD = (PORTD & 0x03) | (mask[digit[x]] << 2);

PORTB = (PORTB & 0xFE) | ((mask[digit[x]] & 0x40) >> 6)
 

Attachments

  • ssd.png
    ssd.png
    31.8 KB · Views: 110

My problem is I have to free PORTD due to RXD.
Or at least RXD pin,
But your image is not the solution.

You say you want to use only PD0 as the RXD pin.?? this leaves RD1 thru RD7 ie: 7 pins free for the 7 segments.

So what am I missing.??

Eric
 

@esp1

PD0 is RxD and PD1 is TxD. As he is using UART in his project he cannot use those two pins.
 

The thread is missing a clear question. ATmega8 has plenty of IO-pins beside PD0 and PD1. Any combination of it can be basically used to drive a 7 segment display, at worst case without specific order if you accept a certain code overhead.
 
@esp1

PD0 is RxD and PD1 is TxD. As he is using UART in his project he cannot use those two pins.

hi pic,
That makes sense if he wants to use both TXD and RXD pins.
Thanks
Eric
 

hi pic,
That makes sense if he wants to use both TXD and RXD pins.
Thanks
Eric

I only want to use RXD.
Nothing I am transmitting back.

So I want to use
PD1-segA
.
.
.
PD7-segG.

N I am giving data as PORTD=0x3F;

So both task I want to achieve on same port 7seg as o/p n RXD as I/p.
 

I don't know whether you can use PD1 (TxD pin) as IO when you have configured to use UART. I have never done something like that.
 

I had solved this query by defining each segments like..

#define segA PORTB,0

So I can now access single pin rather than access complete port.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top