Nennie Farina Mahat

Need help on SPI module - MC908GP32

Discussion created by Nennie Farina Mahat on Apr 20, 2008
Latest reply on Apr 24, 2008 by bigmac
Good Day everyone,

I'm doing my project on Eight Bicolor 5x7 LED Matrix Display using GP32. On my previous post, I had problem with the hardware part. Now that I've finished construct my hardware, I'm stucked at this phase where I need to test the SPI module and light up all the LEDs.

Here's my code to light up 4 bicolor LED matrix using 2 MAX6952 display drivers. I'm using ICD08SZ Debugger.

PORTA    EQU     $00
CONFIG1    EQU     $1F
PORTB    EQU     $01
DDRA    EQU     $04
START    EQU     $8000
SPCR    EQU     $10
SPSCR    EQU     $11
SPDR    EQU     $12

    ORG     $FFFE
    FDB     START
    ORG     START
    MOV     #$B1,CONFIG1
    MOV     #$38,SPCR
    BSET     1,SPCR
    MOV     #$11,SPSCR
    MOV     #$06,DDRA                     <== Latch PTA1 and PTA2
    MOV     #$04,SPDR                     <== Configuration
    MOV     #$00,PORTA
                   <== I connected PTA1 and PTA2 to CS pin of both MAX6952
HERE1    BRCLR     3,SPSCR,HERE1
    MOV     #$01,SPDR
HERE2    BRCLR     7,SPSCR,HERE2
    LDA     SPSCR
    LDA     SPDR
HERE3    BRCLR     7,SPSCR,HERE3
    LDA     SPSCR
    LDA     SPDR
    MOV     #$06,PORTA                     <== CS = '1'
    MOV     #$07,SPDR                       <== Display test
    MOV     #$00,PORTA                     <== CS = '0'
    NOP
HERE4    BRCLR     3,SPSCR,HERE4
    MOV     #$01,SPDR                       <== Normal operation
HERE5    BRCLR     7,SPSCR,HERE5
    LDA     SPSCR
    LDA     SPDR
HERE6    BRCLR     7,SPSCR,HERE6
    LDA     SPSCR
    LDA     SPDR
    MOV     #$06,PORTA
AGAIN    BRA     AGAIN


When I execute the program line by line, this is where I got the problem:
HERE3    BRCLR     7,SPSCR,HERE3

The program said that it cannot branch to itself. Could anyone help me on this? I'm jammed now and really need help.

Thanks and regards,
Nennie
 
 
Added p/n to subject.


Message Edited by NLFSJ on 2008-04-21 05:40 PM

Outcomes