=20 I wanted to hopefully caution someone against making the same mistake I made. In the interest of reducing part count, I have been working on using a 16F628 to do modulated (38 Khz) IR. I wanted to have everything on one chip, instead of having to use multiple chips. I did the modulation and bit-banging myself, for 1200 baud IR communication. I was using the internal oscillator of the 16F628. Basically, I could get it working fine, and then I would come back the next morning, and it would be slightly off, missing a few bits on certain values, while working fine on others. I messed with this for two days, trying to tweak things to make them work correctly. It was very frustrating. And then i though about the temperature variations, and the internal clock. Arggh! I added a ceramic resonator, and everything worked flawlessly. =20 I though that the internal clock would have been accurate enough for something as coarse as 1200 baud serial, but apparently it is not. =20 I've attached the source code for the IR function below, in case anyone is interested. I am using the CCS compiler, and a 4 MHz clock. The 16/4 loop makes a 38 KHz pulse. =20 =20 Alex =20 void IRWrite(byte b) { =20 disable_interrupts(INT_EXT); =20 #use fast_io(b) // start bit for(i=3D0;i<27;i++) { output_low(PIN_B2); delay_us(16); output_high(PIN_B2); delay_us(4); } =20 // serials =20 for(j=3D0; j<8;j++) { =20 if(!shift_right(&b,1,0)) { // output a modulated zero for(i=3D0;i<27;i++) { output_low(PIN_B2); delay_us(16); output_high(PIN_B2); delay_us(4); } =20 } else // output a one { output_high(PIN_B2); delay_us(760); =20 } =20 } =20 // stop bit output_high(PIN_B2); delay_us(760); #use standard_io(b) enable_interrupts(INT_EXT); } -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu