Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Hello world not working (16F74)

Status
Not open for further replies.
What about checking the TRMT bit?

Code:
TXRDY:
    bsf STATUS,RP0          ; bank 1
Wait:
    btfss TXSTA, TRMT       ; transmission complete?
    goto Wait 
    bcf STATUS,RP0          ; bank 0
Send:
    movwf TXREG             ; send data 

    return
I would also provide a short delay after initialization of the USART module...
 
Nigel Goodwin said:
Why two goto's?.

Change the BTFSC to BTFSS and delete the GOTO XMIT1 :D

Here are the routines from my RS232 tutorial.

Code:
XMIT_RS232  	btfss   PIR1,	TXIF 	      ;xmit buffer empty?
     		GOTO	XMIT_RS232            ;no, wait
     		MOVWF   TXREG		      ;now send
                RETURN

Rcv_RS232   	BTFSS   PIR1,	RCIF 	      ; check for received data
     		GOTO    Rcv_RS232
                MOVF    RCREG,	W
                RETURN

hi,
Quite right, clumsy coding:rolleyes:
Eric
 
eng1 said:
What about checking the TRMT bit?

Code:
TXRDY:
    bsf STATUS,RP0          ; bank 1
Wait:
    btfss TXSTA, TRMT       ; transmission complete?
    goto Wait 
    bcf STATUS,RP0          ; bank 0
Send:
    movwf TXREG             ; send data 

    return
I would also provide a short delay after initialization of the USART module...

Bente Petersen using the same technic :D
 
ericgibbs said:
hi,
I use this subr on all my PIC prgms with no problems

;---- SERIAL UART ----
; Hardware Serial Communication Routines
TXRDY:
BTFSC PIR1,TXIF
GOTO XMIT1
GOTO TXRDY;busy,so loop
XMIT1:
MOVWF TXREG;send
RETURN

Are you sure that the receiving PC is OK?

Eric

Hi,
You hav any routine for PIC C to do serial communication?
Thanks
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top