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.

How to configure ATmega8 portc port?

Status
Not open for further replies.

chaitana

Member level 1
Joined
Aug 6, 2001
Messages
38
Helped
5
Reputation
10
Reaction score
3
Trophy points
1,288
Activity points
211
I'm using atmega8 with lcd nokia 3310.
When I use spi pin and some of portb as a control reset, ce and d/c. It's ok.
But I changed control to portc (only control not spi). Lcd not active.
I test lcd pin ce. It can't switch to hi. I'm check data sheet portc is adc port.
How to config port?
May I miss some hardware pin connect to vcc or ground?
 

can+spi+portc

chaitana said:
I'm using atmega8 with lcd nokia 3310.
When I use spi pin and some of portb as a control reset, ce and d/c. It's ok.
But I changed control to portc (only control not spi). Lcd not active.
I test lcd pin ce. It can't switch to hi. I'm check data sheet portc is adc port.
How to config port?
May I miss some hardware pin connect to vcc or ground?

you must configure that pin as an output. The data direction register
must be 1 for output, 0 for input on the right pin.

so if you are using PC1 as an output, the instruction will look like this:
Code:
ldi	r16,0b00000010      ;PC1 = output, others are inputs
out    DDRC,r16

Good Luck
 

avr portc

Dear ctownsend
The port is set to output. I'm only change define control port from portb to portc.
It's work in portb.

// Lcd Port Settings
#define LCD_SER_PORT PORTB
#define LCD_SER_DDR DDRB
#define LCD_SCLK_PIN PINB5
#define LCD_MOSI_PIN PINB3

// Lcd Port control
#define LCD_CTRL_PORT PORTC
#define LCD_CTRL_DDR DDRC
#define LCD_DC_PIN PINC1
#define LCD_CE_PIN PINC2
#define LCD_RTS_PIN PINC4

// Set output bits on port ctrl.
LCD_CTRL_DDR |= (1 << LCD_DC_PIN ) | (1 << LCD_CE_PIN ) | (1 << LCD_RTS_PIN );
LCD_CTRL_PORT|= (1 << LCD_DC_PIN ) | (1 << LCD_CE_PIN ) | (1 << LCD_RTS_PIN );
 

Re: need help avr portc

Hi

Check PORTC 6

If you had enabled external reset then there will be prob.

the mcu will reset whenever you change the status of PC6

Regards
Nandhu
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top