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
Posted: Fri Oct 23, 2009 9:53 am
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
Posted: Fri Oct 23, 2009 10:01 am
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
Posted: Fri Oct 23, 2009 10:23 am
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.
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