1 / 13

PIC 16F877 and Serial communication

PIC 16F877 and Serial communication. Serial communication. movlw d’129’ ; 9600 @20Mhz movwf SPBRG. movlw b'00100100' ; brgh = 1 movwf TXSTA ; enable Async Transmission, set brgh banksel RCSTA ; bank0 movlw b'10010000' movwf RCSTA ; enable Async Reception. RecLoop nop

saman
Download Presentation

PIC 16F877 and Serial communication

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PIC 16F877 and Serial communication Serial communication

  2. movlw d’129’ ; 9600 @20Mhz movwf SPBRG movlw b'00100100' ; brgh = 1 movwf TXSTA ; enable Async Transmission, set brgh banksel RCSTA ; bank0 movlw b'10010000' movwf RCSTA ; enable Async Reception

  3. RecLoop nop btfss PIR1,RCIF ; check for received data goto RecLoop movf RCREG,w return TxLoop nop btfss PIR1,TXIF ;xmit buffer empty? goto TxLoop ;no, wait movwf TXREG return Reception and transmit loops

  4. PIC and PC Serial port

  5. Table 5 : Table of Registers

  6. LSR register

  7. Subroutine for reading and Writing Reading int c; int PORT1=0x2F8; c = inp(PORT1 + 5); If (c & 1==1) { myvalue = inp(PORT1); } …… Writing: c = inp(PORT1 + 5); If (((c&0x20)>>5)==1) {outp(PORT1,value)};

More Related