Mister-E - No harm done! Thanks for the quick response! I will give it a try tonight and we'll see what happens.
Atom058
Mister-E - No harm done! Thanks for the quick response! I will give it a try tonight and we'll see what happens.
Atom058
I was trying to program a PIC12F675 to work with this dimmer design and I am obviously missing something. I copied the code from the Dimmer example and it was not working so I moved to a breadboard to do some testing. I can not even make an output on these PIC's go high! I know I am missing something but I can't imagine what it is! Here is the code - as simple as it is:
@ DEVICE INTRC_OSC_NOCLKOUT & WDT_ON & MCLR_OFF & PWRT_ON & BOD_ON
PAUSE 500
CMCON=7 ' Disable analog comparator
ANSEL=0 ' Disable analog converter
TRISIO = %11111111
TRISIO.0 = 0
TRISIO.1 = 0
TRISIO.2 = 0
TRISIO.3 = 0
TRISIO.4 = 0
HIGH GPIO.0
HIGH GPIO.1
HIGH GPIO.2
HIGH GPIO.3
HIGH GPIO.4
Start:
GOTO Start
END
Now, correct me if I am wrong, but I should be able to measure 5V at each of the 5 outputs above. I get nothing. I have tried several PICs and get the same results. I've written hundreds of programs for different PICs and this one has beaten me. I know the solution is unbelieveabley simple, but GEEZ!
Originally Posted by Atom058
Hi Atom,
First thing, try these instead of the line above.
These should fix your problem.Code:@ DEVICE pic12F675, INTRC_OSC_NOCLKOUT @ DEVICE pic12F675, WDT_ON @ DEVICE pic12F675, PWRT_ON @ DEVICE pic12F675, MCLR_OFF @ DEVICE pic12F675, BOD_ON @ DEVICE pic12F675, CPD_OFF @ DEVICE pic12F675, PROTECT_OFF
Second thing, GP3 is an input-only pin. Never goes high.
----------------------
Last edited by sayzer; - 12th October 2006 at 03:38.
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Your @ device line is faulty...
If you'e using PM to compile your code you must use something like
With MPASMCode:@ device pic12F675, intrc_osc_noclkout, wdt_on, mclr_off, protect_off
OUPS! SAYZER WHY YOU REPLYED AT THE SAME TIMECode:@ __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _CP_OFF
i know this one is familiar to you![]()
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Hi Steve,
As you well know, it took about a month for me to figure out that this line does not work:
@ device intrc_osc_noclkout, wdt_on, mclr_off, protect_off
It should be either like
@ device pic12F675, intrc_osc_noclkout, wdt_on, mclr_off, protect_off
or
like
@ DEVICE pic12F675, INTRC_OSC_NOCLKOUT
@ DEVICE pic12F675, WDT_ON
@ DEVICE pic12F675, PWRT_ON
@ DEVICE pic12F675, MCLR_OFF
@ DEVICE pic12F675, BOD_ON
@ DEVICE pic12F675, CPD_OFF
@ DEVICE pic12F675, PROTECT_OFF
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Thanks guys! I knew I would be embarrased by the solution and I was right!
OK, Now I have made the circuit change and have made the switch changes. I get the 5V outputs on pins GPIO.0 and .1 which go low when I press the up or down buttons. I do not, however, get any output from GPIO.2 which is the triac trigger. My guess is that the problem lies in the ACDetect routine. I see in previous posts that there were many references to this routine and it went through several revisions. Can someone verify that I have the correct routine?
I have attached the code as a text file and the circuit design as a pdf. Would appreciate comments.
Thanks again! Atom058
Hello again - Did I stump everyone? Surely someone has a comment...
Would really like to get this working!
Thanks in advance! Atom058
You have the right version.
It's suppose to work unless you have some hardware issue OR device prograemmer issue.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks