Mike Fidrich

9S12DP512 SPI port 1 and 2 does not work

Discussion created by Mike Fidrich on Nov 10, 2008
Latest reply on Nov 13, 2008 by Daniel Lundin
Hello All,

I am in the early stages of using a MAX6675 with a 9S12DP512.  A scope is connected to the SS and
SCK pins.  On SPI port 0 the SS pin goes low and there is a pulse train on SCK but using the same
code with the other two ports there is no activity on the SCK pin.  Any help would be much Appreciated.

CodeSec:     SECTION

IniSPI1                    ;Initialize SPI Port 1
    bset    PORTH,#%10000000      ;Set SS high
    bset    DDRH,#%11100000        ;MOSI, SCK, SS output MISO input
    movb    #$77,SPI2BR                 ;Set baud rate 12.21KHz
    movb    #$10,SPI2CR1               ;Master is 1
    movb    #$08,SPI2CR2
    ldaa    SPI2SR
    ldaa    SPI2DR
    bset    SPI2CR1,#%01000000    ;Enable SPI

; Temperature

    ldaa    #'T'
    bclr    PORTH,#%10000000
    staa    SPI2DR
    brclr    SPI2SR,#$80,FLAG
    bset    PORTH,#%10000000
    ldaa    SPI2DR
    jmp    PCX