Forum: Mikrocontroller und Digitale Elektronik Port F und G beim ATmega128 verwenden


von Oliver Dievernich (Gast)


Lesenswert?

Hallo,

wenn ich die Ports F bzw G als Ein oder Ausgang initialisieren möchte,
dann bringt mir der assembler immer folgende Fehlermeldung:

Illegal argument type or count

Initialisierung sieht wie folgt aus:

ldi buffer, 0xFF
out DDRF, buffer

buffer wurde zuvor einem register zugewiesen!
sobald ich port A-E verwende, funktioniert das alles.

von Florian Bantner (Gast)


Lesenswert?

Richtige Header-Files verwendet?
Richtige Settings für Compiler etc.?

Florian

von Sebastian (Gast)


Lesenswert?

die beiden prots sind soweit ich weiß als sram anzusprechen (memory
mapped)

probier mal statt "out DDRF, buffer"
sts DDRF,buffer

von Oliver Dievernich (Gast)


Lesenswert?

hab das m128def.inc verwendet.
welche settings müssten denn noch umgestellt werden?

bisher hab ich nur die ports A-E genutzt. und da hatte alles
funktioniert.

von Sebastian (Gast)


Lesenswert?

oder st??? wie auch immer... eine von den st/ld befehle sollten es sein

von Sebastian (Gast)


Lesenswert?

das ganze war weil die beiden ports wohl über $003F (?) liegen, was der
maxmale speicherbereich für in/out ist

von Sebastian (Gast)


Lesenswert?

guckst du da... bei all diesen registern wirst du auf diese problem
stoßen

; ***** I/O REGISTER DEFINITIONS
*****************************************
; NOTE:
; Definitions marked "MEMORY MAPPED"are extended I/O ports
; and cannot be used with IN/OUT instructions
.equ  UCSR1C  = 0x9d  ; MEMORY MAPPED
.equ  UDR1  = 0x9c  ; MEMORY MAPPED
.equ  UCSR1A  = 0x9b  ; MEMORY MAPPED
.equ  UCSR1B  = 0x9a  ; MEMORY MAPPED
.equ  UBRR1L  = 0x99  ; MEMORY MAPPED
.equ  UBRR1H  = 0x98  ; MEMORY MAPPED
.equ  UCSR0C  = 0x95  ; MEMORY MAPPED
.equ  UBRR0H  = 0x90  ; MEMORY MAPPED
.equ  TCCR3C  = 0x8c  ; MEMORY MAPPED
.equ  TCCR3A  = 0x8b  ; MEMORY MAPPED
.equ  TCCR3B  = 0x8a  ; MEMORY MAPPED
.equ  TCNT3H  = 0x89  ; MEMORY MAPPED
.equ  TCNT3L  = 0x88  ; MEMORY MAPPED
.equ  OCR3AH  = 0x87  ; MEMORY MAPPED
.equ  OCR3AL  = 0x86  ; MEMORY MAPPED
.equ  OCR3BH  = 0x85  ; MEMORY MAPPED
.equ  OCR3BL  = 0x84  ; MEMORY MAPPED
.equ  OCR3CH  = 0x83  ; MEMORY MAPPED
.equ  OCR3CL  = 0x82  ; MEMORY MAPPED
.equ  ICR3H  = 0x81  ; MEMORY MAPPED
.equ  ICR3L  = 0x80  ; MEMORY MAPPED
.equ  ETIMSK  = 0x7d  ; MEMORY MAPPED
.equ  ETIFR  = 0x7c  ; MEMORY MAPPED
.equ  TCCR1C  = 0x7a  ; MEMORY MAPPED
.equ  OCR1CH  = 0x79  ; MEMORY MAPPED
.equ  OCR1CL  = 0x78  ; MEMORY MAPPED
.equ  TWCR  = 0x74  ; MEMORY MAPPED
.equ  TWDR  = 0x73  ; MEMORY MAPPED
.equ  TWAR  = 0x72  ; MEMORY MAPPED
.equ  TWSR  = 0x71  ; MEMORY MAPPED
.equ  TWBR  = 0x70  ; MEMORY MAPPED
.equ  OSCCAL  = 0x6f  ; MEMORY MAPPED
.equ  XMCRA  = 0x6d  ; MEMORY MAPPED
.equ  XMCRB  = 0x6c  ; MEMORY MAPPED
.equ  EICRA  = 0x6a  ; MEMORY MAPPED
.equ  SPMCSR  = 0x68  ; MEMORY MAPPED
.equ  PORTG  = 0x65  ; MEMORY MAPPED
.equ  DDRG  = 0x64  ; MEMORY MAPPED
.equ  PING  = 0x63  ; MEMORY MAPPED
.equ  PORTF  = 0x62  ; MEMORY MAPPED
.equ  DDRF  = 0x61  ; MEMORY MAPPED

von Oliver Dievernich (Gast)


Lesenswert?

vielen dank - hat mir sehr geholfen...

von tex (Gast)


Lesenswert?

Also ich habe keine Problem die Ports als Ports anzusprechen. Kann es
sein, dass du im Makefile nicht angegeben hast, dass Du einen mega128
benutzt?

von Matthias (Gast)


Lesenswert?

Hi

er verwendet Assembler. In C ist das transparent abgebildet. Intern
wird aber auch out für alles bis 0x3F verwendet. Darüber geschiet der
Zugriff mittels st/ld. Deswegen sollte man für schnelles Bit-Banging
diese Ports nicht unbedingt verwenden.

Matthias

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.