Ok, my code:
Ok so this is very early code for a 18F452
Do i need to use the BANKSEL or any other type of Access Bank?
i.e
would be:
Or
Where the access bank is stated.
My guess is the former as in the .inc file for MPASM:
0xoFC1 is in the SFR 'Bank' so it could be a direct addressing
Many thanks,
Martyn
Code:
; Mouse Rover MK1
; For uni interviews
;
; Spec:
;
; Ultra Sonic SRF04
; Sharp IR Sensors x2
; Motor Control
; Wireless
; Motor Odomentry
; By MARTYN PITTUCK, Started 07 Nov 04 @ 9:30PM
; Start off by stating the processor and including the directives
Processor 18F452
include "P18F452.INC"
; Start of CUSTOM directives
prog_status Equ 0x00
; End of CUSTOM directives
; Bootloader start, same as interupt vector...
Org 0x0000
GOTO Main
Org 0x0008
GOTO int_server ; Goto the interupt server routine, need a interupt escape...
; Can escape if setup bit is not enabled
; START OF SETUP
setup
; Clear PORTA
BANKSEL PORTA ; Bank 1
MOVLW b'00000000' ; All Outputs low
MOVWF PORTA ; Clear PORTA, All Outputs Low. Bank Previously set
; Configure Analog on PORTA
BANKSEL ADCON1
MOVLW 0x07
MOVWF ADCON1
; Set TRISA
MOVLW b'00000000' ; All Outputs
MOVWF TRISA ; Move W to TRISA
; Set TRISB
MOVLW b'00000100' ; RB2[RX] is input
MOVWF TRISB ; Move W to TRISB
; Set PORTB
MOVLW b'00000000' ; All Outputs low
MOVWF PORTB ; Move W to PORTB
; For now we will use RB3 - but later all LED's will run off i2c bus...
BSF PORTB, 0x04 ; Turn Status LED On (Everything OK)
RETURN
; END OF SETUP ROUTINE
Main
RETURN
int_server
RETFIE
END
Ok so this is very early code for a 18F452
Do i need to use the BANKSEL or any other type of Access Bank?
i.e
Code:
; Configure Analog on PORTA
BANKSEL ADCON1
MOVLW 0x07
MOVWF ADCON1
would be:
Code:
; Configure Analog on PORTA
MOVLW 0x07
MOVWF ADCON1
Or
Code:
; Configure Analog on PORTA
MOVLW 0x07
MOVWF ADCON1, 0
Where the access bank is stated.
My guess is the former as in the .inc file for MPASM:
Code:
ADCON1 EQU H'0FC1'
0xoFC1 is in the SFR 'Bank' so it could be a direct addressing
Many thanks,
Martyn