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.

How to interrupt with a stop timing input when 16f628a timer is running?

Status
Not open for further replies.

billyboy1959

Newbie level 4
Joined
Apr 27, 2010
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
boltonuk
Activity points
1,334
Hi
For you this will be a simple question but with a 16f628a if i want to start a timer for entry delay of an alarm i can use timer calc but when this 20sec delay is running how do i interupt with a stop timing input as the pic is tied up running the timing routine.
Thanks
Billyboy
 

Re: 16f628a timer

Hi,

You can achieve this a couple of different ways.

First you can add into your delay routine so that it checks the status of the stop timing switch every 250ms or so, btfss PortB,0

Second you can use the Interrupt on Change feature of Port B - as detailed in the I/O PortB section of the datasheet.
 

Re: 16f628a timer

Hi Thanks for the reply.
Ok being new to pics i only know the basics switch led on and off what inputs are what outputs are and a few comands is there any chance of a bit of guidance on this subject please.
I have been in hospital and now i am on my bed most of the day I looked at getting into pics about 5 years ago have a few books and programmers but thought now was ideal time to give it a go.
Thanks
Billyboy
 

Re: 16f628a timer

Hi,

Well a Yorkshire Pudding helping out a Lancashire Hot Pot, whatever next .. :D

Depends what you are programming with Assembler, C or Basic ? - I can only help with Assembler -

The best thing to do is to post the code you have done for the delays; include all the start up code etc so we can see how you are doing.

Enclose the code with the 'Code' Tags from the toolbar above - doesn't matter if its rough - well all started the same.

Have you been following any tutorial ? - there are some good ones online - depending what you are coding in.
 

Re: 16f628a timer

Hi Sorry i have not done much but i am hoping that over time with reading and help off here i will get this up and running.
i intend to use internal osc ant the timer is for exit delay of 20 seconds i will need to do a 20 second delay that i can interupt to switch alarm off but that will be my next problem.
Regards
Billyboy
 

Re: 16f628a timer

Hi,

Ok can see the kind of thing you are aiming for so will try and steer you in the right direction.

You say you have some hardware, can I ask what that is, paricularly what programmer you are using.

As I mentioned before there are several good tutorials online, which may not be doing exactly what you want, but they do share many common elements - here is a good one using the same chip http://www.winpicprog.co.uk/pic_tutorial.htm - a local guy just down in Derbyshire.

For your actual code, it is really just the working bit of the whole program, so this is what you need to do to try and turn it into a useable program.

First off open the 16F628A.asm Template file, this is a precoded starter file -you will find it in the microchip/mpasm_suite/Templates/Code directory.

Your code will drop into the Main area of that template.

What I would suggest you do, is for now leave out your delay function, that will overly complicate things while you get to grips with everything.
You have the switch inputs and the leds output - well thats a great starter program - make switch 1 when pressed turn on led1, and so on for the others.

Before you can use the ports, you need to set them up, that is you must specify if they are to be inputs or output and also for PortA you need to tell it if they are to be Analogue or the Digital ports your need.
Have a read at the datasheet port section.

Others may give you the code, but I won't until you are stuck, otherwise you will never learn - it seems difficult at first but it will suddenly alll drop into place - and thats a grand feeling.
 

Re: 16f628a timer

Hi wp100
Thanks for your reply i keep going to sleep and then logging on again. I think its the medication so there is a delay me getting back to you.
I will read up and try my best to understand and as you have said i will finnish this with no timers and fit them in after.
I have an elvis programmer and a velleman k8048 programmer/development board and i have the original everyday practical electronics pic tutor board. I have a few books inc pic your personal introductory course, Pic in practice, An introduction to pic mirocontrollers,Practical pic microcontroller projects and more not sure were they are. I have played with electronics since buying my first electronics mag in 1973 and am an electrician more on the industrial side installation and repair of machines. I am not working at the moment as i have something wrong with my chest not my heart but am waiting for results from tests and hoping i dont end up back in hospital as i dont think they will let me have all my books and laptop on the bed as i am doing here.bit long winded story but there you go.
Regards
Bill
 

Re: 16f628a timer

Hi,

Well you sure have got plenty of kit and books to get you going - though it probably will not seem like it until you get something programmed in and working - then it always seems to make more sense when you can actually see it doing something.

Have seen the epe tutor board, but almost forgotten what it looks like, am sure that and the Velleman board will serve you well, you do not need mega complex dev boards to get you well aquainted with the pics.

Have a go with that switch / led code for a bit, you can burn it into the chip but there are also ways you can simulate the code on the PC, but again that might add too much info at this stage.

It will certainly take your mind off other matters, but cannot guarantee Pic programming will keep your bp down :lol:

See how you go, don't struggle too much, if you get stuck or just lost, then post your problem and code here - there is always someone to help - its a world wide forum.
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top