CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

c30 to ccsc assembler problem

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
echo



Joined: 02 Aug 2011
Posts: 3

View user's profile Send private message

c30 to ccsc assembler problem
PostPosted: Tue Aug 02, 2011 12:37 am     Reply with quote

I attempt from the C30 assembler to transform to CCSC assembler,
but compile error:

Is C30 asm code example:
1)asm("MOV %0, W5" : :"g"(buffer_in)); // put 16 MSBs of buffer_in value into W5
2)asm("MOV W5, %0" : "=g"(buffer_out)); // send 16 MSBs to buffer_out

Change to ccsc assembler:
Code:

#asm
   MOV %0, W5" : :"g"(buffer_in);   //compile error
   MOV W5, %0" : "=g"(buffer_out);  //compile error
#endasm

How can change ccsc correct assembler?
Any help would be much appreciated.
temtronic



Joined: 01 Jul 2010
Posts: 9215
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Aug 02, 2011 5:19 am     Reply with quote

Are you trying to convert inline assembler to CCS C code or convert another C compiler's code that has inline assembler(machine code) into CCS C code?
The two methods are very different !

If you're trying to 'include' ...MOV %0, W5 into a CCS C program then just look in the onscreen help (press F11) or read the manual for examples(they are there).

Without more information, it's difficult to give you a precise answer.

CCSC is not an assembler , rather a compiler.Assembler normally refers to writing programs using machine code instructions( the instruction set) whereas a compiler allows you to create a program in a higher level language(C, Basic, Forth,etc.) and then it( the compiler) translates the program into assembler( machine code) that then gets burned into the microcomputer.
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Tue Aug 02, 2011 8:54 am     Reply with quote

C30 uses a specific inline assembler syntax, that isn't understood by CCS C. To learn about the inline assembler syntax of CCS 16 bit compiler PCD, consult the manual.
echo



Joined: 02 Aug 2011
Posts: 3

View user's profile Send private message

PostPosted: Tue Aug 02, 2011 7:17 pm     Reply with quote

Thank All
I'm reading manual, not discovered the detailed explanation.

I am hope that original C30 these 2 lines codes may work on the ccsc-PCD.

Convert the C code writing, or the assembly writing to PCD.

Thanks again
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Wed Aug 03, 2011 2:28 am     Reply with quote

Basically, PCD has similar methods to use C variables in the inline assembly code, but the syntax is different. If you understand the meaning of the code, translating it to CCS C or inline assembler shouldn't be an issue. As a first point, you have to consider the data type of the involved C variables.

In the present case, a simple C assignment should do the same. What's the reason to use inline assembler?

Code:
buffer_out = buffer_in;
echo



Joined: 02 Aug 2011
Posts: 3

View user's profile Send private message

PostPosted: Wed Aug 03, 2011 3:07 am     Reply with quote

Hi FvM. Thank you very much.

This C30 code only an assembler example, behind has some digital
operation on the dsp mode.
Is Others' based on C30 old code work is good.

Now I study based on the ccsc-pcd, I try directly:
Code:

   MoV buffer_in,W5;   //but the result is wrong

That must study the C30/assembly again ? oh, God.
Pls help me.
Thanks again.
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Thu Aug 04, 2011 3:15 am     Reply with quote

As I already said, the data type of buffer_in must be known to understand what the code does. You also didn't clarify, what's wrong in the PCD result. Generally, you should look at the list file to check for correct operation.

I wonder, if inline assembler will be of much use without exactly understanding the involved operations.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group