Mikroelektronika MIKROE-724 データシート

ページ / 726
mikroBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
153
Prototype
sub function TestBit(dim register_, rbit as byte) as byte
Description
Function tests if the bit 
rbit
 of 
register
 is set. If set, function returns 1, otherwise returns 0. 
Parameter 
rbit
 needs to be a variable or literal with value 0..7. See Predefined globals and constants 
for more information on register identifiers.
This is an “inline” routine; code is generated in the place of the call, so the call doesn’t count against 
the nested call limit.
Parameters
-
 register_
: desired register
-
 rbit
: desired bit
Returns
If the bit is set, returns 1, otherwise returns 0.
Requires
Nothing.
Example
flag = TestBit(PORTE, 2)  ‘ 1 if RE2 is set, otherwise 0
Notes
None.
TestBit
Prototype
sub procedure Delay_us(const time_in_us as longword)
Description
Creates a software delay in duration of 
Time_In_us
 microseconds.
This is an “inline” routine; the code is generated in the place of the call, so the call doesn’t count 
against the nested call limit.
Parameters
time_in_us
:  delay  time  in  microseconds.  Valid  values:  constant  values,  range  of  applicable 
constants depends on the oscillator frequency 
Returns
Nothing.
Requires
Nothing.
Example
Delay_us(1000)  ‘ One millisecond pause
Notes
None.
Delay_us
Prototype
sub procedure Delay_ms(const time_in_ms as longword)
Description
Creates a software delay in duration of 
Time_In_ms
 milliseconds.
This is an “inline” routine; the code is generated in the place of the call, so the call doesn’t count 
against the nested call limit.
Parameters
Time_in_ms
: delay time in milliseconds. Valid values: constant values, range of applicable constants 
depends on the oscillator frequency 
Returns
Nothing.
Requires
Nothing.
Example
Delay_ms(1000)  ‘ One second pause
Notes
For generating delays with variable as input parameter use the Vdelay_ms routine.
Delay_ms