Sign in

username:

password:



Not a member?

Search avrclub



Search tips

Subscribe to avrclub



avrclub by Keywords

AT90S2313 | AT90S8515 | ATMega | ATmega128 | ECL | FETS | IAR | Keyboard | LCD | STK50 | TMOS | UART

Ads

Discussion Groups

Discussion Groups | AVRclub | [AVR club] Re: First Program

Atmel AVR Microcontroller discussion group.

[AVR club] First Program - Brian - Jan 19 23:55:03 2007

This program is to turn an led on and keep it on. I am using an
ATmega16L. Its a little big but thats what I have. There may be many
problems but I am trying to teach myself with books.

It will not assemble. The following is what I have loaded in to
studio 4. (is it C or assembly? I feel dumb but gotta keep going)
Sorry it doesnt seem to fit in this window well but in studio it
lines up so all the semicolons are comments.

;************************************************
;written by: Brian Wade *
;date: 1-19-07 *
;version: 1.0 *
;file saved as: E:\avr\projects\ledon\ledon.asm *
;for AVR: atmega16l *
;clock frequency: *
;************************************************

;Program Fuction: To turn an LED on
;

.device ATmega16
.nolist
.include C:\Program
Files\Atmel\AVRTools\AvrAssembler\Appnotes\m16def.inc
.list

;==========
;Declarations:

.def temp =r16

;==========
;Start of program

rjmp Init :first line executed

;==========
Init: ser temp ;PB0 -
output,rest N/C
out DDRB,temp ;
out DDRD,temp ;PD0-
7 all N/C
clr temp ;All
port B outputs off
out PortB,temp ;
out PortD,temp ;all
Port D N/C

;==========
;Main body of program:
Start: sbi PortB,0 ;turns on
the led
rjump Start
;loops back to Start
When assembling I get an error of:
E:\avr\projects\ledon\ledon.asm(15): error: Missing include file
name.
Is m16def.inc the correct file for the ATmega16L? Do I need the .inc
file in the folder of the program? I just tried it and it didnt work
either. E drive is where I am keeping my programs.

Brian



(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )


Re: [AVR club] First Program - Zack Widup - Jan 20 8:42:11 2007


That programm is in assembler.

For the "include" file I've always used simply

.include "m16def.inc"

The AVR assembler should know where the "include" files are kept; you
shouldn't have to put the entire path there unless you've moved it
somewhere else since you installed the AVR assembler program.

I hope this helps!

Zack

Also, I'm assuming that with the lines

On Sat, 20 Jan 2007, Brian wrote:

> This program is to turn an led on and keep it on. I am using an
> ATmega16L. Its a little big but thats what I have. There may be many
> problems but I am trying to teach myself with books.
>
> It will not assemble. The following is what I have loaded in to
> studio 4. (is it C or assembly? I feel dumb but gotta keep going)
> Sorry it doesnt seem to fit in this window well but in studio it
> lines up so all the semicolons are comments.
>
> ;************************************************
> ;written by: Brian Wade *
> ;date: 1-19-07 *
> ;version: 1.0 *
> ;file saved as: E:\avr\projects\ledon\ledon.asm *
> ;for AVR: atmega16l *
> ;clock frequency: *
> ;************************************************
>
> ;Program Fuction: To turn an LED on
> ;
>
> .device ATmega16
> .nolist
> .include C:\Program
> Files\Atmel\AVRTools\AvrAssembler\Appnotes\m16def.inc
> .list
>
> ;==========
> ;Declarations:
>
> .def temp =r16
>
> ;==========
> ;Start of program
>
> rjmp Init :first line executed
>
> ;==========
> Init: ser temp ;PB0 -
> output,rest N/C
> out DDRB,temp ;
> out DDRD,temp ;PD0-
> 7 all N/C
> clr temp ;All
> port B outputs off
> out PortB,temp ;
> out PortD,temp ;all
> Port D N/C
>
> ;==========
> ;Main body of program:
> Start: sbi PortB,0 ;turns on
> the led
> rjump Start
> ;loops back to Start
> When assembling I get an error of:
> E:\avr\projects\ledon\ledon.asm(15): error: Missing include file
> name.
> Is m16def.inc the correct file for the ATmega16L? Do I need the .inc
> file in the folder of the program? I just tried it and it didnt work
> either. E drive is where I am keeping my programs.
>
> Brian
>


(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )

Re: [AVR club] First Program - fajar firmansyah - Jan 20 8:45:06 2007

try to write
.include
----- Original Message ----
From: Brian
To: a...@yahoogroups.com
Sent: Saturday, January 20, 2007 12:54:42 PM
Subject: [AVR club] First Program

This program is to turn an led on and keep it on. I am using an
ATmega16L. Its a little big but thats what I have. There may be many
problems but I am trying to teach myself with books.

It will not assemble. The following is what I have loaded in to
studio 4. (is it C or assembly? I feel dumb but gotta keep going)
Sorry it doesnt seem to fit in this window well but in studio it
lines up so all the semicolons are comments.

;*********** ********* ********* ********* ********* *
;written by: Brian Wade *
;date: 1-19-07 *
;version: 1.0 *
;file saved as: E:\avr\projects\ ledon\ledon. asm *
;for AVR: atmega16l *
;clock frequency: *
;*********** ********* ********* ********* ********* *

;Program Fuction: To turn an LED on
;

.device ATmega16
.nolist
.include C:\Program
Files\Atmel\ AVRTools\ AvrAssembler\ Appnotes\ m16def.inc
.list

;==========
;Declarations:

.def temp =r16

;==========
;Start of program

rjmp Init :first line executed

;==========
Init: ser temp ;PB0 -
output,rest N/C
out DDRB,temp ;
out DDRD,temp ;PD0-
7 all N/C

clr temp ;All
port B outputs off
out PortB,temp ;
out PortD,temp ;all
Port D N/C

;==========
;Main body of program:
Start: sbi PortB,0 ;turns on
the led
rjump Start
;loops back to Start

When assembling I get an error of:
E:\avr\projects\ ledon\ledon. asm(15): error: Missing include file
name.
Is m16def.inc the correct file for the ATmega16L? Do I need the .inc
file in the folder of the program? I just tried it and it didnt work
either. E drive is where I am keeping my programs.

Brian

Send instant messages to your online friends http://uk.messenger.yahoo.com

[Non-text portions of this message have been removed]


(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )

Re: [AVR club] First Program - Zack Widup - Jan 20 8:54:07 2007

And if that doesn't work, use

.include "m16def.inc"

like I said.

Zack
On Sat, 20 Jan 2007, fajar firmansyah wrote:

> try to write
> .include
> ----- Original Message ----
> From: Brian
> To: a...@yahoogroups.com
> Sent: Saturday, January 20, 2007 12:54:42 PM
> Subject: [AVR club] First Program
>
> This program is to turn an led on and keep it on. I am using an
> ATmega16L. Its a little big but thats what I have. There may be many
> problems but I am trying to teach myself with books.
>


(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )

[AVR club] Re: First Program - Brian - Jan 20 21:24:46 2007

Thank you for all your help. Just listing the device was what it
took and not the whole link. I played with the code to program with
the STK500 to get used to what happens. For all that read this be
VERY sure you are placing semicolons instead of colons. I did have
one problem with this (I have a small monitor).

Next I will be working with switch inputs to control led outputs. I
know this sounds simple but I am taking it one step at a time to
learn as much as I can. After this I will be working with interrupts
so any input anyone may have would help me and others starting in
programming. I have also been looking at tutorials on this.

Within a year I plan to be using CAN communications, datalogging
with external memory and A-D sampling/D-A outputs. I don't think
this is too much to bite off.

I started with PICs (did not get as far as programming them) but
found that AVRs are far better.

Brian

--- In a...@yahoogroups.com, "Brian" wrote:
>
> This program is to turn an led on and keep it on. I am using an
> ATmega16L. Its a little big but thats what I have. There may be
many
> problems but I am trying to teach myself with books.
>
> It will not assemble. The following is what I have loaded in to
> studio 4. (is it C or assembly? I feel dumb but gotta keep going)
> Sorry it doesnt seem to fit in this window well but in studio it
> lines up so all the semicolons are comments.
>
> ;************************************************
> ;written by: Brian Wade *
> ;date: 1-19-07 *
> ;version: 1.0 *
> ;file saved as: E:\avr\projects\ledon\ledon.asm *
> ;for AVR: atmega16l *
> ;clock frequency: *
> ;************************************************
>
> ;Program Fuction: To turn an LED on
> ;
>
> .device ATmega16
> .nolist
> .include C:\Program
> Files\Atmel\AVRTools\AvrAssembler\Appnotes\m16def.inc
> .list
>
> ;==========
> ;Declarations:
>
> .def temp =r16
>
> ;==========
> ;Start of program
>
> rjmp Init :first line executed
>
> ;==========
> Init: ser temp ;PB0 -
> output,rest N/C
> out DDRB,temp ;
> out DDRD,temp ;PD0-
> 7 all N/C
> clr temp ;All
> port B outputs off
> out PortB,temp ;
> out PortD,temp ;all
> Port D N/C
>
> ;==========
> ;Main body of program:
> Start: sbi PortB,0
;turns on
> the led
> rjump Start
> ;loops back to Start
> When assembling I get an error of:
> E:\avr\projects\ledon\ledon.asm(15): error: Missing include file
> name.
> Is m16def.inc the correct file for the ATmega16L? Do I need
the .inc
> file in the folder of the program? I just tried it and it didnt
work
> either. E drive is where I am keeping my programs.
>
> Brian
>



(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )