I don't know what is wrong.
I made the following code and i have 2 problems.
-Pause 500 is not 0.5 second, it comes about 2 seconds
When i replace RA0,RA1,RA2 with RA3,RA4,RA5
-I can't make RA3,4,5 to work as an input.
What is wrong ?
@DEVICEINTOSC 'Internal oscillator: I/O function on CLKIN pin
@DEVICELVP_OFF 'Low-voltage programming. Not used
@DEVICEWDT_OFF 'Watchdog timer software-controlled. Not used
@DEVICEPWRT_OFF 'Enable the power-up timer. Not used
@DEVICECPD_OFF 'Data code protection
@DEVICECP_OFF 'Code protection
@DEVICEMCLR_OFF 'Use MCLR pin as MCLR. Not used
@DEVICEBOD_OFF 'Disable Brown-out reset
@DEVICEFCMEN_OFF 'Enables internal oscillator on external death. Not Used
@IESO_OFF 'Two-speed start-up. Not used
DEFINE OSC 4
TRISA = 1 'All inputs
TRISC = 0 'All outputs
ANSELA = 0 'Digital in-out
ANSELC = 0 'Digital in-out
GOTO START
START:
IF PORTA.0 = 1 THEN
GOTO LOOP1
ELSE
GOTO LOOP2
ENDIF
GOTO START
END
LOOP1:
IF PORTA.1 = 1 THEN
PORTC.0 = 1
ELSE
PORTC.0 = 0
pause 500
PORTC.0 = 1
pause 500
PORTC.0 = 0
ENDIF
GOTO START
END
LOOP2:
IF PORTA.2 = 1 THEN
PORTC.0 = 1
ELSE
PORTC.0 = 0
ENDIF
GOTO START
End
Bookmarks