READ/de

From MCS Wiki AVR
< READ(Difference between revisions)
Jump to: navigation, search
(Created page with "= <span class="f_Header">Action</span> = Reads those values and assigns them to variables. <span style="font-family: Arial;"> </span> <span style="font-family: Arial;"...")
 
(Example)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== (**COPIED FROM ENGLISH PAGE**) === <span class="f_Header">Action</span> =
+
= <span class="f_Header">Funktion</span> =
  
Reads those values and assigns them to variables.
+
Liest einen Wert und weist ihn der Variablen zu.
  
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
Line 15: Line 15:
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
= <span class="f_Header">Remarks</span> =
+
= <span class="f_Header">Anmerkungen</span> =
 
<div style="padding: 0px; margin: 0px 0px 0px 4px;">
 
<div style="padding: 0px; margin: 0px 0px 0px 4px;">
 
{| width="488" cellspacing="0" cellpadding="1" border="1" style="border: 2px solid rgb(0, 0, 0); border-spacing: 0px; border-collapse: collapse;"
 
{| width="488" cellspacing="0" cellpadding="1" border="1" style="border: 2px solid rgb(0, 0, 0); border-spacing: 0px; border-collapse: collapse;"
 
|- style="vertical-align: top;"
 
|- style="vertical-align: top;"
 
| valign="top" width="17%" style="width: 79px; border: 1px solid rgb(0, 0, 0);" |  
 
| valign="top" width="17%" style="width: 79px; border: 1px solid rgb(0, 0, 0);" |  
Var
+
var
  
 
| valign="top" width="100%" style="width: 400px; border: 1px solid rgb(0, 0, 0);" |  
 
| valign="top" width="100%" style="width: 400px; border: 1px solid rgb(0, 0, 0);" |  
Variable that is assigned data value.
+
Variable der der Wert zugewiesen wird.
  
 
|}
 
|}
Line 29: Line 29:
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
It is best to place the&nbsp;[[DATA]]&nbsp;lines at the end of your program.
+
Es ist am besten, die [[DATA]] Zeilen am Ende des Programms zu schreiben.  
  
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
[[File:Notice.jpg|left|Notice.jpg]]&nbsp;It is important that the variable is of the same type as the stored data.
+
[[File:Notice.jpg|left|Notice.jpg]]Es ist sehr wichtig, dass die Variable denselben Datentyp hat wie die Daten in der Tabelle.
  
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
Line 41: Line 41:
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
= <span class="f_Header">See also</span> =
+
= <span class="f_Header">Siehe auch</span> =
  
 
[[DATA]]&nbsp;,&nbsp;[[RESTORE]]
 
[[DATA]]&nbsp;,&nbsp;[[RESTORE]]
Line 49: Line 49:
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
= <span class="f_Header">Example</span> =
+
= <span class="f_Header">Beispiel</span> =
  
 
<br/><source lang="bascomavr">
 
<br/><source lang="bascomavr">
Line 61: Line 61:
 
'-----------------------------------------------------------------------------------------
 
'-----------------------------------------------------------------------------------------
 
   
 
   
$regfile = "m48def.dat" ' specify the used micro
+
$regfile = "m48def.dat" ' Mikrocontroller
$crystal = 4000000 ' used crystal frequency
+
$crystal = 4000000 ' Taktfrequenz
$baud = 19200 ' use baud rate
+
$baud = 19200 ' Baudrate
 
$hwstack = 32 ' default use 32 for the hardware stack
 
$hwstack = 32 ' default use 32 for the hardware stack
 
$swstack = 10 ' default use 10 for the SW stack
 
$swstack = 10 ' default use 10 for the SW stack
Line 71: Line 71:
 
Dim S As String * 15
 
Dim S As String * 15
 
Dim L As Long
 
Dim L As Long
Restore Dta1 'point to stored data
+
Restore Dta1 'Zeiger auf gespeicherte Daten setzen
For Count = 1 To 3 'for number of data items
+
For Count = 1 To 3 'Für jedes Datenelement
 
Read B1 : Print Count ; " " ; B1
 
Read B1 : Print Count ; " " ; B1
 
Next
 
Next
 
   
 
   
Restore Dta2 'point to stored data
+
Restore Dta2 'Zeiger aud Datentabelle setzen
For Count = 1 To 2 'for number of data items
+
For Count = 1 To 2 'Für jedes Datenelement
 
Read A : Print Count ; " " ; A
 
Read A : Print Count ; " " ; A
 
Next
 
Next
Line 106: Line 106:
 
Dta3:
 
Dta3:
 
Data "Hello" , "World"
 
Data "Hello" , "World"
'Note that integer values (>255 or <0) must end with the %-sign
+
'Zu beachten: Integer-Werte (>255 or <0) müssen mit einem %-Zeichen enden.
'also note that the data type must match the variable type that is
+
'Auch zu beachten: Der Datentyp muss dem Datentyp der Variablen im READ-Befehl entsprechen.
'used for the READ statement
+
 
   
 
   
 
Dta4:
 
Dta4:
 
Data 123456789&
 
Data 123456789&
'Note that LONG values must end with the &-sign
+
'Zu beachten: LONG-Werte müssen mit einem &-Zeichen enden.
'Also note that the data type must match the variable type that is used
+
'Auch zu beachten: Der Datentyp muss dem Datentyp der Variablen im READ-Befehl entsprechen.
'for the READ statement
+
 
</source><br/>{{Languages}}
 
</source><br/>{{Languages}}
  
 
[[Category:BASCOM Language Reference/de]]
 
[[Category:BASCOM Language Reference/de]]

Latest revision as of 23:41, 5 March 2013

Contents

Funktion

Liest einen Wert und weist ihn der Variablen zu.

 

 

Syntax

READ var

 

 

Anmerkungen

var

Variable der der Wert zugewiesen wird.

 

Es ist am besten, die DATA Zeilen am Ende des Programms zu schreiben.

 

Notice.jpg
Es ist sehr wichtig, dass die Variable denselben Datentyp hat wie die Daten in der Tabelle.

 

 

 

Siehe auch

DATA , RESTORE

 

 

Beispiel


'-----------------------------------------------------------------------------------------
'name : readdata.bas
'copyright : (c) 1995-2005, MCS Electronics
'purpose : demo : READ,RESTORE
'micro : Mega48
'suited for demo : yes
'commercial addon needed : no
'-----------------------------------------------------------------------------------------
 
$regfile = "m48def.dat" ' Mikrocontroller
$crystal = 4000000 ' Taktfrequenz
$baud = 19200 ' Baudrate
$hwstack = 32 ' default use 32 for the hardware stack
$swstack = 10 ' default use 10 for the SW stack
$framesize = 40 ' default use 40 for the frame space
 
Dim A As Integer , B1 As Byte , Count As Byte
Dim S As String * 15
Dim L As Long
Restore Dta1 'Zeiger auf gespeicherte Daten setzen
For Count = 1 To 3 'Für jedes Datenelement
Read B1 : Print Count ; " " ; B1
Next
 
Restore Dta2 'Zeiger aud Datentabelle setzen
For Count = 1 To 2 'Für jedes Datenelement
Read A : Print Count ; " " ; A
Next
 
Restore Dta3
Read S : Print S
Read S : Print S
 
 
Restore Dta4
Read L : Print L 'long type
 
 
'demonstration of readlabel
Dim W As Iram Word At 8 Overlay ' location is used by restore pointer
'note that W does not use any RAM it is an overlayed pointer to the data pointer
W = Loadlabel(dta1) ' loadlabel expects the labelname
Read B1
Print B1
End
 
 
Dta1:
Data &B10 , &HFF , 10
Dta2:
Data 1000% , -1%
 
Dta3:
Data "Hello" , "World"
'Zu beachten: Integer-Werte (>255 or <0) müssen mit einem %-Zeichen enden.
'Auch zu beachten: Der Datentyp muss dem Datentyp der Variablen im READ-Befehl entsprechen.
 
Dta4:
Data 123456789&
'Zu beachten: LONG-Werte müssen mit einem &-Zeichen enden.
'Auch zu beachten: Der Datentyp muss dem Datentyp der Variablen im READ-Befehl entsprechen.

Languages   English Deutsch  
Personal tools
Namespaces
Variants
Actions
Navigation
In other languages
Language