Discussion:
help with programming please
(too old to reply)
Andy Sutton
2009-11-18 12:11:53 UTC
Permalink
Hi,

I'm having trouble getting my head around programming a pic (from scratch)

Basically i want it to do :-

Loop
look at 3 inputs (not analogue)
compare with the inputs that were stored in the last loop around
if they are the same wait say .5 sec
then loop again
if the inputs are different then output (for a relay) for .5 sec

this project, i thought would be fairly easy or so i thought.

Anyone willing to help me write a program if it is that easy.

Any help would be most appreciated

Andy Sutton
Dunno WhoCares
2009-11-19 04:21:21 UTC
Permalink
Hi

Just trying to get more specifics on your programming issues...

Which PIC are you using?

Are you using C or assembler or other to program your microcontroller?


On Wed, 18 Nov 2009 12:11:53 -0000, "Andy Sutton"
Post by Andy Sutton
Hi,
I'm having trouble getting my head around programming a pic (from scratch)
Basically i want it to do :-
Loop
look at 3 inputs (not analogue)
compare with the inputs that were stored in the last loop around
if they are the same wait say .5 sec
then loop again
if the inputs are different then output (for a relay) for .5 sec
this project, i thought would be fairly easy or so i thought.
Anyone willing to help me write a program if it is that easy.
Any help would be most appreciated
Andy Sutton
Andy Sutton
2009-11-19 19:33:53 UTC
Permalink
Hi ,

The pic is a 16f627

It can with the velleman pic programmer and expererimentation board kit from
maplin

I also have the micrologic mplad ide delevolpment board/kit from rs
component


trying to use assembler

Hope this helps
ian field
2009-11-21 17:36:06 UTC
Permalink
Post by Andy Sutton
Hi,
I'm having trouble getting my head around programming a pic (from scratch)
Basically i want it to do :-
Loop
look at 3 inputs (not analogue)
compare with the inputs that were stored in the last loop around
if they are the same wait say .5 sec
then loop again
if the inputs are different then output (for a relay) for .5 sec
this project, i thought would be fairly easy or so i thought.
Anyone willing to help me write a program if it is that easy.
Any help would be most appreciated
Andy Sutton
Look into Everyday Practical Electronics, they favour the pic and are
currently running the Teach in 2010 series on programming the pic.

The series started in the November issue, so you'd need to order the back
issue.

From time to time they have special offers on heavily discounted Pickit2
programmers.
andy
2009-11-21 17:56:49 UTC
Permalink
Yes Ian,

I bought the electronics teach-in 2 book a few weeks ago.
It doesn't give me an idea of how to look at the state of an input, without
waiting for a button to be pressed.

Umm i should have just though- should i look for the button press by waiting
a few msecs....
If input high = makes pic think button has been pressed
If input times out low= make pic think button has not been pressed.

I forget this pic programming has to be soooo logical based, its easy to get
in a twist prehaps.
ian field
2009-11-21 20:57:15 UTC
Permalink
Post by andy
Yes Ian,
I bought the electronics teach-in 2 book a few weeks ago.
It doesn't give me an idea of how to look at the state of an input,
without waiting for a button to be pressed.
Umm i should have just though- should i look for the button press by
waiting a few msecs....
If input high = makes pic think button has been pressed
If input times out low= make pic think button has not been pressed.
I forget this pic programming has to be soooo logical based, its easy to
get in a twist prehaps.
Have you inspected the abundant supply of appnotes on the Microchip website?

Unfortunately the Microchip site is a bit lacking on tutorials, but there
are a few excellent one's on the web, just keep experimenting with pic
related search strings in google, you should find a tutorial that more or
less does it for you.

Loading...