david said:
many thanks I havent tried it yet but that is just what i wanted ( hope it
works )
works well.
Use it for the example programs for a subject I'm tutoring at uni.
Just have to remember to check the differences for intialisation / setup.
Like this for using the usart
Start
if Processor == 16F628 ;Initialisation routine for 16f628
CLRF PIR1 ;Clear interrupt flags register
CLRF PORTA
CLRF PORTB ;Clear ports to output all 0's
BSF STATUS, RP0 ;Set RAM Bank 1
CLRF PIE1 ;Clear interrupt enable flags
CLRF TRISA ;Set all port a to outputs
MOVLW .6
MOVWF TRISB ;Port B all outputs except for USART TX/RX
else ;Initialisation for 16f877
CLRF PIR1
CLRF PIR2 ;Clear interrupt flags registers
CLRF PORTA
CLRF PORTB
CLRF PORTC
CLRF PORTD
CLRF PORTE ;Clear ports to output all 0's
BSF STATUS, RP0 ; Set RAM Bank 1
MOVLW .7
MOVWF ADCON1 ;PortA and PortE all digital I/O
CLRF TRISA ;Port A all outputs
CLRF TRISB ;Port B all outputs
MOVLW .192 ;Port C all outputs except for UART RX TX
MOVWF TRISC
CLRF TRISD ;Port D all outputs
CLRF TRISE ;Port E all outputs
endif
Alex