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?
 
This is why I don't use Assembly.... SPBRG is in page 1 not page 0... Put BANKSEL SPBRG before use and it will work.
 
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
    9.9 KB · Views: 172
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…