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.

USART 16f268a problem

Status
Not open for further replies.

zhaniko93

New Member
Hello all, here's my code:

; PROGRAM FUNCTION:A bicycle speedometer and mileometer.
;*******************************************************************
; Busy PORTS:
; RA5, RB6, RB7
;*******************************************************************

list P=16F628A
include <P16F628A.inc>
__config _BODEN_OFF & _BOREN_OFF & _CP_OFF & _DATA_CP_OFF & _PWRTE_ON & _WDT_OFF & _LVP_OFF & _MCLRE_OFF & _HS_OSC


movlw 0x07
movwf CMCON

banksel TRISA
clrf TRISA
movlw b'11111111'
movwf TRISB
movlw b'00100100'
movwf TXSTA

banksel PORTA
movlw 0xFF
movwf PORTA
movlw b'10010000'
movwf RCSTA
movlw d'25'
movwf SPBRG



BANKSEL PORTA
movlw 'P'
movwf TXREG
btfss PIR1, RCIF ;test for receive interrupt flag,
;indicating receive complete
goto $-1
END

When I simulate it in Proteus, I Don't get symbol P, what's wrong? It's baud rate is 9600 right?
 
And here's protus file
 

Attachments

  • Project.zip
    11.3 KB · Views: 122
And here's protus file

hi Z9,
With added BANKSEL, works fine in Oshonsoft
Use the CODE tags when posting code, it keeps the formatting.

Code:
; 
PROGRAM FUNCTION:A bicycle speedometer and mileometer.
;************************************************* ******************
; Busy PORTS:
; RA5, RB6, RB7
;************************************************* ******************

    list P=16F628A
    include <P16F628A.inc>
    __config _BODEN_OFF & _BOREN_OFF & _CP_OFF & _DATA_CP_OFF & _PWRTE_ON & _WDT_OFF & _LVP_OFF & _MCLRE_OFF & _HS_OSC

    errorlevel -302, -207

    movlw 0x07
    movwf CMCON

    banksel TRISA
    clrf TRISA
    movlw b'11111111'
    movwf TRISB
    movlw b'00100100'
    movwf TXSTA

    banksel PORTA
    movlw 0xFF
    movwf PORTA
    movlw b'10010000'
    movwf RCSTA
    BANKSEL SPBRG
    movlw d'25'
    movwf SPBRG



    BANKSEL PORTA
    movlw 'P'
    movwf TXREG
    btfss PIR1, RCIF ;test for receive interrupt flag,
    ;indicating receive complete
    goto $-1
    END
 

Attachments

  • AAesp03.gif
    AAesp03.gif
    9.9 KB · Views: 169
Last edited:
It worked, thanks!!!!
 
Last edited:
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top