Sorry! I had made a big mistake. All BTFSC S_PORT, should have been BTFSC DATA, I had pressed the send button w/o first checking :). Reggie ---------- > From: Regulus Berdin > To: PICLIST@MITVMA.MIT.EDU > Subject: Fast serial out > Date: Wednesday, June 24, 1998 2:36 PM > > Hi all, > > While reading the piclist on the topic about rs233, > an idea came to me for sending fast asynchronous data. > A similar routine may have been discovered and posted > before. But just in case, I will share this to all. > This routine is not yet tested and may contain bugs. > > SEROUT: > RRF DATA,W ;reformat data to have: > XORWF DATA ; 1 = bit change > ; 0 = no bit change > ; > MOVLW (1< BCF S_PORT,S_PIN ;start bit > SKPNC ;bit 0 > XORWF S_PORT ; > BTFSC S_PORT,0 ;bit 1 > XORWF S_PORT ; > BTFSC S_PORT,1 ;bit 2 > XORWF S_PORT ; > BTFSC S_PORT,2 ;bit 3 > XORWF S_PORT ; > BTFSC S_PORT,3 ;bit 4 > XORWF S_PORT ; > BTFSC S_PORT,4 ;bit 5 > XORWF S_PORT ; > BTFSC S_PORT,5 ;bit 6 > XORWF S_PORT ; > BTFSC S_PORT,6 ;bit 7 > XORWF S_PORT ; > NOP ;delay > BSF S_PORT,S_PIN ;stop bit = 1 > RETURN > > This gives only 2 cycle per bit which is quite fast. > On a 4MHz pic, it can send max. 500KBps. > > Reggie