I have also noticed that I could not get certain ports(AN ports) to work as digital inputs at all using the normal code(after setting all the registers that are needed to make them digital):-
Code: Select all
Input(DWN)
If DWN=1 Then
While DWN=1
LED_ON
Wend
EndIf
After reading and reading I noticed in the small initialisation example that is given in ASM that it toggled WDTCON.4 from 0 to 1 while it wrote to ANCON0 and ANCON1 so I have now done this and it works:-
Code: Select all
'MAKE ALL PORTS DIGITAL ON 18F67J11
WDTCON.4=1 'ANCONx(shared registers) can only be written when WDTCON.4=1
ANCON0=%11111111 'make AN0 to AN7 digital
ANCON1=%11111111 'make AN8 to AN15 digital
WDTCON.4=0 'switch off shared registers
ADCON0=%00000000 'switch off the AD converter
ADCON1=%10000000 'right justify AD result
INTCON=%00000000 'disable all INTCON interrupt components
INTCON2=%10000000 'disable PORTB pullups
TRISG.7=0 'disable PORTD pullups
TRISG.6=0 'disable PORTE pullups
TRISG.5=0 'disable PORTJ pullups
CCP1CON=%00000000 'disable CCP module
CCP2CON=%00000000 'disable CCP module
CCP3CON=%00000000 'disable CCP module
CCP4CON=%00000000 'disable CCP module
CCP5CON=%00000000 'disable CCP module
CM1CON=%00000000 'disable comparator module
CM2CON=%00000000 'disable comparator module
CVRCON=%00000000 'disable comparator reference