pic programming

Status
Not open for further replies.

nusry

New Member
this is my first programming (to pic)
i want to programe pic24f in C to get data from hmc5843 sensor
already i have installed mplab ide and C30 compiller (i going to use C30)
i know little bit C but i don't for PICs,
And also i have found a source code for hmc5843

{
uint8_t xh, xl, yh, yl, zh, zl;
long xo, yo, zo;

i2cSendStart();
i2cWaitForComplete();
i2cSendByte(0x3C); //write to HMC
i2cWaitForComplete();
i2cSendByte(0x02); //mode register
i2cWaitForComplete();
i2cSendByte(0x00); //continuous measurement mode
i2cWaitForComplete();
i2cSendStop();

//must read all six registers plus one to move the pointer back to 0x03
i2cSendStart();
i2cWaitForComplete();
i2cSendByte(0x3D); //read from HMC
i2cWaitForComplete();
i2cReceiveByte(TRUE);
i2cWaitForComplete();
xh = i2cGetReceivedByte(); //x high byte
i2cWaitForComplete();
//printf(" %d", xh);
}

what are modifications that i should do for this code?
what should i add?
help..
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…