Searching \ for '[PIC]: Dual serial on 16F876' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page:
Search entire site for: 'Dual serial on 16F876'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Dual serial on 16F876'
2000\09\27@181948 by David Huisman

Further to the last post, the pseudo code below is how I am thinking of
implementing the dual serial ports in the application.
Would someone mind letting me know if there is a better way of doing it or
if you see any major error in the methodology.
The actual code will be written in C.

Interrupt state machine
Initially Timer1 is OFF and External Int on RB0 is enabled for low going
transition (to capture start bit).

State0: Waiting for Ext Int on RB0
       Mode = Idle
State1: Receive low edge on RB0 (Mode = Idle)
       Disable int
       Set timer1 for bit time/2
       Mode = Start
State2: Timer1 overflow (Mode = Start)
       If RB0 still low then Start bit is valid
           Set timer1 to bit time
           Mode = receiving
       Else Stop Timer 1
       Re-enable Ext Int
       Mode = Idle
State3: Timer1 overflow (Mode = Receiving)
       set timer1 = bit time
       sample RB0 and shift bit in received word
       dec bit count
       if bit count = 0 then
          Mode = Stop
State4: Timer1 overflow (Mode = Stop)
       If RB0 high the Stop is valid
          Set data_valid flag to true
          Store byte in rx_buf[n]
          inc n
       Stop timer1
       Enable Ext int
       Mode = Idle

And for UART...
if (RCIF)
   if not OERR or FERR then
   rx2_buf[y] = RXREG
   inc y

Both receive buffers are checked and packets validated within main program
Packet sizes are kept small (say 30 bytes per packet) = 120 Bytes for all RX
and TX buffers.

I am wanting to run Bit Bashed serial up to 9600 Baud and UART at 19200.


David Huisman

-- Going offline? Don't AutoReply us!

More... (looser matching)
- Last day of these posts
- In 2000 , 2001 only
- Today
- New search...