Action
Reset a bit to zero.
Syntax
RESET bit
RESET var.x
Remarks
bit |
Can be a SFR such as PORTB.x, or any bit variable where x=0-7. |
var |
Can be a byte, integer word or long variable. |
x |
Constant of variable to reset.(0-7) for bytes and (0-15) for Integer/Word. For longs(0-31) |
You can also use the constants from the definition file to set or reset a bit.
RESET PORTB.PB7 'will reset bin 7 of portB. This because PB7 is a constant in the def file.
See also
Example
'--------------------------------------------------------------------------------
'name : boolean.bas
'copyright : (c) 1995-2005, MCS Electronics
'purpose : demo: AND, OR, XOR, NOT, BIT and MOD
'suited for demo : yes
'commercial addon needed : no
'use in simulator : possible
'--------------------------------------------------------------------------------
$regfile = "m48def.dat" ' specify the used micro
$crystal = 4000000 ' 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
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 c = " ; C ' print result
C = A Or B1 'also for or
Print "a OR b1 = " ; C
C = A Xor B1 ' and for xor
Print "a XOR b1 = " ; C
A = 1
C = Not A 'not
Print "c = NOT a " ; C
C = C Mod 10
Print "c MOD 10 = " ; C
If Portb.1 = 1 Then
Print "Bit set"
Else
Print "Bit not set"
End If
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
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
B1 = 255 'assign variable
Reset B1.0 'reset bit 0 of a byte variable
Print B1 'print it
Set B1.0 'set it
Print B1 'print it
End