Guten Abend,
ich habe da ein kleines Problemchen , eigentlich sinds 2, aber das 2te
lass ich noch für den moment. Ich möchte gerne über SEROUT Daten
rausschicken und habe dies mit Port E.0 und D.3 versucht, bei beiden das
gleiche Ergebniss. Im Terminal kam überhaupt nichts raus, ich hänge euch
mein Code mal an, syntaktisch sollte der eigentlich stimmen, aber wieso
das nicht funktioniert weiss ich auch nicht. (kompatibilitätsmodus ist
auch ausgeschaltet)
1
$regfile = "m128def.dat"
2
$crystal = 16000000
3
Baud = 9600
4
5
Dim Haha As String * 10
6
Goto Test1
7
8
9
Test1:
10
11
Do
12
Haha = "haha"
13
Serout Haha , 4 , D , 1 , 9600 , 0 , 8 , 1
14
Loop
Und das 2te Problem trat eigentlich noch früher auf, als das, welches
ich oben beschrieben habe. Es ging eigentlich um genau gleiche mit dem
kleinen Unterschied, das es anstatt des String's ein Array von 4
Integern war. Fehlermeldung : Array expected, hmmmm.... hab ich ned
kapiert.. den ein Array hat er ja bekommen.
Definiert war dies folgendermassen
1
Dim Sendbyte(4) As Integer
2
3
4
'Inhalt von Sendbyte wurde folgendermassen gefüllt
>habe dies mit Port E.0 und D.3 versucht
Da kommst Du aber nicht raus, sondern auf Port D.1
Der String ist aber nur 4 Zeichen lang und bei Dir ist er auf 10
dimensioniert. Das "GOTO" brauchst Du da auch nicht, er kommt sowieso
von allein zu dem Label "Test1"
Versuche mal diese Zeile:
Serout Haha , 0 , E , 0 , 9600 , 0 , 8 , 1
MfG Paul
Hallo Peter, danke für deine Antwort,
folgendes: die Sache mit der Variabelgrösse habe ich übersehen, die
Sache mit dem Goto ist gewollt, weil da noch mehrere Übungen hinsollen
und ich mit diesem goto dann sehr einfach steuern kann wohin das
programm geht.
Zum Problem:
1
$regfile = "m128def.dat"
2
$crystal = 16000000
3
Baud = 9600
4
5
Dim Haha As String * 4
6
Goto Test1
7
8
9
Test1:
10
11
Do
12
Haha = "haha"
13
Serout Haha , 4 , D , 1 , 9600 , 0 , 8 , 1
14
Loop
erzueugt überhaupt keine Ausgabe
1
Serout Haha , 0 , D , 1 , 9600 , 0 , 8 , 1
2
Serout Haha , 0 , E , 0 , 9600 , 0 , 8 , 1
3
Serout Haha , 4 , E , 0 , 9600 , 0 , 8 , 1
4
Serout Haha , 0 , D , 3 , 9600 , 0 , 8 , 1
5
Serout Haha , 4 , D , 3 , 9600 , 0 , 8 , 1
diese codezeilen hier erzeugen ebenfalls keine Ausgabe im Terminal
Ich habe nun wirklich alles ausprobiert und vom Datenblatt des Prozesors
wären ja eigentlich die Ports E1 und D3 di UART-Transmitt Pins.
Korriegiert mich bitte wenn ich mit meiner Logik eventuell Unsinn
anrichte. Aber es kann doch nicht sein dass auf allen ausgabepins nix
kommt.
Grüsse
Daniel
wenn du $baud schreibst ists sowieso essig mit
serout auf den uart pins, weil die dann nicht auf
standard I-O sondern auf UART belegt werden.
alternativ kannste mal $baud=9600 und $baud1=9600
setzen und dann per print "haha" und print #1, "duda"
die hardwareuart testen.
dann gibts da noch das problem mit der fuse
m103-compatibility, die sollte deaktiviert sein.
Mal ein paar Sätze aus der Bascom Hilfe zu "Serout":
String variables will wait for a return (ASCII 13). There is no check
if the variable you assign is big enough to hold the result.
Serout S , 0 , D , 1 , Mybaud , 0 , 8 , 1
' ^ 1 stop bit
' ^---- 8 data bits
' ^------ even parity (0=N, 1 = E, 2=O)
' ^-------------- baud rate
' ^-------------------- pin number
' ^----------------------- port so PORTA.0 and PORTA.1 are
used
' ^--------------------------- for strings pass 0
' ^-------------------------------- variable
@Ich weiß es
Nein, Du weißt es nicht! Auch eine sog. "vernünftige" Programmiersprache
gibt nichts auf den "richtigen" Portpin aus, wenn der falsche
angesprochen wird.
Paul
@ Ich weis es (Gast)
dann halt dich doch aus bascom threads raus ...
was soll denn das unproduktive genöle.
zieh dir dein c doch die nase hoch wenns dich
glücklich macht. ... bei c kommt mir im übrigen
was hoch was ich hier nicht tippen möchte.
@Paul:
Die Serrouthilfe hab ich mir in meine Bascombuch durchgeschaut und mein
Befehl eigentlich genau auf dem Beispiel von da zusammengeschraubt. Nur
verstehe ich nicht wieso da auf der Konsole nichts dabei herauskommt.
Muss ich da etwa in irgend einem Register noch was umschalten?
Der Kompatibilitätsmodus ist schon lange draussen, alle möglichen
Ausgabebins habe ich versucht... ich weiss ned weiter
(ATmega128)
The pins PE1 is the TX pin of the first hardware USART.
The pins PD3 is the TX pin of the second hardware USART.
The Bascom SEROUT command is a software UART. There is no
need to use this command if you are using the pins of the
built-in hardware USART.
Try this code and make sure you are using a TTL>RS232 level
shifter like a MAX232 chip.
To use both hardware USARTs, see the Bascom sample "m128.bas"
located in the folder ...BASCOM-AVR\SAMPLES\CHIPS\.
Note that in ATmega103 compatibility mode, the second USART is
not available. (Disable the M103 compatibility mode via fuse bit).
If you still need a software UART, then see the sample "serin_out.bas"
located in the folder ...BASCOM-AVR\SAMPLES\SERIAL\
My Hero Anonymous :),
Since I began with this Story of Serout Serin UART e.c., i wasnt' as
close as now by the end then now.
Now my Terminal, at least becomes something from the Board, but every
time the same crappy shit. Instead of Hello, he prints that funny
symbols as you can see in the attachment. What could that be?
Thanks for your help
Daniel
You are using the wrong clock source. The ATmega128
is shipped with the internal RC oscillator at 1 MHz.
(The chip is shipped with the internal RC oscillator enabled).
Verify the fuse bytes.
If the chip is running at 1 MHz, then try this code: