![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Tools | Display Modes |
|
|
#1 (permalink) |
|
i am a tech at this company i work for and one of my engineers asked me to write a program from the schematic he provided me.
ok so this is my question... my first assignment was to write a code that would enable the pic to turn the motor on for 6 seconds when the switch is pressed then turn off to reserve power and again turn on when the swith is pressed again . i presume it is a NC switch can anyone help me out with this. |
|
|
|
|
|
#3 (permalink) |
|
Use a N.O. switch,like shown here as the RA3/MCLR buttonhttp://ww1.microchip.com/downloads/e...0Schematic.pdf
|
|
|
|
|
|
#4 (permalink) |
|
The place to start is the template file you will find in C:\Program Files\Microchip\MPASM Suite\Template\Code called 12F509temp.asm. You will need to turn off the MCLR pin as your engineer has used it as the input pin.
You will then need to read the datasheet to figure out how to turn on the weak pullup resistors and make GP4 an output. For the delay you can use the Pic Delay Generator and that should get you started. Mike. |
|
|
|
|
|
#7 (permalink) | |
|
Quote:
Hey mike thanks for the info. im guessing from what you wrote he made a mistake with the MCLR pin? |
||
|
|
|
|
#9 (permalink) | |
|
Quote:
|
||
|
|
|
|
#10 (permalink) |
|
There is nothing wrong with using the MCLR pin. It is just unusual as it is normally used after all the other pins are allocated. The only thing wrong with the NC switch is that it will use (slightly) more current than a NO but as you have a motor in the circuit the extra amount is insignificant.
Mike. |
|
|
|
|
|
#11 (permalink) | |
|
Quote:
|
||
|
|
|
|
#13 (permalink) |
|
This guy has the best tutorials on PIC's
heres some for the 12F509. http://http://www.gooligum.com.au/tut_baseline.html |
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Title | Starter | Forum | Replies | Latest |
| Needing help with delay times on a 12f509 | Darkstar64 | Micro Controllers | 16 | 13th August 2008 11:59 PM |