- Name:
-
hspisetup
- Syntax:
-
HSPISETUP OFF HSPISETUP mode, spispeed
Mode - is a constant/variable to define the mode
spimode00 |
(mode 0,0 - input sampled at middle of data time) |
spimode01 |
(mode 0,1 - input sampled at middle of data time) |
spimode10 |
(mode 1,0 - input sampled at middle of data time) |
spimode11 |
(mode 1,1 - input sampled at middle of data time) |
spimode00e |
(mode 0,0 - input sampled at end of data time) |
spimode01e |
(mode 0,1 - input sampled at end of data time) |
spimode10e |
(mode 1,0 - input sampled at end of data time) |
spimode11e |
(mode 1,1 - input sampled at end of data time) |
Spispeed - is a constant/variable to define the clock speed
spifast |
(clock freq / 4) |
(= 1MHz with 4MHz resonator) |
spimedium |
(clock freq / 16) |
(= 250kHz with 4MHz resonator) |
spislow |
(clock freq / 64) |
(= 63 kHz with 4MHz resonator) |
- Description:
-
The hpisetup command sets the microcontroller's hardware pins to SPI mode. This command setups the microcontroller for SPI transmission via the microcontroller's SPI hardware pins. This method is faster and more code efficient than using the 'bit-banged' spiout (shiftout) command. When connecting SPI devices (e.g. EEPROM) remember that the data-in (SDI) of the EEPROM connects to the data-out (SDO) of the PICAXE, and vice versa.
Advanced Technical Information
Users familiar with assembler code programming may find the following microcontroller information useful (also see the Logic Analyser screenshots in section 2 of the manual).
spimode00 |
(CKP=0, CKE=1, SMP=0) |
Mode (0,0) |
spimode01 |
(CKP=0, CKE=0, SMP=0) |
Mode (0,1) |
spimode10 |
(CKP=1, CKE=1, SMP=0) |
Mode (1,0) |
spimode11 |
(CKP=1, CKE=0, SMP=0) |
Mode (1,1) |
spimode00e |
(CKP=0, CKE=1, SMP=1) |
|
spimode01e |
(CKP=0, CKE=0, SMP=1) |
|
spimode10e |
(CKP=1, CKE=1, SMP=1) |
|
spimode11e |
(CKP=1, CKE=0, SMP=1) |
|