BITWAIT/de
From MCS Wiki AVR
< BITWAIT
Revision as of 01:32, 5 March 2013 by Stefanhamburg (Talk | contribs)
Contents |
Funktion
Warten bis ein Bit gesetzt (1) bzw. gelöscht (0) ist.
Syntax
BITWAIT x , SET/RESET
Anmerkungen
s |
Bit-Variable oder internes Register wie z.B. PORTB.x , wobei x im Bereich von 0 bis 7 ist. |
Wenn eine Bit-Variable benutzt wird dann muss sichergestellt werden, dass die Bit-Variable per Programm gesetzt/gelöscht wird weil das Programm sonst endlos wartet.
Wenn ein internes Register benutzt wird das durch Hardware gesetzt/gelöscht werden kann wie z.B. PinB.0 dann trifft das nicht zu weil der Zustand sich zum Beispiel durch einen Tastendruck verändern kann.
See also
NONE
ASM
Calls: NONE
Input: NONE
Output: NONE
Code : shown for address 0-31
label1:
Sbic PINB.0,label2
Rjmp label1
Label2:
Example
$regfile = "m48def.dat" ' specify the used micro $crystal = 8000000 ' used crystal frequency $baud = 19200 ' use baud rate $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 A As Bit Bitwait A , Set 'wait until bit a is set 'the code above will loop forever since the bit 'A' is not set in software 'it could be set in an ISR routine Bitwait Pinb.7 , Reset 'wait until bit 7 of Port B is 0. End
Languages | English • Deutsch |
---|