Thanks to all that replied to my request. Regards, Royce ----- Original Message ----- From: Tony Nixon To: Sent: Monday, February 18, 2002 4:38 PM Subject: Re: [PIC]: F628 Asnyc Serial Input > Royce Simmons wrote: > > > > Greetings All, > > > > Does anyone have code for a F628 serial input routine? I am having problems > > making this > > work. I suppose lack of skill is the problem but I am confused with all the > > register options. > > > > Thanks, Royce > > > > -- > > http://www.piclist.com hint: The PICList is archived three different > > ways. See http://www.piclist.com/#archives for details. > > Bit Banged 9600, 1 stop, no parity. > > #Define SkipIfRxLow btfsc PORTB,RX > #Define Tx_Low bcf PORTB,TX > #Define Tx_High bsf PORTB,TX > > ; > ; --------------- > ; RECEIVE ROUTINE > ; --------------- > ; > RxRoutine SkipIfRxLow ; wait for start bit > goto RxRoutine > > call HBDelay2 ; wait 1/2 bit length - 2 cycles > movlw 9h > movwf BCount > > RxLoop SkipIfRxLow ; start bit is lost during routine > goto RxHiBit > > bcf STATUS,C ; receive start bit and 8 data bits > goto RxLoBit > > RxHiBit bsf STATUS,C > nop > RxLoBit rrf RxHold,F > call HBDelay4 ; wait 1/2 bit length - 4 cycles > call HBDelay5 ; wait 1/2 bit length - 5 cycles > decfsz BCount,F > goto RxLoop > > movf RxHold,W > return ; data returned in W Reg > ; > ; ---------------- > ; TRANSMIT ROUTINE > ; ---------------- > ; > TxRoutine movwf TxSend ; temp store data to be sent > Tx_Low ; do start bit > call HBDelay5 > call HBDelay2 > > movlw 8h ; 8 data bits to send > movwf BCount > > TxLoop rrf TxSend,F > btfsc STATUS,C > goto TxHiBit > > nop > Tx_Low > goto DoneBit > > TxHiBit Tx_High > goto $ + 1 > > DoneBit call HBDelay5 ; wait 1 bit length > call HBDelay5 > decfsz BCount,F > goto TxLoop > > call DoRet > nop > Tx_High ; stop bit > call HBDelay1 > call HBDelay > DoRet return > ; > ; ---------------------------- > ; HALF BIT DELAY FOR 9600 BAUD > ; ---------------------------- > ; > HBDelay nop > HBDelay1 nop > HBDelay2 goto $ + 1 > HBDelay4 nop > HBDelay5 movlw 0x0D > movwf BitWait > BW decfsz BitWait,F > goto BW > nop > nop > nop > return > > -- > Best regards > > Tony > > mICros > http://www.bubblesoftonline.com > mailto:sales@bubblesoftonline.com > > -- > http://www.piclist.com hint: The PICList is archived three different > ways. See http://www.piclist.com/#archives for details. > > -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.