pic32 C writeing to memory

Andy, Mon Feb 03 2014, 02:11AM

Hi
I would like to write to memory location on a PIC, more so the registers. I was wondering if you just have code below weather it will write to them
Thanks


#include <plib.h>


#define SYS_FREQ (80000000L)


#define deviceoffset=0xBFC00BF0;

int main(void)
{
unsigned int adc9offset=0x00;

// CloseADC10();
adc9offset=deviceoffset+0x9100;
&adc9offset=0x00; //bit 15 switch off

&adc9offset=&adc9offset|0xe0; // internal counter ends sampling and starts conversion (auto-convert), manual sample
&adc9offset=&adc9offset|0x0f01; //TAD = 4*TPB, acquisition time = 15*TAD


&adc9offset=&adc9offset|0x08000; //bit 15 switch on

&adc9offset=&adc9offset|0x10; //begin sampling0

while( &adc9offset&0x10 ); // wait until acquisition is done
while( ! &adc9offset&0x01 ); // wait until conversion done



}

Re: pic32 C writeing to memory
Shrad, Sun Feb 09 2014, 09:18PM

for what I recall the built in registers are already defined in the .h file of your device (like INTCON for intcon register, etc...)
Re: pic32 C writeing to memory
Andy, Wed Feb 12 2014, 01:34AM

Yep, was just wondering how to send it to that address.
unsigned int * address = 0x41414141;
*address = 0x01;
Works, got confused with & and *.

Some of the chips in MPLAB can compile but they can't use the headers like adc10.h, need to use this way or write the function in the program.