Hardware SPI with MAX3111E


Closed Thread
Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    Oct 2004
    Posts
    440


    Did you find this post helpful? Yes | No

    Default

    First try Shiftout and Shiftin then Hardware SPI.

    Norm

  2. #2
    Join Date
    Oct 2004
    Posts
    440


    Did you find this post helpful? Yes | No

    Default

    I haven't studied your code but here is an example:

    The SPI mode allows 8-bits of data to be synchronously
    transmitted and received, simultaneously.

    Shiftin, Shiftout & their MSSP equivalent.
    Code:
    subREAD:
    Low CS
       
    ''''Shiftout sSI,sCLK,msbfirst,[vOP_READ\8,sDONT_CARE\16,vADDRESS_READ\8,sDONT_CARE\8]
    
    
    SSPBUF = vOP_READ ' SEND DATA BYTE
    While SSPSTAT.0 = 0: Wend ' WHILE TX/RX COMPLETE
    vDUMMY = SSPBUF
             
    SSPBUF = 0  'DON'T CARE
    While SSPSTAT.0 = 0: Wend ' WHILE TX/RX COMPLETE
    vDUMMY = SSPBUF 
            
    SSPBUF = 0  'DON'T CARE
    While SSPSTAT.0 = 0: Wend ' WHILE TX/RX COMPLETE
    vDUMMY = SSPBUF
             
    SSPBUF = vADDRESS_READ 
    While SSPSTAT.0 = 0: Wend ' WHILE TX/RX COMPLETE
    vDUMMY = SSPBUF 
            
    SSPBUF = 0  'DON'T CARE
    While SSPSTAT.0 = 0: Wend ' WHILE TX/RX COMPLETE
    vDUMMY = SSPBUF         
    
    
    For z = 1 To 200
    
    ''''Shiftin sSO,sCLK,msbpre,[vREAD\8]
    
    SSPBUF = 0
    While SSPSTAT.0 = 0: Wend ' WHILE TX/RX COMPLETE
    vREAD = SSPBUF         
                              
    Next
    
    High CS  
    
    Return
    As a PIC18F452 example see page 130 of 452 data sheet for your SPI configuration of
    SSPSTAT = %01000000
    SSPCON1 = %00100010

    Norm

Similar Threads

  1. 16-bit SPI problem
    By shaiqbashir in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 19th June 2008, 15:42
  2. Hardware SPI with AD7680 16 bit ADC
    By Castor in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 3rd June 2008, 09:01
  3. SPI on a pic without hardware SPI?
    By modifyit in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 26th April 2006, 13:29
  4. how can i use I2C and SPI hardware
    By micro in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 22nd December 2005, 15:33
  5. Hardware SPI
    By Ron Marcus in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 7th June 2005, 14: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