User`s manual
mikroBASIC
- Basic Compiler for Microchip PIC microcontrollers
Example:
SPI_init(Master_OSC_div4, Data_SAMPLE_MIDDLE,LK_Idle_LOW,LOW_2_HIGH)
This will set SPI to master mode, clock = Fosc/4, data sampled at the middle of
interval, clock idle state low and data transmitted at low to high edge.
Parameter mast_slav determines the work mode for SPI; can have the following
values:
Parameter Data_sample determines when data is sampled. It can have the follow-
ing values:
Parameter clk_idl determines idle state for clock; can have the following values:
MikroElektronika:
Development
tools
-
Books
-
Compilers
mikroBASIC
making it simple...
157
page
Parameters
Value Meaning
Master_OSC_div4 Master clock=Fosc/4
Master_OSC_div16 Master clock=Fosc/16
Master_OSC_div64 Master clock=Fosc/64
Master_TMR2 Master clock source TMR2
Slave_SS_ENABLE Master slave select enabled
Slave_SS_DIS Master slave select disabled
Value Meaning
Data_SAMPLE_MIDDLE Input data sampled in middle of interval
Data_SAMPLE_END Input data sampled at end of interval
Value Meaning
CLK_Idle_HIGH Clock idle HIGH
CLK_Idle_LOW Clock idle LOW