

Moderators: pedja089, stojke369, [eDo], trax
Code: Select all
DEFINE OSC 4
ANSEL = %00000000 'all analogue ports to digital 11111111 was ok
ANSELH = %00000000 'all analogue ports to digital 11100010 was ok
'ANSEL = %11111111 'All Analog Ports are analog
'ANSELH = %11100010 'all analogue ports to digital 11100010 was ok
ADCON0.0 = 0 'disable ADCANCON0 = %00000000
TRISB = 1
TRISC = 0
PORTB = 0
PORTC = 0
if PORTB.0 = 1 THEN
HIGH PORTC.0
ENDIF
Code: Select all
DEFINE OSC 4
CMCON = 7
INTCON = 0
TRISB = 0
PORTB = 0
PETLJA:
toggle PORTB.0
pause 2000
GOTO PETLJA
Code: Select all
@ DEVICE INTRC_OSC_NOCLKOUT
' System Clock Options
@ DEVICE WDT_OFF
' Watchdog Timer
@ DEVICE PWRT_ON
' Power-On Timer
@ DEVICE MCLR_ON
' Master Clear Options (Internal)
@ DEVICE BOD_ON
' Brown-Out Detect
@ DEVICE LVP_OFF
' Low-Voltage Programming
@ DEVICE CPD_OFF
' Data Memory Code Protect
@ DEVICE PROTECT_OFF
' Program Code Protection
CMCON = 7
INTCON = 0
TRISB = 0
PORTB = 0
PETLJA:
toggle PORTB.0
pause 2000
GOTO PETLJA
Code: Select all
TRISB = %00000000 ' set all as outputs
CCP1CON = 0 ' turn off capture/compare mode (set all digital I/O)
CMCON = 7 ' disable comparators
OPTION_REG = %10000000 ' bit 7 = 1 disables weak pull-ups on portB
INTCON = 0 ' disable interrupts
PORTA = 0
PORTB = 0
PETLJA:
PORTB.0 = 1
pause 1000
PORTB.0 = 0
PAUSE 1000
GOTO PETLJA
Koji program mozda ovaj ?program je radio ko trčeče svijetlo dok nisam dodao onaj red PORTA = 0
Code: Select all
TRISB = %00000000 ' set all as outputs
CCP1CON = 0 ' turn off capture/compare mode (set all digital I/O)
CMCON = 7 ' disable comparators
OPTION_REG = %10000000 ' bit 7 = 1 disables weak pull-ups on portB
INTCON = 0 ' disable interrupts
PORTA = 0
PORTB = 0
PETLJA:
PORTB.0 = 1
pause 1000
PORTB.0 = 0
PAUSE 1000
GOTO PETLJA
i ne kazem da znam šta radim jer da znam nebi otvaro ovaj topic