Matt, I look forward to working with you to make this library better.
And I may be off in the weeds, but the file I checked in, was intended to be for picmicros that have a built-in SPI controller, and further, for use in Master mode. So, the register definitions are defined by the chip, for example 16f819.jal. Now, if you are considering other flavors of picmicro, which have built-in SPI hardware, but have different register definitions, then we need to deal with that somehow. I'd rather have separate SPI Master library files, than a single file that is complicated and hard to understand and maintain. My thought was that SPI is (potentially) complicated, and that end- users would need to provide their own 'init' routine. I didn't have the time or resources to fully test all of the various ways that SPI can be used in Master mode, so I wrote a 'quick and dirty' 'init' routine (note the leading underscore in the name). I did however review the documentation in various Microchip data sheets and errata, and it seemed to me that several steps were required to make sure the device was set up properly. I don't have my notes handy but I can dig them up. William On Aug 31, 1:59 am, mattschinkel <[email protected]> wrote: > Thanks, i guess I missed the discussion, I found the new file in svn. > I see that the spi init procedure was updated, however it may still > need some work. > > Please see my previous post. > > >I think the user should define the following values within there own > > file: > SSPSTAT_SMP, SSPSTAT_CKE, SSPCON_CKP > > Matt. > > On Aug 30, 11:37 pm, Rob Hamerling <[email protected]> wrote: > > > > > Hi Matt, > > > mattschinkel wrote: > > > I would like to edit it and get it ready for the jallib releases. SPI > > > is required for the SD_Card lib I am working on. > > > > ..... > > > 2. > > > > You have an init procedure: > > > > -- SPI Master mode 0,0 example. > > > -- Note: check your datasheet -- TRIS settings, any SPI errata? > > > procedure _spi_init_mode00() is > > > var byte v > > > SSPCON = 0 > > > v = SSPSTAT & 0x3F > > > SSPSTAT = v > > > v = v | 0x40 -- CKE = 1 > > > SSPSTAT = v > > > v = SSPCON > > > v = v | 2 -- CKP=0, Master mode, OSC/64 > > > SSPCON = v > > > SSPCON_SSPEN = 1 > > > end procedure > > > > Is there a need for all of this? > > > There was a short discussion lately about this and this procedure has > > been changed! Always checkout for the latest version!. > > > Regards, Rob. > > > -- > > Rob Hamerling, Vianen, NL (http://www.robh.nl/)-Hide quoted text - > > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
