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.

Help with PIC programming

Status
Not open for further replies.

Jay23

Newbie level 6
Newbie level 6
Joined
Oct 14, 2013
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,488
Hi All,
I need to tweek my PIC SW with some added functions. Hope some with good programming skills can lend me hand.
1)I need to make my START_STOP button when pressed a second time to stop the counter and resets.
30min_button is ON
Start_Stop_button is ON
Counter starts to count down
If Start_Stop_button is pressed again counter resets.

2) when insignal Oven_OFF is received Counter stops and resets.
Thanks a lot//gonzo
 

Attachments

  • counter.txt
    4.1 KB · Views: 71

Need more information:

1) Which PIC? (exactly)
2) Which compiler?
3) What configuration bit settings?
4) What value crystal (assuming 2-pin crystal used)

I will make a wild guess a mikroC compiler, in which case zip up the whole project folder into a .zip file and post here. This will tell me most of what I need to know to try and help you.

Still need to know the answer to question 4 even with zip file
 

Hi, i am using PIC16F886 and I zip the whole folder from MicroC.
MicroC
4Mhz
Thanks.
 

Attachments

  • spisvakt.zip
    64.3 KB · Views: 110

Still working on it - required a re-write, but have made good progress.

2) when insignal Oven_OFF is received Counter stops and resets.

Is the signal normally high, and reset is required when it goes low? ... or normally low and reset wanted when it goes high?

Do you want the time set buttons disabled while counting? ... or the ability to set new time even while a countdown is running?
 

Current test program attached - using seconds and minutes rather than hours - just while developing.

Might give you an idea of where I am going, and where I might not be meeting requirements...

.... or maybe you would like to finish this yourself, if this code is enough to get you started?
--- Updated ---

Attached is updated code that I feel happy with....

I will leave you to tweak it to your preferences....
 

Attachments

  • timer.zip
    40.3 KB · Views: 99
  • timer.zip
    41.1 KB · Views: 107
Last edited:

Still working on it - required a re-write, but have made good progress.



Is the signal normally high, and reset is required when it goes low? ... or normally low and reset wanted when it goes high?

Do you want the time set buttons disabled while counting? ... or the ability to set new time even while a countdown is running?
Hi, This signal is low and goes high when RESET.

//
--- Updated ---

Current test program attached - using seconds and minutes rather than hours - just while developing.

Might give you an idea of where I am going, and where I might not be meeting requirements...

.... or maybe you would like to finish this yourself, if this code is enough to get you started?
--- Updated ---

Attached is updated code that I feel happy with....

I will leave you to tweak it to your preferences....
Thanks, I will take alook and send feed back. Thanks a lot.
//regards,Gonzo
 

This signal is low and goes high when RESET.
Then you will need to change-
Code:
            if(!Oven_OFF){                                                       // if RC7 goes low
to-
Code:
            if(Oven_OFF){                                                       // if RC7 goes high
 

Hi, i am using PIC16F886 and I zip the whole folder from MicroC.
MicroC
4Mhz
Thanks.
--- Updated ---

Hi Hexreader,
I tried your code on my device. It was not working as I want it to work.
May be you misunderstood how I was thinking.
It should work like this:
It has 3 set time buttons: 30 min , 2 hour and 5 hour
start/Stop button
When the device is on it will display some messages.
Timer OFF
Set Time : 00:00
When I press 30 min button: green_led is ON
Message: Set time 00;30
When i press the Start/Stop button: Start_Stop led is ON
Message: Timer is ON

So if I want to abort time maybe change so I want to press the Start/Stop again and it should reset the counter to zero
and OFF the green_led and Start/Stop led.

The Oven_OFF is signal from another microcontroller which is HIGH and the PIC resets the current counter when it receives this.

I hope you can help to tween your code.
//regards,Gonzo
 
Last edited:

I reckon I can make the code work that way...

Working on it....
 

Latest attempt attached - I will leave it for you to test.
--- Updated ---

EDIT:

1) oooh nasty - start button works with no time set - will fix that

2)Do you really want Relay 3 toggling while countdown is in progress?

3) If it were my project, I would disable 3-min, 2-hour and 5 hour buttons while countdown is in progress. Would you like me to do it that way?
 

Attachments

  • timer.zip
    44.7 KB · Views: 102
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top