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.

Timer proram needed for Pic16f84

Status
Not open for further replies.

janosandi

Full Member level 4
Joined
Jan 23, 2010
Messages
210
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Activity points
2,788
Hello fiends
I need a small program for pic16f84
a 15min timer ignited with any input port to drive a led on any output
Any help will be appricciated
 

Hi,
This is mikroBASIC code:
Code:
program Timer_15min

'Microcontroller: Microchip PIC 16F84A
'Compiler: mikroBASIC PRO for PIC v3.20
'System Clock: 4MHz
'Clock Source: Crystal
'When button is pressed, LED is lit, then waits for 15 minutes, then LED is turned off

symbol TriggerPin = PORTA.B0
symbol LEDPin = PORTB.B0
const Fifteen = 900000 '900,000 miliseconds = 15 minutes

main:
     TRISA = $FF 'All input
     TRISB = 0 'All output
     PORTB = 0
     if (TriggerPin = 0) then 'If button pressed
        LEDPin = 1
        delay_ms(Fifteen) '15 minutes
        LEDPin = 0
     end if
     while true
     wend
end.
6_1265895082.jpg

Hope this helps.
Tahmid.
 

Thx alot Mr
I dont know anything about mikrobasic
would u plz edit the projects for me
When press the button the timer starts the output goes high &
before 1 min of the timer end another led light on then the 15 min ends
so the first led will keep on & the second one only for the last 1 min of the 15min

would u plz send me the code with ready hex file for pic16f84 &
a link to download the mikrobasic to try it i think its nice one

Your help is very usefull & appriciated
 

Hi,
Here it is:
Code:
program Timer_15min

'Microcontroller: Microchip PIC 16F84A
'System Clock: 4MHz
'Clock Source: Crystal
'When button is pressed, LED is lit, then waits for 14 minutes, second LED is lit, then boths LEDs are turned off

symbol TriggerPin = PORTA.B0
symbol LEDPin = PORTB.B0
symbol LED2Pin = PORTB.B1
const FourteenMin = 840000 '840,000 miliseconds = 14 minutes
const OneMin = 60000 '60,000 miliseconds = 1 minute

main:
     TRISA = $FF 'All input
     TRISB = 0 'All output
     PORTB = 0
     if (TriggerPin = 0) then 'If button pressed
        LEDPin = 1
        delay_ms(FourteenMin) '14 minutes
        LED2Pin = 1
        delay_ms(OneMin) '1 minute
        PORTB = 0 'Turn LEDs off
     end if
     while true
     wend
end.
Connect the second LED to PORTB1.
Hope this helps.
Tahmid.
 

Thx tahmid u r so kind im going now to try this
i dont know how to thank you again

see you soon
John
 

Hello Tahmid
Ive tried ur file But its not working or doing anything
would u plz check it for me
thx alot

John
 

Hi,
Have you used the correct microcontroller: PIC16F84A?
Have you programmed it properly? If necessary, have you set the configuration bit settings properly?
Have you connected the hardware properly?
Have you connected the crystal properly?
Tahmid.
 

Hello tahmid al is ok
im trying it again
THx
 

hi
how can we add interrupt in the above program,suppose if i have to pause the program suppose by pressing the same switch for some duration
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top