Reputation: 14865
I have high difficulty to make a PIC16F1703 to work, I would like to ensure the code sample I am using is correct.
It is supposed to be one of the simplest example possible, and make all the pin to output VDD, so I may test it with a voltmeter/LED.
processor 16F1703
radix dec
include p16f1703.inc
errorlevel -302
; reset vector
org H'00'
goto init
; interrupt vector
org H'04'
init NOP
BANKSEL PORTA
CLRF PORTA
BANKSEL PORTC
CLRF PORTC
BANKSEL LATA
CLRF LATA
BANKSEL LATC
CLRF LATC
BANKSEL ANSELA
CLRF ANSELA
BANKSEL ANSELC
CLRF ANSELC
BANKSEL TRISA
MOVLW B'00111111'
MOVWF TRISA
BANKSEL TRISC
MOVLW B'00111111'
MOVWF TRISC
loop NOP
goto loop
end
Is this sample correct for a PIC16F1703 and maintaining all pin at VDD? If no, what is wrong?
Upvotes: 1
Views: 85
Reputation: 10937
No tihis code isn't correct!
According to data sheet, if you set bits in TRISA and TRISB registers to 1 then all corresponding pins are configured as input.
By the way Microchip MPLAB support all PIC MCPUs simulations!
Check datasheet PIC16F1703 section I/O PORTS there is an example: EXAMPLE 11-1: INITIALIZING PORTA
Upvotes: 1