![]() | ![]() | ![]() |
| |||||||
| Electronic Projects Design/Ideas/Reviews Are you building an electronic project or want to? Maybe you need some assistance? Come and submit your electronic questions here and let our experienced members find a solution. |
![]() |
| | Tools |
| | #16 |
|
I've no idea why you insist on using a pic. If you had a look at the circuit I posted above, you'd see that your task is very simple using a single 555. Anyway, for a pic12F508, the following code should work. Use MPASM to assemble. Code: #include "p12f508.inc" __CONFIG _MCLRE_OFF & _WDT_OFF &_IntRC_OSC radix dec inpin equ 0 outpin equ 1 sec90 equ 10 cnta equ 11 cntb equ 12 cntc equ 13 org 0 start: movlw 0 option movlw 255-(1<<outpin) tris GPIO main: btfsc GPIO,inpin ; wait for inpin low goto main call delay btfsc GPIO,inpin ; make sure inpin is actually low goto main waitloop90: bsf GPIO,outpin ; output high call delay incf sec90 ; 1 second has passed btfss GPIO,inpin clrf sec90 ; reset count if inpin is still low movfw sec90 ; test for 90 seconds past xorwf 90 btfss STATUS,Z ; quit after 90 seconds goto waitloop90 ; otherwise keep going bcf GPIO,outpin ; reset output goto main ; delay for a second delay: movlw 6 movwf cntc dloop0: movlw 216 movwf cntb dloop1: clrf cnta dloop2: decfsz cnta goto dloop2 decfsz cntb goto dloop1 decfsz cntc goto dloop0 retlw 0 END Last edited by dougy83; 8th July 2009 at 01:45 AM. | |
| |
| | #17 |
|
all the trees are in the way KEEP IT SIMPLE! use the 555/556 circuit I posted It works in multisim so it should? work for your app. BUT learn something BREAD BOARD the circuit then discover how and why it works. Your opening yourself up for failure by getting the simple task to complex. | |
| |
| | #18 |
|
I use PICs to improve my programming "skills". The more i work with them, the more macros or canned programs i collect. I only suggest one way to solve the problem. A 555 is a good simple way to solve the problem. There are other ways depending on what parts you have on hand. Enjoy the challange! Larry | |
| |
|
| Tags |
| circuit, hold, input, pic, relay, removed |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| What would be the minumum PWM frequency to hold a relay? | blueroomelectronics | Electronic Projects Design/Ideas/Reviews | 22 | 15th February 2008 11:41 PM |
| Unreferenced function removed | MizuRyuu | Micro Controllers | 4 | 24th July 2007 08:32 PM |
| Need for sample and hold circuit | microcare | General Electronics Chat | 5 | 24th July 2007 05:41 PM |
| Evil Genius Forum Removed | ElectroMaster | Feedback/Comments | 5 | 7th June 2005 01:17 AM |
| Problem on telephon hold circuit..... | smorteza | Electronic Projects Design/Ideas/Reviews | 3 | 14th March 2004 03:22 AM |