Hi Folks,
I tried several times to post the following code on Microchip Forum.
But it just kept taking out the line breaks and spaces even after I used their online editor?
Anyway after I program this chip with the following (some parts removed to simplify the example) I can not find a serial output on any pin? It should be RC4 as far as I know?
This editor has not been as bad but I have tried to indent with spaces for the lines within a subroutine but it took them out when I posted???
list p=PIC16F1825
#include <p16f1825.inc>
__CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOREN_OFF & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF
__CONFIG _CONFIG2, _WRT_OFF & _PLLEN_OFF & _STVREN_OFF & _BORV_25 & _LVP_OFF
ORG 0x0000
PAGESEL START
GOTO START
ORG 0x0004
;--INTERRUPT ROUTINE NOT INCLUDED BUT WORKING
START
call Set_Ports
call INT_initialize ;(WORKING - NOT INCLUDED)
call USART_initialize
call USART_Baud_rate_adjust
Main
call Delay ;--- NOT INCLUDED (ABOUT 1/2 SEC.)
call FlashPortC1 ;-- NOT INCLUDED (BUT WORKING)
movlw 0x55
movwf TXREG ; !!! NO OUTPUT ANYWHERE !!!
goto Main
Set_Ports
banksel ANSELA
clrf ANSELA
banksel ANSELC
clrf ANSELC
banksel CM1CON0
clrf CM1CON0
banksel CM1CON1
clrf CM1CON1
banksel CM2CON0
clrf CM2CON0
banksel CM2CON1
clrf CM2CON1
banksel PORTA
clrf PORTA
banksel LATA
clrf LATA
banksel TRISA
movlw b'00000000'
movwf TRISA
banksel PORTC
clrf PORTC
banksel LATC
clrf LATC
banksel TRISC
movlw b'00100000'
movwf TRISC
banksel START
return
USART_initialize
banksel TXSTA
movlw b'00100000'
movwf TXSTA
banksel RCSTA
movlw b'10010000'
movwf RCSTA
banksel START
return
USART_Baud_rate_adjust
banksel SPBRGH
movlw 0x00
movwf SPBRGH
banksel SPBRGL
movlw 0x33
movwf SPBRGL
banksel START
return
END
Yours,
Colin Wilson
I tried several times to post the following code on Microchip Forum.
But it just kept taking out the line breaks and spaces even after I used their online editor?
Anyway after I program this chip with the following (some parts removed to simplify the example) I can not find a serial output on any pin? It should be RC4 as far as I know?
This editor has not been as bad but I have tried to indent with spaces for the lines within a subroutine but it took them out when I posted???
list p=PIC16F1825
#include <p16f1825.inc>
__CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOREN_OFF & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF
__CONFIG _CONFIG2, _WRT_OFF & _PLLEN_OFF & _STVREN_OFF & _BORV_25 & _LVP_OFF
ORG 0x0000
PAGESEL START
GOTO START
ORG 0x0004
;--INTERRUPT ROUTINE NOT INCLUDED BUT WORKING
START
call Set_Ports
call INT_initialize ;(WORKING - NOT INCLUDED)
call USART_initialize
call USART_Baud_rate_adjust
Main
call Delay ;--- NOT INCLUDED (ABOUT 1/2 SEC.)
call FlashPortC1 ;-- NOT INCLUDED (BUT WORKING)
movlw 0x55
movwf TXREG ; !!! NO OUTPUT ANYWHERE !!!
goto Main
Set_Ports
banksel ANSELA
clrf ANSELA
banksel ANSELC
clrf ANSELC
banksel CM1CON0
clrf CM1CON0
banksel CM1CON1
clrf CM1CON1
banksel CM2CON0
clrf CM2CON0
banksel CM2CON1
clrf CM2CON1
banksel PORTA
clrf PORTA
banksel LATA
clrf LATA
banksel TRISA
movlw b'00000000'
movwf TRISA
banksel PORTC
clrf PORTC
banksel LATC
clrf LATC
banksel TRISC
movlw b'00100000'
movwf TRISC
banksel START
return
USART_initialize
banksel TXSTA
movlw b'00100000'
movwf TXSTA
banksel RCSTA
movlw b'10010000'
movwf RCSTA
banksel START
return
USART_Baud_rate_adjust
banksel SPBRGH
movlw 0x00
movwf SPBRGH
banksel SPBRGL
movlw 0x33
movwf SPBRGL
banksel START
return
END
Yours,
Colin Wilson
Last edited: