Name: | Mr. Yoga Raj |
Web Site: | |
Questions Pages:
Questions:
Hello, I plan to make a flashing led project with the 18f452. When I step through the program with MP lab, there is no change in port b or c1/c2 values even though wgre is writting to it. Where is the bug ? Thanks , Yoga; This is my first attempt ; in building a flashing LED using the 18f452 processor LIST P=18F452 radix dec include;************************************************************************************************************ ; Equates ; ;************************************************************************************************************ ; Program equates c1 equ 0x100 c2 equ 0x101 ; User equates.... C equ 0 Z equ 2 ;************************************************************************************************************ ; Define #define LED0 PORTB,0 ;************************************************************************************************************ ; The program begin here org 0x00 ; Reset goto START ;************************************************************************************************************ ; INTERRUPT (no interrupt was planned) org 0x08 nop retfie ;************************************************************************************************************* ; Subroutines DELAY movlw 0x02 DEL clrwdt movwf c2 LOOP1 movlw 0x02 movwf c1 LOOP2 decfsz c1,1 goto LOOP2 decfsz c2,1 goto LOOP1 return ;************************************************************************************************************* ; Main Program is here START ; the begining of the program clrf INTCON ; disable all interupts clrf PORTB ; initialise portb clrf LATB ; initialise all the output pins movlw 0x00 ; w is b'00000000' movf TRISB,1 ; set all port b as output nop nop LED bsf LED0 ; set the led on ; call DELAY bcf LED0 ; set the led off ; call DELAY goto LED ; loop forever END