------=_Part_31045_9196386.1176435833514 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Alright, so what i am trying to do is, i have a output from a sensor, ranging -1.0V ~ 3.3V, frequency range 1 ~ 3Hz. I am using a scaling circuit (OPAMP) to scale the output voltage of the sensor (to range 0 ~ 5v) so i can input it to PIC18F452's A/D converter. I am using C18 to program the PIC and the library functions to do the A/D conversion. Also what i want is the output of the A/D to go into USART so i can hook it up to a computer via RS232 and see the data samples via hyperterminal. Once i have the output, i can use Matlab to parse the data and get the analog signal output graphed. I am new to PIC programming, and i can use some help here. Since i am using C18 to program, i would like to use the C18 library functions to do the A/D and also UART. I have attached the code here with the email. This is where i have gotten so far through the C18 library functions datasheet and i would like someone to direct me from here, what i am doing wrong, and what i should be doing to get it right. Analog input is AN0, and after A/D, output through UART (RX, TX pins). Also, since its a 10-bit A/D and UART transmits 8-bits, what should i do? Thanks! Chris ------=_Part_31045_9196386.1176435833514 Content-Type: text/plain; name="C program.txt"; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: base64 X-Attachment-Id: f_f0g3gnxt Content-Disposition: attachment; filename="C program.txt" I2luY2x1ZGU8cDE4ZjQ1Mi5oPg0KI2luY2x1ZGUgPGFkYy5oPg0KI2luY2x1ZGUgPGRlbGF5cy5o Pg0KI2luY2x1ZGUgPHVzYXJ0Lmg+DQojaW5jbHVkZSA8c3dfdWFydC5oPg0KDQojZGVmaW5lIEJB VUQgMTkyMDANCiNkZWZpbmUgQ0xLIDQwMDAwMDANCg0KDQp2b2lkIERlbGF5VFhCaXRVQVJUKHZv aWQpOw0Kdm9pZCBEZWxheVJYSGFsZkJpdFVBUlQodm9pZCk7DQp2b2lkIERlbGF5UlhCaXRVQVJU KHZvaWQpOw0KDQoNCmludCByZXN1bHQ7DQoNCg0Kdm9pZCBtYWluKCkNCnsJDQoJDQpBRENPTjA9 MHgwMTsgLy9zZWxlY3QgY2hhbm5lbCBBTjAsIGVuYWJsZSBBL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sxKS8yKS0xNDsNCglEZWxheTEwVENZ eCAoZGVsYXlfdGltZSk7DQoJcmV0dXJuOw0KfQ0K ------=_Part_31045_9196386.1176435833514 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist ------=_Part_31045_9196386.1176435833514--