This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

RS-232 protocol

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#include<p16f877a.inc>

__config _XT_OSC & _WDT_OFF & _PWRTE_OFF & _BODEN_OFF & _WRT_OFF & _DEBUG_OFF

bsf STATUS,5

movlw b'00000110' ; SPBRG value acc to baud Rate=6 & baud rate-9600,FOSC-4MHz
movwf SPBRG
bcf TXSTA,BRGH ;speed low
bcf TXSTA,SYNC ; Asynchro
;bcf TRISC,7
;bcf TRISC,6

bcf STATUS,5
bsf RCSTA,SPEN ;Serial Port Enable

bsf STATUS,5
bsf TXSTA,TX9 ; 9 bit data enable
bsf TXSTA,TXEN ;Transmision Enable

movlw b'00101001' ; 8 bit data 00101001

bcf STATUS,5
movwf TXREG

bsf STATUS,5
bsf TXSTA,TX9D ; 9th bit

delay decfsz 20h,1 goto delay

bcf TXSTA,TXEN

bcf STATUS,5

bcf RCSTA,SPEN

end

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Above is my assembly code for sending a number '297' through Serial Port of an pic16f877A microcontroler
but when i load this to proteus and check by virtual terminal.. i got a totally different symbol continuously øøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøøø....... what is the reason please help me friends

Parents
  • 1. Watch the waveforms on the CRO. Check, whether you are getting proper waveforms (the output is high when no data is being transmitted).
    2. Transmit "AA" to check the clock period of 1 bit which will help you to determine the baudrate from waveform.
    3. If you are getting proper waveforms, then match the Baud Rate of PIC with the baud rate of the receiver (Terminal where you are observing the baudrate).

Reply
  • 1. Watch the waveforms on the CRO. Check, whether you are getting proper waveforms (the output is high when no data is being transmitted).
    2. Transmit "AA" to check the clock period of 1 bit which will help you to determine the baudrate from waveform.
    3. If you are getting proper waveforms, then match the Baud Rate of PIC with the baud rate of the receiver (Terminal where you are observing the baudrate).

Children
No data