SET/de
(Difference between revisions)
(→(**COPIED FROM ENGLISH PAGE**) =) |
(→Remarks) |
||
Line 27: | Line 27: | ||
| valign="top" style="border: 1px solid rgb(0, 0, 0);" | | | valign="top" style="border: 1px solid rgb(0, 0, 0);" | | ||
− | Bit | + | Bit oder Boolean Variable. |
|- style="vertical-align: top;" | |- style="vertical-align: top;" | ||
Line 34: | Line 34: | ||
| valign="top" style="height: 16px; border: 1px solid rgb(0, 0, 0);" | | | valign="top" style="height: 16px; border: 1px solid rgb(0, 0, 0);" | | ||
− | + | Eine Byte-, Integer-, Word- oder Long-Variable. | |
|- style="vertical-align: top;" | |- style="vertical-align: top;" | ||
Line 41: | Line 41: | ||
| valign="top" style="border: 1px solid rgb(0, 0, 0);" | | | valign="top" style="border: 1px solid rgb(0, 0, 0);" | | ||
− | Bit | + | Bit der Variablen das gesetzt werden soll. Gültige Werte sind: 0-7 (byte, registers), 0-15 (Integer/Word) und (0-31) für Long |
− | + | ||
|} | |} | ||
</div> | </div> | ||
Line 49: | Line 48: | ||
<span style="font-family: Arial;"> </span> | <span style="font-family: Arial;"> </span> | ||
− | + | Wenn das Bit nicht angegeben wird dann wird Bit 0 gesetzt. | |
+ | |||
+ | Zu beachten ist, dass der Bit-Bereich 0-255 ist. Die Benutzung eines größeren Wertes überschreibt eine andere Variable! | ||
− | + | Wenn Sie ein Array von zum Beispiel 128 Bits benötigen dann können Sie folgendes verwenden: dim ar(32) as long | |
− | + | Sie können dann folgendermaßen zugreifen: SET ar(1).127 | |
− | + | Es wird nur auf den Speicherplatz der gewünschten Variable zugegriffen. | |
| |
Revision as of 23:48, 19 February 2013
Contents |
Funktion
Setzt ein Bit auf den Wert eins.
Syntax
SET bit
SET var.x
SET var
Remarks
Bit |
Bit oder Boolean Variable. |
Var |
Eine Byte-, Integer-, Word- oder Long-Variable. |
X |
Bit der Variablen das gesetzt werden soll. Gültige Werte sind: 0-7 (byte, registers), 0-15 (Integer/Word) und (0-31) für Long |
Wenn das Bit nicht angegeben wird dann wird Bit 0 gesetzt.
Zu beachten ist, dass der Bit-Bereich 0-255 ist. Die Benutzung eines größeren Wertes überschreibt eine andere Variable!
Wenn Sie ein Array von zum Beispiel 128 Bits benötigen dann können Sie folgendes verwenden: dim ar(32) as long
Sie können dann folgendermaßen zugreifen: SET ar(1).127
Es wird nur auf den Speicherplatz der gewünschten Variable zugegriffen.
See also
Example
'-------------------------------------------------------------------------------- 'name : boolean.bas 'copyright : (c) 1995-2009, MCS Electronics 'purpose : demo: AND, OR, XOR, NOT, BIT, SET, RESET and MOD 'suited for demo : yes 'commercial add on needed : no 'use in simulator : possible '-------------------------------------------------------------------------------- 'This very same program example can be used in the Help-files for ' AND, OR, XOR, NOT, BIT, SET, RESET and MOD $baud = 19200 $crystal = 16000000 $regfile = "m32def.dat" $hwstack = 40 $swstack = 20 $framesize = 20 Dim A As Byte , B1 As Byte , C As Byte Dim Aa As Bit , I As Integer A = 5 : B1 = 3 ' assign values C = A And B1 ' and a with b Print "A And B1 = " ; C ' print it: result = 1 C = A Or B1 Print "A Or B1 = " ; C ' print it: result = 7 C = A Xor B1 Print "A Xor B1 = " ; C ' print it: result = 6 A = 1 C = Not A Print "c = Not A " ; C ' print it: result = 254 C = C Mod 10 Print "C Mod 10 = " ; C ' print it: result = 4 If Portb.1 = 1 Then Print "Bit set" Else Print "Bit not set" End If 'result = Bit not set Aa = 1 'use this or .. Set Aa 'use the set statement If Aa = 1 Then Print "Bit set (aa=1)" Else Print "Bit not set(aa=0)" End If 'result = Bit set (aa=1) Aa = 0 'now try 0 Reset Aa 'or use reset If Aa = 1 Then Print "Bit set (aa=1)" Else Print "Bit not set(aa=0)" End If 'result = Bit not set(aa=0) C = 8 'assign variable to &B0000_1000 Set C 'use the set statement without specifying the bit Print C 'print it: result = 9 ; bit0 has been set B1 = 255 'assign variable Reset B1.0 'reset bit 0 of a byte variable Print B1 'print it: result = 254 = &B11111110 B1 = 8 'assign variable to &B00001000 Set B1.0 'set it Print B1 'print it: result = 9 = &B00001001 End
Languages | English • Deutsch |
---|