Hi,
You are not converting the data sent in 'data1' to the transmit routine, which is a 'binary' hex number into an 'ASCII' Hex number to print it out on hyperterminal in a readable form, hyperterminal will try to print whatever character is the ASCII code in 'data1' (if it is printable) for the code sent to it.
Try something like :-
void transmit(unsigned char data1)
{
unsigned char cChar[6]; //Make the string limits longer than 6 if required.
int i;
sprintf(cChar, "%02x\n\r\0", (unsigned int)data1);
//May not need the (unsigned char) cast, some compilers don't.
//Use "%02i\n\r\0" if you want it in decimal this will print each new value on a
//new line. Should then print something like 7f for a value of #7f. If you use the
//"%#05x\n\r\0" you should get 0x07f printed out.
//include more math routines if you want to convert value to a voltage directly.
//you could then make the format string more fancy including adding "Volts" etc.
//before the line feed & carriage return character.
for(i = 0; i < 5; i++) //Make the character count longer if required.
{
SBUF=cChar;
while(!TI);
TI=0;
}
}
You will also need to include the header file <stdio.h> for this to work.
I hope this helps.
Best regards
Bob.