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.

Automatic school bell with PIC16F876A

Status
Not open for further replies.

john120

Banned
Joined
Aug 13, 2011
Messages
257
Helped
11
Reputation
22
Reaction score
10
Trophy points
1,298
Activity points
0
Hi,Hi every body ,I would like to realize a school bell which rings at 50minutes and ring during 8 second .
Help me for programming please.

It has 8 period and the ninght for break of 30 minutes.

I am using CCS C
 

Are you looking to use a Real-Time-Clock module to keep the time (For if power is cut to your module)... I2c RTC's are easy to communicate with, I've got some sample code I used on an 877 to start if this is a way you might go...

Kind regards
NEAL
 
could you please give me the link of those sample codes?

I don't care about power cut off.

---------- Post added at 10:48 ---------- Previous post was at 10:37 ----------

see my code here below:
#include<16f876a.h> //PIC Name
#fuses HS,NOWDT
#use delay(clock=16000000)//External Oscillator Frequency
//#use fast_io(port)
#use standard_io(a)
#use standard_io(c)
void main()
{
//set_tris_a(0xff);
set_tris_c(0x00);
output_c(0x00);
while(true)
{
output_high(PIN_C2);
delay_ms(8000);//Ring at start up during 8 seconds

output_low(PIN_C2);
delay_ms(3000000);//1st period

output_high(PIN_C2);
delay_ms(8000);//ring at start up during 8 seconds

output_low(PIN_C2);
delay_ms(3000000);//second period

output_high(PIN_C2);
delay_ms(8000);//ring at start up during 8 seconds

output_low(PIN_C2);
delay_ms(3000000);//third period

output_high(PIN_C2);
delay_ms(8000);//ring at start up during 8 seconds

output_low(PIN_C2);
delay_ms(3000000);//Fourth period

output_high(PIN_C2);
delay_ms(8000);//ring at start up during 8 seconds

output_low(PIN_C2);
delay_ms(1800000);//Fourth period

output_high(PIN_C2);
delay_ms(8000);//ring at start up during 8 seconds

output_low(PIN_C2);
delay_ms(3000000);//Firth period

output_high(PIN_C2);
delay_ms(8000);//ring at start up during 8 seconds

output_low(PIN_C2);
delay_ms(3000000);//Sixth period

output_high(PIN_C2);
delay_ms(8000);//ring at start up during 8 seconds

output_low(PIN_C2);
delay_ms(3000000);//Siventh period

output_high(PIN_C2);
delay_ms(8000);//ring at start up during 8 seconds

output_low(PIN_C2);
delay_ms(3000000);//ending period 8th

}
}
 

Cool! That looks OK to me!
NEAL

---------- Post added at 08:51 ---------- Previous post was at 08:49 ----------

One thing,

"delay_ms(3000000);//Siventh period"

I have to use DelayBigMs() for delay values more than 255. Sometimes best to us a loop...
NEAL
 
Last edited:
#include<16f876a.h> //PIC Name
#fuses HS,NOWDT
#use delay(clock=16000000)//External Oscillator Frequency
//#use fast_io(port)
#use standard_io(a)
#use standard_io(c)
void main()
{
//set_tris_a(0xff);
set_tris_c(0x00);
output_c(0x00);
while(true)
{
output_high(PIN_C2);
delay_ms(8000);//Ring at start up during 8 seconds

output_low(PIN_C2);
delay_ms(3000000);//1st period

output_high(PIN_C2);
delay_ms(8000);//ring at start up during 8 seconds

output_low(PIN_C2);
delay_ms(3000000);//second period

output_high(PIN_C2);
delay_ms(8000);//ring at start up during 8 seconds

output_low(PIN_C2);
delay_ms(3000000);//third period

output_high(PIN_C2);
delay_ms(8000);//ring at start up during 8 seconds

output_low(PIN_C2);
delay_ms(3000000);//Fourth period

output_high(PIN_C2);
delay_ms(8000);//ring at start up during 8 seconds

output_low(PIN_C2);
delay_ms(1800000);//Fourth period

output_high(PIN_C2);
delay_ms(8000);//ring at start up during 8 seconds

output_low(PIN_C2);
delay_ms(3000000);//Firth period

output_high(PIN_C2);
delay_ms(8000);//ring at start up during 8 seconds

output_low(PIN_C2);
delay_ms(3000000);//Sixth period

output_high(PIN_C2);
delay_ms(8000);//ring at start up during 8 seconds

output_low(PIN_C2);
delay_ms(3000000);//Siventh period

output_high(PIN_C2);
delay_ms(8000);//ring at start up during 8 seconds

output_low(PIN_C2);
delay_ms(3000000);//ending period 8th

}
}
see the code I am now using
 

How to use such loop for big delay??
The code given on the site the one I said I a using are not working fine.
Hope you can also show me how to use a push button for getting started and how to stop while running!
Thanks
 

If this was left to run over a long period of time then period would slowly move throughout the days, due to you not allowing for the 8sec bell time.
 
could you plz tell me by code ;meanwhile email me the code then I try with them!!
 

You ok now matey? I've been stuck in bed and something has made 3 ComtrendPowerline adapters in the house blow in 2 weeks, mine was today! Pain in ass!
Bridged wireless is doing the job for now..
NEAL
 

Are you looking to use a Real-Time-Clock module to keep the time (For if power is cut to your module)... I2c RTC's are easy to communicate with, I've got some sample code I used on an 877 to start if this is a way you might go...

Kind regards
NEAL

hello mr.Neal.. could you please sent me your sample code? we are having a project using RTC for our automatic school bell.. tessajaneflores@yahoo.com. thank you very much!
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top