What is wrong with this?
2008-01-27 by dlc
Hi all,
I'm using AVR-GCC 4.0.2 with the most recent avr-libc and a target of
a 90S2313 with this code for a toy "blink the LED" thing. It builds,
avrdude downloads it fine, and it doesn't do a blasted thing. Similar
code with Bascom/AVR downloaded using avrdude works fine. Now, this
isn't the first AVR target I've done with avr-gcc, they all worked, this
one doesn't.
Can someone suggest which god I forgot to make a sacrifice to to get
this to work correctly? I'm at a loss here.
thanks,
DLC
/*
* puky.c Code file to test working with 90S2313
*
*/
#undef F_CPU
#define F_CPU 10000000UL
#include <avr/io.h>
#include "puky.h"
#define BAUD 9600L
#define BAUD_RR ((F_CPU/(16L*BAUD)) - 1)
int main(void)
{
initialize();
PORTB = 255;
while(1)
{
waitms(100);
PORTB = ~PINB;
}
}
void initialize()
{
DDRB = 0xAF;
DDRD = 0xF8;
//TMR0
TCCR0 = 0x03; // prescale/64 6.4us per tic
TCNT0 = 0; // clear the timer
ACSR = 0x80; // turn off the comparitor
}
void waitms(unsigned char d)
{
int delay;
TCNT0 = 98;
for (delay=0;delay<d;delay++)
{
while (TCNT0);
TCNT0 = 98;
}
}
--
-------------------------------------------------
Dennis Clark TTT Enterprises
www.techtoystoday.com
-------------------------------------------------