kann mir jeamand helfen? ich will einen text über die serielle hinausschreiben in assembler sprachen ich benutze den mc68hc908jl8 also ich will zum beispiel hallo hinausschreiben und jedertext endet bei mir mit einem chr(10). das mit den registern habe ich schun gemacht ich schaffe es auch einen einzelnen buchstaben hinauszuschreiben aber ich weiß nicht wie ich einen ganzen text hinausschreiben kann. lda SCS1 mov #'A',SCDR rts so schreibe ich den buchstaben hinaus beim text muss man noch das transmission complete einschalten oder?
Hi,
so kannst Du das Beispiel bei Freescale Downloaden.
************************************************************************
** APPS NOTE AN1274
** SCI EXAMPLE
**
** This program illustrates the basic operation of transmitting and
** receiving data packets using the SCI on the 68HC708XL36 with CGMA.
** Assembled with IASM08 Ver. 3.03
************************************************************************
BAUD EQU $00 ; Baud rate set to default value.
SCC1 EQU $13 ; SCI Control Register 1
LOOPS EQU 7 ; Bit 7: Loop Mode Select Bit
ENSCI EQU 6 ; Bit 6: Enable SCI Bit
TXINV EQU 5 ; Bit 5: Transmit Inversion Bit
M EQU 4 ; Bit 4: Mode (Character Length) Bit
WAKE EQU 3 ; Bit 3: Wake-up Condition Bit
ILTY EQU 2 ; Bit 2: Idle Line Type Bit
PEN EQU 1 ; Bit 1: Parity Enable Bit
PTY EQU 0 ; Bit 0: Parity bit
SCC2 EQU $14 ; SCI Control Register 2
SCTIE EQU 7 ; Bit 7: SCI transmit Interrupt Enable
Bit
TCIE EQU 6 ; Bit 6: Transmission Complete
Interrupt Enable
; Bit
SCRIE EQU 5 ; Bit 5: SCI Receive Interrupt Enable
Bit
ILIE EQU 4 ; Bit 4: Idle Line Interrupt Enable
Bit
TE EQU 3 ; Bit 3: Transmitter Enable Bit
RE EQU 2 ; Bit 2: Receiver Enable Bit
RWU EQU 1 ; Bit 1: Receiver Wake Up Bit
SBK EQU 0 ; Bit 0: Send Break Bit
SCC3 EQU $15 ; SCI Control Register 3
R8 EQU 7 ; Bit 7: Received Bit 8
T8 EQU 6 ; Transmitted Bit 8
DMARE EQU 5 ; Bit 5: DMA Receive Enable Bit
DMATE EQU 4 ; Bit 4: DMA Transfer Enable Bit
ORIE EQU 3 ; Bit 3: Receiver Overrun Interrupt
Enable Bit
NEIE EQU 2 ; Bit 2: Receiver Noise Error Interrupt
Enable
; Bit
FEIF EQU 1 ; Bit 1: Receiver Framing Error
Interrupt Enable
; Bit
PEIE EQU 0 ; Bit 0: Receiver Parity Error
Interrupt Enable
; Bit
SCS1 EQU $16 ; SCI Status Register 1
SCTE EQU 7 ; Bit 7: SCI Transmitter Empty Bit
TC EQU 6 ; Bit 6: Transmission Complete Bit
SCRF EQU 5 ; Bit 5: SCI Receiver Full Bit
IDLE EQU 4 ; Bit 4: Receiver Idle Bit
OR EQU 3 ; Bit 3: Receiver Overrun Bit
NF EQU 2 ; Bit 2: Receiver Noise Bit
FE EQU 1 ; Bit 1: Receiver Framing Error Bit
PE EQU 0 ; Bit 0P: Receiver Parity Error Bit
SCS2 EQU $17 ; SCI Status Register 2
BKF EQU 1 ; Bit 1: Break Flag Bit
RPF EQU 0 ; Bit 0: Reception in Process Flag Bit
SCDR EQU $18 ; SCI Data Register
SCBR EQU $19 ; SCI Baud Rate Register
----------------------------------------------------------------------
ORG $6E00 ; Beginning of EPROM space on
XL36
DATA fcb 'This is a test'
fcb 13
initscitx: lda #$01
sta $1f ; Disable COP
lda #BAUD
sta SCBR
bset ENSCI,SCC1 ; Enable SCI
bset TE,SCC2 ; Enable Transmit
lda SCS1 ; Clear SCI Transmitter Empty
Bit
ldx #$00 ; Index Counter
getbyte: lda DATA,x ; Get the packet from "DATA{
incx ; Increment counter to get next
data byte
brclr SCTE,SCS1,* ; Wait until transmitter is
ready
sta SCDR ; Store Data in SCI Data
Register
cmp #$0D ; Is this the end of the
packet?
bne getbyte ; If not, then get another byte
to send
brclr TC,SCS1,* ; Wait for transmitter to finish
bclr TE,SCC2 ; Stop the transmitter
lda #$00
sta SCDR ; Clear the SCI Data Register
initscirx: bset ENSCI,SCC1 ; Enable SCI
bset RE,SCC2 ; Set Receive Enable
ldx #$00 ; Setup the index counter
**** Check the received character ****
next: brclr SCRF,SCS1,* ;Wait here until a chr comes
lda SCDR ; Get the Data from the SCI
Data Register
sta $50,x ; Store the data in RAM
cmp DATA,x ; Error checking
bne bad ; Run "bad" routine if data is bad
back: incx ; Increment index register to
receive next
; byte
cmp #$0D ; Is the data received the
"END of
; Packet"?
bne next ; If not then get next byte of
the packet
bclr RE,SCC2 ; Turn off the receiver
jmp initscitx ; Go back to the beginning.
************************************************************************
** bad routine
**
** This subroutine turns on an LED if an error has occurred.
************************************************************************
bad: stx $90 ; Save index register for later use
ldx #$ff
stx $00 ; Port A Data Direction
Register-output
stx $04 ; Port A Data Register - HIGH
ldx $90 ; Restore Index Register
bra back ; Always go back to main
program
************************************************************************
** Reset Vectors
**
************************************************************************
org $fffe
fdb initscitx
end
Eckhard
das prinzip habe ich verstanden aber diese befehlzeile nicht ganz
getbyte: lda DATA,x ; Get the packet from "DATA{
habe ich das richtig verstanden in DATA steht mein Text drinnen und
dann wird der erste wert darin in das hx register geschrieben oder?
Hi! Jein! Data ist eine Adresse(momentan $6E00) X wird vor dem lesen mit 0 initialisiert und dann als Zeiger benutzt. Data ist dabei der Offset zu X. Also X(0)+Adresse Data($6E00) dann wird bei lda Data,x der Inhalt der Speicheradresse $6E00 nach a geladen und später über die Serielle ausgegeben. Zwischendurch wird x um 1 erhöht und wenn das Ende deines Textes nicht erreicht ist: cmp #$0D ; Is this the end of the bne getbyte ; If not, then get another byte geht es bei getbyte weiter nur das X jetzt eben 1 ist und 1+$6E00=$6E01. Hoffe du kommst klar damit. MFG Uwe
ach jetzt habe ich es so großteils durchblickt danke für die hilfe einstweilen ich meld mich dann wieder wenn ich weitere schwierigkeiten habe beim empfangen funzt das so ähnlich oder
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
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.