PIC18F87J11 Configuration Bit Settings
; ASM source line config statement
my instructor just did this coding and I just wanted to know that how to comment the code as I really wanted to know that what is actually happening . so i am attaching two program and i tried to do as you will see in program 1.
1.
2.
Mod edit: added code tags
; ASM source line config statement
my instructor just did this coding and I just wanted to know that how to comment the code as I really wanted to know that what is actually happening . so i am attaching two program and i tried to do as you will see in program 1.
1.
Code:
#include "p18F87J11.inc"
temp equ 0x20
org 0
bra mainprog ; jump into main program
oscinit:
bcf OSCCON,IRCF2
bcf OSCCON,IRCF1;
bsf OSCCON,IRCF0;
return
t1init:
movlw 0x30; Timer0,8-bit,ext clk,no prescale
movwf T1CON; load T1CON register
clrf TMR1H; LOAD TH1 as an output
clrf TMR1L; LOAD TL1 as an output
return
ionit:
clrf TRISD; PORTD as a output
return
mainprog:
call oscinit;
call t1init
call ionit
bsf T1CON,TMR1ON;timer1 ON Enable(start)timer1
mainloop:
movff TMR1L,temp
movff TMR1H,WREG
movff temp,PORTD
bra mainloop; jump into main loop
end
Code:
org 0
bra mainprog
oscinit:
bcf OSCCON,IRCF2 ;
bcf OSCCON,IRCF1
bsf OSCCON,IRCF0
return
tmr2pwm:
movlw 0x10 ;
movwf CCP1CON ;
movlw 0xff ;
movwf PR2 ;
movlw 0x80 ;
movwf CCPR1L ;
movlw 0x03 ;
movwf T2CON ;
bcf TRISC,2
3
return
mainprog:
call oscinit
call tmr2pwm
bsf T2CON,TMR2ON
mainloop:
bra mainloop ;
end
Last edited by a moderator: