Searching \ for '16C74 USART' 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: '16C74 USART'.

Truncated match.
PICList Thread
'16C74 USART'
1998\10\09@093223 by Facundo Cestona

picon face
Anybody can help me with a piece of code to configure 16C74 USART as a
RS232 9600,N,8,1 at 16MHz

Get Your Private, Free Email at

1998\10\11@182044 by evan

picon face
> From: Facundo Cestona
> Anybody can help me with a piece of code to configure 16C74 USART as a
> RS232 9600,N,8,1 at 16MHz

Sure, just RTFM for further bit explanations (and the example in the manual
shows exactly what you asked for).  Note that the below example only enables
the USART Rx interrupt, not Tx.  And set your incoming email margin width to
at least 76 or else this will look like garbage:

   ;clear RS232 RX & TX bits
   _ram_page0                  ;macro to select RAM Bank 0
   bcf     PORTC, 6
   bcf     PORTC, 7

   ;set TRIS register for RS232 stuff
   _ram_page1                  ; get the idea
   bcf     TRISC, 6            ;RC6 is transmit output
   bsf     TRISC, 7            ;RC7 is receive input

   ;Transmit Status & Control Register
   ;clock internally generated, 8-bit transmission, transmit disabled,
   ;asynchronous mode, low speed baud rate generation, transmit reg empty,
   ;9th/parity bit 0 (not used anyways)
   _movlf  b'10000010', TXSTA  ;macro to move a literal into F

   ;set baud rate generator to get 9600 baud
   _movlf  d'25', SPBRG

   ;Receive Status & Control Register
   ;serial port enabled, 8-bit reception, single-receive disabled,
   ;continuous receive enabled, the lower 4 are status bits.
   _movlf  b'10010000', RCSTA

   ;enable the USART Receive interrupt, then the Peripheral Interrupt
   bsf     PIE1, RCIE
   bsf     INTCON, PEIE

-Ed VanderPloeg
Agile Controls

1998\10\12@122128 by Justin Crooks


       bsf     STATUS,RP0                      ;Page 1
       movlw   SCIUART_SPBRG_BAUD_RATE         ;Configure SPBRG for desired spe
       movwf   SPBRG
       bsf     TXSTA,BRGH                      ;(BRGH)high-speed async. tx/rx
       bcf     TXSTA,TX9                       ;(TX8/9) 8 bit data
       bsf     TXSTA,TXEN                      ;(TXEN) enable tx on init. for i
                                               ; sending of bytes to XETRON dur
ing init.
       bcf     TXSTA,SYNC                      ;(SYNC) asynchronous mode
       bcf     PIE1,TXIE                       ;Disable interrupt on TXREG empt
       bsf     PIE1,RCIE                       ;Enable interrupt on RCREG full

       bcf     STATUS,RP0                      ;Back to page 0

       bsf     RCSTA,SPEN                      ;Enables RC6,RC7 as serial port
       bcf     RCSTA,RX9                       ; 8 bit data
       bsf     RCSTA,CREN                      ;Enable rx on init.

       you're welcome.
{Quote hidden}

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