I am new to programming. I have small doubt, I know this is simple question but I am confused. I have the following function:
void ReadAdConfReg(void)
{
SPCR = 0x5D;
ADC_CS = 0;
while (MISO_PIN != 0) ;
spi(0x50);
adcConfig = spi(0xFF);
adcConfig = (adcConfig << 8) | spi(0xFF);
ADC_CS = 1;
}
I have declared adcConfig
as global variable: unsigned int adcConfig
.
How can I print the adcConfig
value. Because this is a void
function, it doesn't return any value.
I have tried like this:
ReadAdConfReg();
printf("configreg:%d",adcConfig);
Is it wrong? Or how can I print adcConfig
value.
Controller is ATMega32A, compiler CodeVisionAVR.