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.

Need some help with my program of pic18f452

Status
Not open for further replies.

huzeeigat

Member level 4
Joined
Mar 18, 2012
Messages
75
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,288
Location
Andheri
Activity points
1,776
Hey friends i have written a program in c for pic18f452..i have taken help from Muhammad Ali mazidis book of pic18f...
In my program when i give an interrupt on pin INT0.. a delay of 15sec starts..after this i want pin RD1 to go high..so that my relay works on the other end..
 

I am uploading the c file and the proteus simulation file..have a look...
 

Attachments

  • intp.zip
    17.1 KB · Views: 53

Hey friends i have written a program in c for pic18f452..i have taken help from Muhammad Ali mazidis book of pic18f...
In my program when i give an interrupt on pin INT0.. a delay of 15sec starts..after this i want pin RD1 to go high..so that my relay works on the other end..


Just send a high to Port D , RD1 Pin whenever the interrupt occurs. The high at the output pin will switch the relay.
U can control the duration of switching by giving appropriate delay.
 

Hey i hav done that in my program but i dont knw wats the error that is y attached the file if anyone can help..
 

Hey i hav done that in my program but i dont knw wats the error that is y attached the file if anyone can help..

Hi..I have attached a code in ASM...

---------- Post added at 12:23 ---------- Previous post was at 12:22 ----------



Code ASM - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
;*************************************************************************************************
;                                                                                                                                                                                               *
;*  Source code TO compliment the status of BUZZER on every EXTERNAL INTERRUPT   *
;   (PRESS THE EXTERNAL INTERRUPT SWITCH )
;*                                                                                                                                                                                              *
;*************************************************************************************************
        
 
        INCLUDE"P18F4520.INC"   ; include PIC18F4580 definitions
        ORG 0000H                       ; reset vector location
        CLRF PCLATH                     ; clearing program counter higher bits
        GOTO START                      ; jump to start up location ie, 30H
        ORG 0030H 
        
START                                   ; start of program
        MOVLW 0X0F
        MOVWF ADCON1
        BSF TRISB,0                     ; make RB0 (interrupt pin) as input
        BCF TRISE,0                     ; make RE0 as output for buzzer input
        BSF INTCON,GIE          ; global interrupt enable
        BSF INTCON,PEIE
        BSF INTCON,INT0IE       ; external interrupt enable
        BSF INTCON2,RBPU        ; external interrupt enable
        BCF INTCON2,INTEDG0     ; external interrupt enable     
        BCF PORTE,0
        GOTO $                          ; wait for interrupt
        
        ORG 0008H                       ; interrupt service routine, isr
        BCF INTCON,INT0IF       ; clear interrupt flag
        
        ;check if buzzer connected to RE0       is ON and skip to OFF
    BTFSS 20H,1         
        GOTO ON                         ; if not ON buzzer
        GOTO OFF                        ; if yes OFF buzzer
ON:     
        BSF PORTE,0
        BSF 20H,1
        RETFIE                          ; return from isr
OFF:
        BCF PORTE,0
        BCF 20H,1
        RETFIE                          ; return from isr
        
        END                                     ; end of program

 
Last edited by a moderator:

I have changed my program that i uploaded before..m uploading it again nd the simulation file..please require urgent help..
 

Attachments

  • intp1.zip
    17.1 KB · Views: 48

in the above upload i have a delay of 1/2 second..i.e after 1/2 second of giving the interrupt..the led at point rd1 should glow...
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top