Software SPI Assembly

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Software SPI Assembly

1,567 Views
mjcoury
Contributor I
I pulled this code straight from a Freescale app note AN991.pdf Page 12... modified slightly...

asm{
LDA #$08
STA iBitCounter // Set bit counter
AGN:
BRSET 7,PORTA,* // Wait for Falling Edge of Clock Pin 7 of Port A
//ROL RES1 // Shift data to send
//BCS SET1 // Check data status
//BCLR 6,PORTC // If 0, clear data out
BRCLR 7,PTAD,* // Wait for Rising Edge of Clock Pin 7 of Port A
BSET 7,PTBD
BRSET 0,PTCD,STR // Check input data status
STR:
ROL *cSPIData_ptr // Store in result
DEC iBitCounter // Check for end of byte
BCLR 7,PTBD
BNE AGN
}


It doesn't compile in CW version 3.1 and I am assuming it has something to do with the '*'

First Error is C18103: Factor Expected highlighting the first line...

then

C18101: Object is not a field which again points to a line with a '*'



http://forums.freescale.com/freescale/board/post?board.id=8BITCOMM#
Submit Post
Thanks
Labels (1)
0 Kudos
Reply
2 Replies

493 Views
bigmac
Specialist III
Hello mjcoury,
 
The use of the asterisk (*) as a branch destination works OK for assembler, but apparently not for in-line code.
 
However, it can easily be avoided by defining a label prior to each bit test and branch instruction, and then branching to that label within the instruction.
 
AGN:
   BRSET 7,PORTA,AGN  // Wait for Falling Edge of Clock Pin 7 of Port A
 
I wonder if the following line is OK for inline assembly - it certainly would be problematic for standard assembler.
 
   ROL *cSPIData_ptr // Store in result
 
Regards,
Mac
 
0 Kudos
Reply

493 Views
CompilerGuru
NXP Employee
NXP Employee
Actually I think the * works as branch target, but it does definitely not work for the "ROL *cSPIData_ptr".

Daniel
0 Kudos
Reply