Have you looked at the Software UART library routines in C18. In Mplab,=20 Help > Topics > MPLAB C18 Libraries > Index >Uart, software will get you=20 close. It is necessary to program 3 delays in "C" using the delay=20 functions, but there is a good explanation there, a little calculation,=20 and add the delay functions. Using an 18F1320 @ 8M chrystal, and 9600=20 baud it looks like this: (Caution, I have the transmit delay working=20 good, using this same method, just haven't needed the receive function=20 yet. If someone wants to critique this, that's OK. DelayTXBitUART =20 =09 Delay for: ((((2*Fosc) / (4*baud)) + 1) / 2) - 12 cycles the numbers look like: ((((2 * 8,000,000)/(4 * 9600)) + 1) / 2 ) - 12 =3D 196.83 say 197 and the code: void DelayTXBitUART (void) { Delay10TCYx(19); Delay1TCY(); Delay1TCY(); Delay1TCY(); Delay1TCY(); Delay1TCY(); Delay1TCY(); Delay1TCY(); } On 11/7/2010 6:53 PM, Dario Greggio wrote: > Il 13/09/2010 8.42, PICdude ha scritto: > =20 >> Not the answer I wanted to hear. I was expecting some way to switch >> off optimizations perhaps, and a way (such as a profiler) to figure >> out how many instructions or clock-cycles a particular code sequence >> takes. >> =20 > > Using inline (asm/endasm blocks) assembler has the advantage to ALSO > drop off optimization for that block of code (depending upon the > compiler, C18 disables for the whole function, other may do somewhat > differently) so it's a good choice. > > Dario > =20 --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .