Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Blink LED blink!please

Status
Not open for further replies.

Wond3rboy

Member
Hi, this is really embarassing to ask something like this but since i have done a lot of such things so here goes nothing:

This is the code:

Code:
list p=18f1320
include <p18f1320.inc>
config osc=INTIO2,wdt=off
org 0
movlw 0X7F
MOVWF ADCON1
MOVLW B'01100000'
MOVWF OSCCON
bcf TRISA,1
movlw 0x02
movwf T0CON

AGAIN:

Btg LATA,1
movlw 0x00
movwf TMR0H
movlw 0x00
movwf TMR0L
bcf INTCON,TMR0IF
bsf T0CON,TMR0ON


DELAY:

btfss INTCON,TMR0IF
bra DELAY
bcf T0CON,TMR0ON

bra AGAIN
END


This code blinks the LED in Debug mode of the Junebug.But when i do it on hardware then nothing happens. As seen in the code i have used the internal 4Mhz oscillator. Prescaled timer0 by 8. I used a 10k(also tried 1k) resistor to Vdd on MCLR(to use POR). I cant figure out what the hell is wrong with the hardware.

Is there something missing, tried timer and all the other general programs in debug mode and all went well but none run in hardware.
 
hi,
Are you using MPLAB set to 'debug' ? if yes, before you program the PIC you should set it to 'release'.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top