SPI Interfacing


Closed Thread
Results 1 to 9 of 9

Thread: SPI Interfacing

Hybrid View

  1. #1
    Join Date
    May 2007
    Posts
    2

    Smile SPI Interfacing

    Hi Francois,

    I will try to answer your questions.

    >>I didn't see any Serial command in your example ?

    There are three examples of communicating with SPI devices. Each begins with a comment describing the device they apply to. After setting the value of two or three Bytes (valuebyte, commandbyte, and secondbyte), a GOSUB is called to move the data. The subroutines are: "sendspi" used to send commands to the digital pot and the amplifier and and "txrxspi" to command an ADC to convert and read back the data. The result of the data read back is put into the variable vcount. I know this does not look like much code but it is all you have to do. Simple, isn't it!?!

    >>about the speed ? where to set it ?

    Bits 3 - 0 of the SSPCON register select transmission speed. It is a function of the MCPU clock. In my instance, I use a 20 MHz oscillator and define at the top of my code using the define: DEFINE OSC 20.

    >>may I use it like it is to "try something" mostly send commands to my friend's unit

    Feel free to use this any way you wish. Note that the Byte values developed are for specific devices so you will have to adapt them to do your task and create a loop for them to run in.

    I hope I have explained adequately.

    Cheers,
    Mike

  2. #2
    Join Date
    Sep 2003
    Location
    INDIA
    Posts
    161

    Default Thanks Mike

    Hey Mike,

    Thanks for that explaination. Surely a lot of people will gain from it.


    regards
    Charudatt

Similar Threads

  1. Using SPI with External Interrupts
    By shaiqbashir in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 29th June 2008, 04:08
  2. 16-bit SPI problem
    By shaiqbashir in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 19th June 2008, 15:42
  3. SPI configuration PIC versus Atmel
    By Pedro Santos in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 10th July 2007, 19:17
  4. How to configure SPI in PICBASIC PRO?
    By moogle in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 15th April 2007, 18:31
  5. interfacing SPI with 2 pins?
    By modifyit in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 1st December 2005, 22:04

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