PDA

View Full Version : 16f628 for all outputs



Max_Gauss
- 14th May 2007, 20:25
I have tried about everything i know to get a 16f628 to blink my led. But to no avail. Is there some special config i need to set to have this action take place? I am just applying power, using the internal osc. set my comparator mode to 7. is there something else i should be doing?

skimask
- 14th May 2007, 21:13
I have tried about everything i know to get a 16f628 to blink my led. But to no avail. Is there some special config i need to set to have this action take place? I am just applying power, using the internal osc. set my comparator mode to 7. is there something else i should be doing?

Are you using the PIC16F628 or the PIC16F628A?
There's enough of a difference between the two to keep things from working.
And post some code, a schematic, something, anything.
For all I know you've got 3 buckets of grass clippings, 2 rocks, and a jar of mustard.

Pic_User
- 15th May 2007, 02:13
Are you using the PIC16F628 or the PIC16F628A?
There's enough of a difference between the two to keep things from working.
And post some code, a schematic, something, anything.
For all I know you've got 3 buckets of grass clippings, 2 rocks, and a jar of mustard.

Hi skimask,
Here is a circuit attachment I found online you might find helpful.
http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1629&stc=1&d=1179191077

hth
-Adam-

mister_e
- 15th May 2007, 02:39
<table><td><img SRC="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1629&stc=1&d=1179191077"></td>
<td> Jar of mustard = +5V
RCK 1, RCK 2 = Gnd
GCB1, GCB2, GCB3 = LED + 330 OHM Resistor
PIC16F84 = something that should be removed from the market since 10 years, can happilly be replace by a 16F628. If you do it, remove the crystal + both 22pF capacitor and try the code bellow</td></table>

<font color="#000000"> <font color="#008000">'
' Pic Configuration
' =================
'
' Here we will set the PIC configuration fuses
' to use the internal PIC oscillator and disable the MCLR
' pin.
</font>@ __CONFIG _INTRC_OSC_NOCLKOUT &amp; _MCLRE_OFF &amp; _LVP_OFF &amp; _WDT_OFF &amp; _PWRTE_ON &amp; _BODEN_ON
<font color="#008000">'
' This assume you're using MPASM to compile your code
' For detailed information about Configuration fuse setting,
' have a look to &quot;Presetting Configuration Fuses (PIC Defines)&quot; thread
' in the forum FAQ section.
' http://www.picbasic.co.uk/forum/showthread.php?t=543

'
' Hardware assignment
' ===================
</font>GCB_1 <font color="#000080">VAR </font>PORTB.0
GCB_2 <font color="#000080">VAR </font>PORTB.1
GCB_3 <font color="#000080">VAR </font>PORTB.2

<font color="#008000">'
' Hardware configuration
' ======================
</font>TRISB = 0 <font color="#008000">' Configure all PORTB i/o to output

'
' Software/Hardware initialisation
' ================================
</font>PORTB = 0

<font color="#008000">'------------------------------&lt; Main program &gt;-----------------------------------
'
</font>Start: <font color="#008000">'
' Here will do the 'buckets of grass clippings' light show
' using a simple method... not the best
'
</font>GCB_1 = 1
<font color="#000080">PAUSE </font>500
GCB_2 = 1
<font color="#000080">PAUSE </font>500
GCB_3 = 1
<font color="#000080">PAUSE </font>500
GCB_1 = 0
<font color="#000080">PAUSE </font>500
GCB_2 = 0
<font color="#000080">PAUSE </font>500
GCB_3 = 0
<font color="#000080">PAUSE </font>500
<font color="#000080">GOTO </font>Start
<font color="#008000">'
'---------------------------------------------------------------------------------
</font>

skimask
- 15th May 2007, 04:34
Hi skimask,
Here is a circuit attachment I found online you might find helpful.

hth
-Adam-

Good answer! :D
Oh Man! I near fell outta my chair! :D

Max_Gauss
- 18th May 2007, 13:27
Thanks be to you all and my Lord Jesus..
Each one of you have help me and i do so appreciate it. My 628 is now operable, and it is so wonderful.
This was my problem.
I was initially programming the 16f84 using MPLAB Assem. with PicStart Plus with upgrade. Then i bought PBP, which is so nice, and i changed to the 16f628. then using MIcroCode Studio i wrote a very simple piece to blink my LED. BUT .. NO blink.. I tried the 16f84.. NO blink.. WOW whats wrong. I tried 45 or 55 times .. NO. blink. I peruse to manuals. I went on internet. I called PBP, You've got to love them for they put up with such as i am. I joined this forum. I wrote the code in MicroCode Studio then selected "compile/Program". It would compile, then started up my MPLAB and leave me in the MPLAB screen. I would select my file. Set my config bits, and select my programmer, then program. There were NO errors, no issues. Also..NO blink. What it programmed into the chip, I have no idea. but it did programm and verify with no errors. What i did WRONG. When PBP brought up my MPLAB and I set my config bits, and selected my programmer.. I DID NOT compile my project in MPLAB.When PBP sends you to MPLAB, YOU have to compile the project. If you do not compile, it will programme something i know not what to the chip, but it will not work.. NOW my LED blinks.. Praise the Lord and thanks to you gentlemen soo much..
jlittle