go_away

Author Topic: AXON & Hello World / LED Test  (Read 941 times)

0 Members and 1 Guest are viewing this topic.

Offline Silver_79Topic starter

  • Jr. Member
  • **
  • Posts: 22
  • Helpful? 0
AXON & Hello World / LED Test
« on: July 29, 2012, 03:24:40 PM »
Hi,

I have been trying to get my Axon to do an very basic LED blink as I am learning to program I figured this would be a good start. I have 5.52 V applied to the Axons Bat pin for power and An AVR ISP MKK II set up on its six pin header to load up the code. The LED is placed across Pin 1 on PORT A from ground to the I/O pin ( ie skipping the middle + Unregulated Battery pin. The Code I am tinkering with is :



Code: [Select]
#define F_CPU 16000000    // AVR clock frequency in Hz, used by util/delay.h
#include <avr/io.h>
#include <util/delay.h>

int main() {

   DDRA = _BV(PA6);
 
  while (1) {
PORT_ON(PORTA,1);
_delay_ms(100);         // delay 100 ms
PORT_OFF(PORTA,1); // drive A1 low
_delay_ms(900);         // delay 900 ms

}
}


The Errors I get are thus:


Warning   1   implicit declaration of function 'PORT_ON' [-Wimplicit-function-declaration]   C:\Users\Donald\Documents\Atmel Studio\BlinK_LED_3\BlinK_LED_3\BlinK_LED_3.c   10   4   BlinK_LED_3
Warning   2   implicit declaration of function 'PORT_OFF' [-Wimplicit-function-declaration]   C:\Users\Donald\Documents\Atmel Studio\BlinK_LED_3\BlinK_LED_3\BlinK_LED_3.c   12   4   BlinK_LED_3
Error   3   undefined reference to `PORT_ON'   C:\Users\Donald\Documents\Atmel Studio\BlinK_LED_3\BlinK_LED_3\Debug/.././BlinK_LED_3.c   10   1   BlinK_LED_3
Error   4   undefined reference to `PORT_OFF'   C:\Users\Donald\Documents\Atmel Studio\BlinK_LED_3\BlinK_LED_3\Debug/.././BlinK_LED_3.c   12   1   BlinK_LED_3


**IDE is AVR studio 6.018

Code compiles fine without the PORT_ON and PORT_OFF in it but nothing on the LED. Any help would be great.


Thanks,
Don
I shall be telling this with a sigh
Somewhere ages and ages hence:
Two roads diverged in a wood, and I
I took the one less traveled by,
And that has made all the difference.

-Robert Lee Frost-

Offline newInRobotics

  • Supreme Robot
  • *****
  • Posts: 1,015
  • Helpful? 48
  • N.I.R.
Re: AXON & Hello World / LED Test
« Reply #1 on: July 30, 2012, 03:28:31 AM »
You don't have libraries included that defines PORT_ON and PORT_OFF :)

Try this code:
Code: [Select]
#define F_CPU 16000000    // AVR clock frequency in Hz, used by util/delay.h
#include <avr/io.h>
#include <util/delay.h>

int main()
{
DDRA |= 1 << DDA1;

for(;;)
{
PORTA |= 1 << 1; // drive A1 high
_delay_ms(100); // delay 100 ms
PORTA &= ~(1 << 1); // drive A1 low
_delay_ms(900); // delay 900 ms
}
}
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian W

Offline Silver_79Topic starter

  • Jr. Member
  • **
  • Posts: 22
  • Helpful? 0
Re: AXON & Hello World / LED Test
« Reply #2 on: July 30, 2012, 05:18:22 AM »
cool will give it a shot after work today. I knew it was going to be something stupid like that lol :P

Thanks
Don
I shall be telling this with a sigh
Somewhere ages and ages hence:
Two roads diverged in a wood, and I
I took the one less traveled by,
And that has made all the difference.

-Robert Lee Frost-

Offline Silver_79Topic starter

  • Jr. Member
  • **
  • Posts: 22
  • Helpful? 0
Re: AXON & Hello World / LED Test
« Reply #3 on: September 09, 2012, 12:18:14 PM »
Thanks, worked
I shall be telling this with a sigh
Somewhere ages and ages hence:
Two roads diverged in a wood, and I
I took the one less traveled by,
And that has made all the difference.

-Robert Lee Frost-

 


Get Your Ad Here

data_list