i've figured out the problem.. you are right about the 'read number of bytes at port' thing due to the zero byte. i tested by removing that function and set a constant value for bytes to read to 5 then i made my input constant around 300 plus which gives the value eg. 333\00\r as shown in the image i attached.
but the problem is i can't set a constant value to read because my values range from 0 to 1023 which is 1 digit to 4 digits. i don't think i can remove the zero byte from the PIC side because the function to convert values to string is somehow giving the zero byte which i can't understand the reason why.
itoa(AD_ResultA0, ADstringA0); //convert the ADC value to string
putsUSART(ADstringA0); //send the string to UART
UARTWriteString("\r"); //add in \r
the \00 zero byte comes in between the value and \r. i tried removing the \r part and found tat the \00 still exist so the problem lies in the first two lines of the commands above.
hope to be able to use the scan string to sort out multichannel data to solve this.
Message Edited by wenkeat on
03-17-2008 10:49 AM
Regards,
Wen Keat