Designer11

HCS08QG8 UART: mix C and Assembly

Discussion created by Designer11 on May 2, 2011
Latest reply on May 3, 2011 by bigmac

Hello Everyone,

 

I am adding a serial feature to a previous written C codes.  The serial code is in assembly that i obtained from (AN2295SW). I understand that assembly codes in C file don't behave the same as "standard" assembly file. Could anyone give me some suggestions on what i need to modify to get this piece of code up and running. Another question is can i branch to a "regular" C function within the asm brackets ?

 

I am currently using CodeWarrior MCU 6.3

 

asm   {          MOV     0b00001100,SCIC2;   // transmit & receive enable          CLR   SCIBDH;          MOV   #26, SCIBDL;        //BUS (8.0M)/(16 *26) = 19200Bd          CLR     SCIC3;              // clear SCIC3          LDA   SCIS1;              // Load Accumulator A with SCIS1          MOV   #ACK, SCID;         // Move from SCID to ACK          LDX   #T100MS;            // Load Accumulator X with 100ms     L2:   CLRA;    L1:   BRSET   SCIS1_RDRF,SCIS1,CAUGHT; //Branch to "CAUGHT" if SCIIS1_RDRF is           DBNZA   L1; //Decrement A and Branch to "L1" if not Zero          DBNZX   L2; //Decrement X and Branch to "L2" if not Zero    ILOP:    //       timeout          ILOP;       //generate RESET by doing illegal operation    CAUGHT:         // CAUGHT IN SELF-PROGRAMMING?          BSR     READ1;             //Branch to "READ"          CBEQA   #ACK, SUCC;        //Got ACK! or               ILOP;                      //generate RESET by doing illegal operation    SUCC:          LDA     #ACK;              //          BSR     Serial();          //functions that handles serial commands                 READ1:           BRCLR   SCIS1_RDRF,SCIS1,READ1;          LDA   SCID;          RTS;  }

 I get the following error messages after each compiling the codes

 


Error   : C18113: Bitno expected
main.c line 1117  
Error   : C18101: Object is not a field
main.c line 1117  
Error   : C18110: Comma expected
main.c line 1117  
Error   : C18123: end of line expected
main.c line 1117  
Error   : C18125: Invalid opcode or ':' expected
main.c line 1122  
Error   : C18125: Invalid opcode or ':' expected
main.c line 1126  
Error   : C18123: end of line expected
main.c line 1129  
Error   : C18101: Object is not a field
main.c line 1134  
Error   : C18113: Bitno expected
main.c line 1134   
Error   : C18110: Comma expected
main.c line 1134  
Error   : C18110: Comma expected
main.c line 1134  
Error   : C18103: Factor expected
main.c line 1134  
Error   : C18123: end of line expected
main.c line 1134  
Error   : C18101: Object is not a field
main.c line 1135  
Error   : C18123: end of line expected
main.c line 1135  
Error   : C18000: Label not set
main.c line 1134  
Error   : C18000: Label not set
main.c line 1117  
Error   : Compile failed

Outcomes