Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Assembly Code to Reset the PIC16f873 and goto Sleep mode

Status
Not open for further replies.

skubaig

Newbie level 6
Joined
May 19, 2010
Messages
13
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,361
org 0x00 ; Processor reset address vector
nop
nop
call Initport
goto Start ; Goto the start of main program
;*********Main loop
Initport

bcf STATUS, RP0
clrf PORTA
movlw b'11101111' ; configure LED1 as output pin
movwf TRISA

movlw 0x06 ;Configure all pins
movwf ADCON1
movlw 0xCF
movwf TRISA
bsf STATUS, RP0

return

Start

bsf PORTA,Led1 ; turn on LED
nop
nop
RESET

nop
bcf PORTA,Led1 ; turn off LED
nop
nop
nop
nop
nop
nop
nop


bsf PORTA,Led1 ; turn on LED
nop
nop
nop
nop
nop
nop
nop

bcf PORTA,Led1 ; turn off LED


SLEEP

please check wheather this code is correct or something is wrong I just want to on led before resetting the pic and off LED then on & off LED before going to sleep.........
 

Hi,

Have a look at the comments in your revised code, things might be clearer.

You can use MPlabs Sim to see your code work instead of burning it into a chip each time.
 

Attachments

  • led.rar
    1.1 KB · Views: 66

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top