BIN/de

From MCS Wiki AVR
< BIN(Difference between revisions)
Jump to: navigation, search
m (1 revision)
(Example)
 
(5 intermediate revisions by one user not shown)
Line 1: Line 1:
== (**COPIED FROM ENGLISH PAGE**) === <span class="f_Header">Action</span> =
+
= <span class="f_Header">Funktion</span> =
  
Convert a numeric variable into the binary string representation.
+
Wandelt eine numerische Variable in ihre binäre Zeichenkettendarstellung um.
  
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
Line 9: Line 9:
 
= <span class="f_Header">Syntax</span> =
 
= <span class="f_Header">Syntax</span> =
  
Var =&nbsp;<span class="f_Syntax">Bin</span>(source)
+
var =&nbsp;<span class="f_Syntax">Bin</span>(source)
  
 
<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="18%" style="width: 84px; border: 1px solid rgb(0, 0, 0);" |  
 
| valign="top" width="18%" style="width: 84px; border: 1px solid rgb(0, 0, 0);" |  
Var
+
var
  
 
| valign="top" width="100%" style="width: 395px; border: 1px solid rgb(0, 0, 0);" |  
 
| valign="top" width="100%" style="width: 395px; border: 1px solid rgb(0, 0, 0);" |  
The target string that will be assigned with the binary representation of the variable source.
+
Zielzeichenkette der die binäre Darstellung der Quellvariablen zugewiesen wird.
  
 
|- style="vertical-align: top;"
 
|- style="vertical-align: top;"
 
| valign="top" width="18%" style="width: 84px; border: 1px solid rgb(0, 0, 0);" |  
 
| valign="top" width="18%" style="width: 84px; border: 1px solid rgb(0, 0, 0);" |  
Source
+
source
  
 
| valign="top" width="100%" style="width: 395px; border: 1px solid rgb(0, 0, 0);" |  
 
| valign="top" width="100%" style="width: 395px; border: 1px solid rgb(0, 0, 0);" |  
The numeric variable that will be converted.
+
Numerische Variable die umgewandelt werden soll.
  
 
|}
 
|}
Line 38: Line 38:
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
The BIN() function can be used to display the state of a port.
+
Die BIN()-Funktion kann benutzt werden um den Zustand eines Ports anzuzeigen.
  
When the variable source has the value &B10100011 the string named var will be assigned with "10100011".
+
Wenn die Quellvariable den Wert &B10100011 hat dann wird der Zeichenkettenvariablen var die Zeichenkette "10100011" zugewiesen.
  
It can be easily printed to the serial port.
+
Diese kann gut über den seriellen Port ausgegeben werden.
  
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
Line 48: Line 48:
 
<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> =
  
 
[[HEX]]&nbsp;,&nbsp;[[STR]]&nbsp;,&nbsp;[[VAL]]&nbsp;,&nbsp;[[HEXVAL]]&nbsp;,&nbsp;[[BINVAL]]
 
[[HEX]]&nbsp;,&nbsp;[[STR]]&nbsp;,&nbsp;[[VAL]]&nbsp;,&nbsp;[[HEXVAL]]&nbsp;,&nbsp;[[BINVAL]]
Line 56: Line 56:
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
= <span class="f_Header">ASM</span> =
+
= <span class="f_Header">Assembler</span> =
  
 
NONE
 
NONE
Line 64: Line 64:
 
<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">
$regfile = "m48def.dat" ' specify the used micro
+
$regfile = "m48def.dat" ' Mikrocontroller
$crystal = 8000000 ' used crystal frequency
+
$crystal = 8000000 ' 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 78: Line 78:
 
   
 
   
 
Dim B As Byte
 
Dim B As Byte
' assign value to B
+
' Wert 45 der Variablen 45 zuweisen:
 
B = 45
 
B = 45
 
   
 
   
 
Dim S As String * 10
 
Dim S As String * 10
'convert to string
+
'In String umwandeln:
 
S = Bin(b)
 
S = Bin(b)
 
   
 
   
'assign value to portb
+
'Wert an portb zuweisen:
 
Portb = 33
 
Portb = 33
 
Print Bin(portb)
 
Print Bin(portb)
 
   
 
   
'of course it also works for other numerics
+
'Natürlich geht das auch mit anderen Zahlen.
 
End
 
End
 
</source><br/>{{Languages}}
 
</source><br/>{{Languages}}
  
 
[[Category:BASCOM_Language_Reference/de]]
 
[[Category:BASCOM_Language_Reference/de]]

Latest revision as of 00:18, 2 March 2013

Contents

Funktion

Wandelt eine numerische Variable in ihre binäre Zeichenkettendarstellung um.

 

 

Syntax

var = Bin(source)

 

 

Anmerkungen

var

Zielzeichenkette der die binäre Darstellung der Quellvariablen zugewiesen wird.

source

Numerische Variable die umgewandelt werden soll.

 

 

Die BIN()-Funktion kann benutzt werden um den Zustand eines Ports anzuzeigen.

Wenn die Quellvariable den Wert &B10100011 hat dann wird der Zeichenkettenvariablen var die Zeichenkette "10100011" zugewiesen.

Diese kann gut über den seriellen Port ausgegeben werden.

 

 

Siehe auch

HEX , STR , VAL , HEXVAL , BINVAL

 

 

Assembler

NONE

 

 

Beispiel


$regfile = "m48def.dat" ' Mikrocontroller
$crystal = 8000000 ' 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
 
Config Com1 = Dummy , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0
 
 
Dim B As Byte
' Wert 45 der Variablen 45 zuweisen:
B = 45
 
Dim S As String * 10
'In String umwandeln:
S = Bin(b)
 
'Wert an portb zuweisen:
Portb = 33
Print Bin(portb)
 
'Natürlich geht das auch mit anderen Zahlen.
End

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