View Full Version : Pic 12F509??
northdlights
- 14th January 2009, 01:10
Hello all i am a newbie here,
well i have been given this schematic as a challenge (attached)
i have no previous experience writing in program for pics
my assignment was to write a program that would turn the motor on for 6 sec
if the switch was pressed.
how would i go about starting this?????
mackrackit
- 14th January 2009, 13:08
Welcome.
No experience at all...
Lets start off by finding out what too;s you have to work with.
Programmer?
Pic Basic or Pic Basic Pro?
Do you have MPLAB installed?
We normally like to start folks off with an LED blinking program, but yours also looks like a good one to start with.
One of the first things you need to understand is how to configure the PIC.
This thread will help you there.
http://www.picbasic.co.uk/forum/showthread.php?t=543
And this is useful.
http://www.picbasic.co.uk/forum/showthread.php?t=555
The basic code for you app.
LOOP:
IF PORTx.x = 1 THEN 'Switch pin
HIGH PORTy.y 'Motor pin
PAUSE 6000
LOW PORTy.y
ELSE
LOW PORTy.y
ENDIF
GOTO LOOP
Acetronics2
- 14th January 2009, 13:19
Hi, Northdelights
First of all, Welcome here.
I remember having built such a circuit 10 years ago ( goal was to power a soap pump for 3 secs ... more if finger kept on button ) with a single 555 timer as a monostable multivibrator.
As the case is the same ... you can make the 555 look like a pic ...
honour will be saved ...
Alain
northdlights
- 16th January 2009, 02:05
Welcome.
No experience at all...
Lets start off by finding out what too;s you have to work with.
Programmer?
Pic Basic or Pic Basic Pro?
Do you have MPLAB installed?
We normally like to start folks off with an LED blinking program, but yours also looks like a good one to start with.
One of the first things you need to understand is how to configure the PIC.
This thread will help you there.
http://www.picbasic.co.uk/forum/showthread.php?t=543
And this is useful.
http://www.picbasic.co.uk/forum/showthread.php?t=555
The basic code for you app.
LOOP:
IF PORTx.x = 1 THEN 'Switch pin
HIGH PORTy.y 'Motor pin
PAUSE 6000
LOW PORTy.y
ELSE
LOW PORTy.y
ENDIF
GOTO LOOP
Thank you dave for the advice and for also providing the code for me that was kind of you.
Ill look into it alittle more to determine how you get there and how label each pin
:D
Archangel
- 16th January 2009, 02:24
Hello northdlights,
Welcome,
Here are some links that are really going to be "assigned reading" because you absolutely need to know this. You would do well to avail yourself of all the links in the <b>FAQ</b> section available from the forum home page. Probably the most difficult thing to learn is how to interpret the data sheets
http://www.picbasic.co.uk/forum/showthread.php?t=543
http://www.picbasic.co.uk/forum/showthread.php?t=561
mackrackit
- 16th January 2009, 03:54
When you go to the FAQ section you may need to set the Display Options at the bottom of the page to show threads from the beginning.
northdlights
- 17th January 2009, 01:08
Hello northdlights,
Welcome,
Here are some links that are really going to be "assigned reading" because you absolutely need to know this. You would do well to avail yourself of all the links in the <b>FAQ</b> section available from the forum home page. Probably the most difficult thing to learn is how to interpret the data sheets
http://www.picbasic.co.uk/forum/showthread.php?t=543
http://www.picbasic.co.uk/forum/showthread.php?t=561
Hi joe
thanks for the links,
yeah i had gotten a start at the data sheet and it gets me lost i have to read it about two times to connect the dots:p
Powered by vBulletin® Version 4.1.7 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.