ark5230
Advanced Member level 3
I am using Atmega32 and Port C and Port D are being used as output.
It was not functioning as expected. I found from data sheet that these port pins (Not all of them) are preconfigured. It has to be set through Fuse bit may be including Calibration !!
I am attaching the code as well.
1. I can use Port B as input and C and D as output port
2. External crystal attached is used as actual frequecy not the internal.
Any advise will be of great help as I am not expert at AVR and C.
It was not functioning as expected. I found from data sheet that these port pins (Not all of them) are preconfigured. It has to be set through Fuse bit may be including Calibration !!
I am attaching the code as well.
The question is that what fuse bits are to be set so that :1. I can use Port B as input and C and D as output port
2. External crystal attached is used as actual frequecy not the internal.
Any advise will be of great help as I am not expert at AVR and C.
Code:
#include <util/delay.h>
#include <avr/io.h>
#include <util/delay_basic.h>
void Onems(uint8_t delay)
{
//One ms delay times
uint8_t i,j;
for(i=0;i<delay;i++)
{
for(j=0;j<10;j++)
{
_delay_loop_1(32);
}
}
}
int main()
{
DDRB=0B00000000; // all bit and b4 as INPUT
DDRC=0B11111111; // all bit and b4 as OUTPUT
DDRD=0B11111111; // all bit and b4 as OUTPUT
while(1)
{
PORTC=0b11111111;
PORTD=0b11111111;
Onems(250);
PORTC=0b11111111;
PORTD=0b11111111;
}
}