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 support@ccsinfo.com

error with asm code

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



Joined: 11 May 2009
Posts: 22

View user's profile Send private message

error with asm code
PostPosted: Fri Oct 23, 2009 9:11 am     Reply with quote

i've tried to set the adcon2 register of a dsPIC30F3013 with 0x2000.
to do this i've wrote this asm code:
Code:
#asm
MOV     #2000,W4
MOV     W0, 2A2 ; 2a2 is the adcon2 register adress
#endasm

when i try to compile the program says:
"error 102 expecting comma"

thanks to anyone who can help me.

P.S.
I'm writing this code because the ccs function  setup_adc_ports(sAN0|sAN1|VSS_VREF) does't work. The ADC does't use the Vref+ but it use the aVdd like Vref.
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Fri Oct 23, 2009 9:53 am     Reply with quote

I don't know anything about that processor, BUT have you tried the
classic way of accessing registers?

#BYTE

Code:
#byte ANSEL =0x188
#byte ANSELH=0x189



Then in main

  ANSEL=0; //the above statements don't work correctly.  Using #byte to force it.
  ANSELH=0;
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Fri Oct 23, 2009 10:01 am     Reply with quote

As an alternative to two #BYTE declarations you can use a single #WORD to access the register as a 16-bit.

Code:
#word ANSEL = 0x188


Then in main:
  ANSEL=0x2000; //the above statements don't work correctly.  Directly access the ADC register to force it.
blo



Joined: 11 May 2009
Posts: 22

View user's profile Send private message

PostPosted: Fri Oct 23, 2009 10:23 am     Reply with quote

ckielstra wrote:
As an alternative to two #BYTE declarations you can use a single #WORD to access the register as a 16-bit.

Code:
#word ANSEL = 0x188


Then in main:
  ANSEL=0x2000; //the above statements don't work correctly.  Directly access the ADC register to force it.


The #word declaration works.
Thank you.
I've tried the #byte declaration but for some reason it doesn't work.
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