gnupic: 16F628 Serial I/O
Subject:
Re: 16F628 Serial I/O
From:
Antonio A Todo Bom ####@####.####
Date:
3 Sep 2002 16:43:49 -0000
Message-Id: <20020903134230.785b4d2f.antonio@projetos.etc.br>
No dia (On:) Tue, 3 Sep 2002 10:56:31 -0400 (EDT)
####@####.#### escreveu: (wrote:)
>
> hello everyone --
>
> again, thanks to all for their support & help. i'm on my way :)
>
> i'm wondering if anyone has any resources or code they can share with re:
> using the 16F628 for serial i/o. i can find lots of examples of the F84,
> but i know the 628 has a USART onboard, and i'm pretty sure (at least from
> what i've read) that's what i need. the simpler the circuit the better,
> anyway :)
>
> any help would be appreciated.
>
> -matt
Hmm, the use of serial port in F628 is the same on F84. You just need to configure the serial port as you want and move data to the serial buffer. Well, if your problem is to configure here is a block of code to do this.
Serial_ini:
clrf STATUS
movlw B'10010000' ; configure RCSTA to
movwf RCSTA ; Assync, 8 bits, 1 parity
bsf STATUS,RP0 ; select bank1
movlw B'00000111' ; configure TXSTA to
movwf TXSTA ; Assync, 8bitsTX, 1 parity, high speed, don'tgenerate Ints when transmit done
movlw D'12' ; adjust Baud Rate Generator to decimal 12
movwf SPBRG ; to 19200 bps
Consult the datasheet to variants in baud rate, int conf etc.
Regards,
Antonio Augusto Todo Bom Neto
LAX Eletronica e Telecomunicacoes Ltda
gEDA-BR - Users Group - http://gedabr.projetos.etc.br