since I don't know where to put test files yet, here is the lib of yours that I edited, I changed the variable names so they can be used on any pic and removed the init procedure.
-- Title: SPI Master (spi_master_hw.jal) -- Author: William Welch Copyright (c) 2009, all rights reserved. -- Compiler: 2.4l -- -- This file is part of jallib (http://jallib.googlecode.com) -- Released under the ZLIB license (http://www.opensource.org/licenses/ zlib-license.html) -- -- Description: SPI Master hardware control. -- Routines for sending and receiving through the SPI in master mode -- -- Sources: -- http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus -- http://ww1.microchip.com/downloads/en/devicedoc/spi.pdf -- -- SPI Mode - CKP CKE -- 0,0 - 0 1 -- 0,1 - 0 0 -- 1,0 - 1 1 -- 1,1 - 1 0 -- -- SPI is full-duplex, so we exchange master and slave data byte function spi_master_hw_exchange(byte in m_data) return byte is var byte stat SPI_BUFFER = m_data while ( SPI_BUFFER_STATUS == 0 ) loop end loop -- return slave data return SPI_BUFFER end function -- half-duplex convenience function. send data to slave, discard reply procedure spi_master_hw'put(byte in data) is var byte dummy dummy = spi_master_hw_exchange(data) end procedure -- half-duplex convenience function. send 0xFF, get slave data function spi_master_hw'get() return byte is var byte data data = spi_master_hw_exchange(0xFF) return data end function --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jallib" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jallib?hl=en -~----------~----~----~----~------~----~------~--~---
