Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

i can't assig variable to port

Status
Not open for further replies.
i used channel 0 as implies in openADC() also 0x0E in the same function
Code:
OpenADC(ADC_FOSC_4 &
					ADC_RIGHT_JUST &
					ADC_2_TAD,
					ADC_CH0 &    // use Channel 0
					ADC_INT_OFF &
					ADC_VREFPLUS_VDD,
					0x0E);
 
Try casting ReadPr to a float,

sampledPR = 5*((float)ReadPR/1023);

But, this wouldn't have worked in the simulator anyway.:confused:

Mike.
BTW, I tend not to use the library functions as it takes me longer to work out how to use them than just write my own. Therefore your initialisation could be completely wrong.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top