I am trying to interface an LM35 with a PIC18F4550 & get it to transmit the temperature (floating values) via UART. Since I am using a float data type to calculate & store the temperature value, how do I send it byte by byte to the TXREG (as TXREG is only a byte wide & float data type is 4 bytes wide)?
P.S. I have not written the serial() function in the code (that is where I am getting the problem

). Let me know if you need the configuration bit settings & a schematic of the circuit I used.
Code I used -
void interrupt isr(void);
void adc_isr(void);
void serial(void);
void delay(unsigned int x);
float adc_output;
void main()
{
SPBRG=0x0C; //9600bps, 8-bit BRG
SPEN=1; //enable serial port
IPEN=1; //enable interrupt priority
INTCON=0xC0; //GIEL=1, GIEH=1
ADIE=1; //enable ADC interrupt
ADIP=1; //ADC interrupt is of high priority
ADON=1; //enable ADC module
TRISA=0xFF; //PORTA is input
ADCS0=1; //clock=F/8
ACQT0=1; //acquisition time=t*2
ADFM=1; //right justified
while(1)
{
GO=1; //start A/D conversion
delay(1000);
}
}
void interrupt isr(void)
{
asm("CALL _adc_isr");
}
void adc_isr(void)
{
ADIF=0;
adc_output=ADRES;
adc_output=adc_output*50;
adc_output=adc_output/1023;
adc_output=adc_output*10;
serial(); //used to transmit temp value via serial
}
void delay(unsigned int x)
{
unsigned char y;
unsigned int i;
for(i=0; i<x; i++)
{
for(y=0; y<255; y++);
}
}