877a and SPI


Closed Thread
Results 1 to 13 of 13

Thread: 877a and SPI

  1. #1
    Join Date
    Dec 2006
    Posts
    38

    Question 877a and SPI

    I am looking for code examples to use SPI on the 877a I have searched a few times but the search engine complains that SPI is too short.

    My long term goal is to interface with one of the dos on chip IC for sd cards available from sparkfun.com .

    I have a project working using serial comm to a PC what I would like is the option to datalog using SPI so that I dont interfere with my serial link to the PC.

    Any help would be greatly appreciated.
    Thanks in advance.

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by tico View Post
    I am looking for code examples to use SPI on the 877a I have searched a few times but the search engine complains that SPI is too short.

    My long term goal is to interface with one of the dos on chip IC for sd cards available from sparkfun.com .

    I have a project working using serial comm to a PC what I would like is the option to datalog using SPI so that I dont interfere with my serial link to the PC.

    Any help would be greatly appreciated.
    Thanks in advance.
    http://www.picbasic.co.uk/forum/showthread.php?t=4751

  3. #3
    Join Date
    Dec 2006
    Posts
    38


    Did you find this post helpful? Yes | No

    Default

    Thanks for the quick reply but still cant seem to find an example.

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by tico View Post
    Thanks for the quick reply but still cant seem to find an example.
    Check the little green book, enough examples in there to get you started.

  5. #5
    Join Date
    Apr 2006
    Location
    New Hampshire USA
    Posts
    298


    Did you find this post helpful? Yes | No

    Smile site search

    Hi tico,

    Quote Originally Posted by tico View Post
    Thanks for the quick reply but still cant seem to find an example.
    Paste this into your Google search engine.
    Code:
    spi site:http://www.picbasic.co.uk/forum/
    
    or
    
    spi pic16f876a site:http://www.picbasic.co.uk/forum/

    hope that helps

    -Adam-
    Ohm it's not just a good idea... it's the LAW !

  6. #6
    Join Date
    Dec 2006
    Posts
    38


    Did you find this post helpful? Yes | No

    Default

    So since its to the manual should I use hserin or shiftin. I am wrapping my head around this.

    I have also found this example from melabs
    http://www.melabs.com/resources/samples/pbp/spimast.bas

    Since I am new to SPI am I correct that the PIC is the master and the SD card is the slave.

    I am just looking for a recomended starting point so I dont spin my wheels more that I already have.

  7. #7
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by tico View Post
    So since its to the manual should I use hserin or shiftin. I am wrapping my head around this.
    I am just looking for a recomended starting point so I dont spin my wheels more that I already have.
    Simple things first. The DOSonChip datasheets says it'll handle UARTs, SPI (I2C/SMBus coming soon).
    Stick with the simplest first...Serial ports...fast, easy to handle, built in string handling in PBP, well documented, easy for a beginner, fast enough with the right code, the right processor, etc. I believe, SPI is overkill in this situation.
    So, go with serial. SerIn/SerOut, SerIn2/SerOut2, HSerIn/HSerOut, any one of those combinations will work just fine, no matter what PIC, no matter what speed (up to a point of course). Pretty much it depends on how well and how efficiently you can write your code.

  8. #8
    Join Date
    Dec 2006
    Posts
    38


    Did you find this post helpful? Yes | No

    Cool

    I understand that the DosOnChip will handle Uart and SPI with I2c comming soon,
    As I stated previously I am already using the serial port for data to the PC, I would like to add SPI for datalogging.
    I am using a 16f877a and It only has one TX pin RC.6 I believe, looking at the other pins available and with the specs for th DosOnChip I have the ability for SPI, that is why I chose this part.
    Unless I am missing something and I can use another pin to TX serial data, this is my only option for now.

  9. #9
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by tico View Post
    Unless I am missing something and I can use another pin to TX serial data, this is my only option for now.

    This is exactly what you can do with the software serial comm. See the SERIN/SEROUT AND SERIN2/SEROUT2 sections of the manual. Also, do a search of the forum for these and you will have more info that you can use.

    SteveB

  10. #10
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by tico View Post
    I understand that the DosOnChip will handle Uart and SPI with I2c comming soon,
    As I stated previously I am already using the serial port for data to the PC, I would like to add SPI for datalogging.
    I am using a 16f877a and It only has one TX pin RC.6 I believe, looking at the other pins available and with the specs for th DosOnChip I have the ability for SPI, that is why I chose this part.
    Unless I am missing something and I can use another pin to TX serial data, this is my only option for now.
    Use HSERIN/OUT for the hardware serial pins, and SerIn/Out or SerIn2/Out2 and use seperate pins driven by software. Or forget about HSerIn/Out and use the software serial commands to handle it. If your code is sound and efficient enough, the software commands will handle it just fine. If it's sloppy, then you'll be fighting missed characters, getting out of sync, etc. But the DOSonChip has CTS/RTS pins and so does your PC...so you can use those to your advantage.

  11. #11
    Join Date
    Dec 2006
    Posts
    38


    Did you find this post helpful? Yes | No

    Wink

    I am assuming that I need to use inverted mode for communication between the pic and DosOnChip module, can I also us the same method with resistors for rts/cts or should I use a max232.

  12. #12
    Join Date
    Dec 2006
    Posts
    38


    Did you find this post helpful? Yes | No

    Default

    any regard to my questions, I would like to know that I am starting out right.

  13. #13
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by tico View Post
    I am looking for code examples to use SPI on the 877a I have searched a few times but the search engine complains that SPI is too short.

    My long term goal is to interface with one of the dos on chip IC for sd cards available from sparkfun.com .

    I have a project working using serial comm to a PC what I would like is the option to datalog using SPI so that I dont interfere with my serial link to the PC.

    Any help would be greatly appreciated.
    Thanks in advance.
    SPI is only 3 letters and the search engine wants 4 so add a wildcard to your search: SPI* and you will get everything that starts with spi - maybe useful, or not.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

Similar Threads

  1. Use the PIC 16f877 or 877A instead of shift registers.
    By tsanders in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 27th October 2006, 17:23

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts