Author | Sebastien Lelong Copyright © 2011, all rights reserved. |
Adapted-by | |
Compiler | 2.4n |
SPI Master hardware control. Routines for sending and receiving through the SPI in master mode, using MSSP2
good overview of SPI at http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus also at: http://elm-chan.org/docs/spi_e.html
this is a rough duplication of spi_master_hw.jal at rev 1537, (http://code.google.com/p/jallib/source/browse/trunk/include/peripheral/spi/spi_master_hw.jal?r=1537) originally written by William Welch, from which MSSP1 registers were modified to match MSSP2 names.
spi_master_hw2'put(byte in data)
spi_master_hw2_set_speed(byte in spi_rate)
spi_master_hw2_set_mode_10()
spi_master_hw2_set_mode_11()
spi2_init(byte in spi_mode, byte in spi_rate)
spi_master_hw2_set_mode_01()
spi_master_hw2_set_mode_00()
spi_master_hw2_set_mode(byte in spi_mode)
spi_master_hw2'put(byte in data)
half-duplex convenience function. send data to slave, discard reply
spi_master_hw2_set_speed(byte in spi_rate)
No documentation found
spi_master_hw2_set_mode_10()
No documentation found
spi_master_hw2_set_mode_11()
No documentation found
spi2_init(byte in spi_mode, byte in spi_rate)
Initialize the SPI registers. Note: check your datasheet -- TRIS settings, any SPI errata?
spi_master_hw2_set_mode_01()
No documentation found
spi_master_hw2_set_mode_00()
No documentation found
spi_master_hw2_set_mode(byte in spi_mode)
Specify SPI mode (see spi_common for predefined constant you can use as parameters)
spi_master_hw2'get() return byte
half-duplex convenience function. send 0xFF, get slave data
spi_master_hw2_exchange(byte in m_data) return byte
SPI is full-duplex, so we exchange master and slave data byte
18f27j53 | 18f27j53_sd_card_minix_demo.jal |
18f27j53 | 18f27j53_sd_card_minix_readi.jal |
18f27j53 | 18f27j53_sd_card_minix_read.jal |