BIN/de
From MCS Wiki AVR
< BIN(Difference between revisions)
m (1 revision) |
(→Example) |
||
(5 intermediate revisions by one user not shown) | |||
Line 1: | Line 1: | ||
− | + | = <span class="f_Header">Funktion</span> = | |
− | + | Wandelt eine numerische Variable in ihre binäre Zeichenkettendarstellung um. | |
<span style="font-family: Arial;"> </span> | <span style="font-family: Arial;"> </span> | ||
Line 9: | Line 9: | ||
= <span class="f_Header">Syntax</span> = | = <span class="f_Header">Syntax</span> = | ||
− | + | var = <span class="f_Syntax">Bin</span>(source) | |
<span style="font-family: Arial;"> </span> | <span style="font-family: Arial;"> </span> | ||
Line 15: | Line 15: | ||
<span style="font-family: Arial;"> </span> | <span style="font-family: Arial;"> </span> | ||
− | = <span class="f_Header"> | + | = <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 | |
| 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);" | | ||
− | + | 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 | |
| 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);" | | ||
− | + | Numerische Variable die umgewandelt werden soll. | |
|} | |} | ||
Line 38: | Line 38: | ||
<span style="font-family: Arial;"> </span> | <span style="font-family: Arial;"> </span> | ||
− | + | 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. | |
<span style="font-family: Arial;"> </span> | <span style="font-family: Arial;"> </span> | ||
Line 48: | Line 48: | ||
<span style="font-family: Arial;"> </span> | <span style="font-family: Arial;"> </span> | ||
− | = <span class="f_Header"> | + | = <span class="f_Header">Siehe auch</span> = |
[[HEX]] , [[STR]] , [[VAL]] , [[HEXVAL]] , [[BINVAL]] | [[HEX]] , [[STR]] , [[VAL]] , [[HEXVAL]] , [[BINVAL]] | ||
Line 56: | Line 56: | ||
<span style="font-family: Arial;"> </span> | <span style="font-family: Arial;"> </span> | ||
− | = <span class="f_Header"> | + | = <span class="f_Header">Assembler</span> = |
NONE | NONE | ||
Line 64: | Line 64: | ||
<span style="font-family: Arial;"> </span> | <span style="font-family: Arial;"> </span> | ||
− | = <span class="f_Header"> | + | = <span class="f_Header">Beispiel</span> = |
<br/><source lang="bascomavr"> | <br/><source lang="bascomavr"> | ||
− | $regfile = "m48def.dat" ' | + | $regfile = "m48def.dat" ' Mikrocontroller |
− | $crystal = 8000000 ' | + | $crystal = 8000000 ' Taktfrequenz |
− | $baud = 19200 ' | + | $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 | ||
− | ' | + | ' Wert 45 der Variablen 45 zuweisen: |
B = 45 | B = 45 | ||
Dim S As String * 10 | Dim S As String * 10 | ||
− | ' | + | 'In String umwandeln: |
S = Bin(b) | S = Bin(b) | ||
− | ' | + | 'Wert an portb zuweisen: |
Portb = 33 | Portb = 33 | ||
Print Bin(portb) | Print Bin(portb) | ||
− | ' | + | '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 |
---|