Maker Pro
Maker Pro

8-Pin Development Board

hevans1944

Hop - AC8NS
Jun 21, 2012
4,878
Joined
Jun 21, 2012
Messages
4,878
Hi Hop, thanks for the detailed reply. I am sorry to say that it escapes me a bit. I looked over the relevant sections that you pointed out, page 45 of the pic12f675 datasheet as well as the referenced section in the IDE users manual and I am just not getting it. ...
The 14-bit CONFIGURATION word at location 0x2007, described on page on 54 does not enable or disable the analog-to-digital converter or the analog comparator. Nor can you read or write to it with instructions in your program: it's address is out of the range that program memory can address. However, the MPLAB X software can read and write to the CONFIGURATION word after it builds and downloads your program.

When the PIC is erased, prior to downloading a program, all the bits in the CONFIGUATION word are set to "1". The __CONFIG directive tells the assembler which bits you want cleared to "0". To make it unnecessary for you to read the information on page 54 and code your own 14-bit pattern of bits, the configuration options are coded as symbols in pic12f675.inc and you just pick the ones you want to change from the default. Each of the options has a value, and this value is logically ANDed with all the other values in the __CONFIG string to create the 14-bit word that is written by MPLAB X to location 0x2007. That is why you need the #include pic12f675.inc statement at the beginning of your program. Actually, I think the #include and __CONFIG statements can go anywhere because the assembler builds its symbol table on the first pass through your code. But why make things difficult for the computer and hard to read for the human?

... I can share with you what I have included in my asm file:

__CONFIG _CP_OFF & _CPD_OFF & _BODEN_OFF & _MCLRE_ON & _WDT_OFF & _PWRTE_ON & _INTRC_OSC_NOCLKOUT

I set these directly through MPLAB's config menu which is buried and hard to find, but very useful.

The entire __CONFIG statement can be inserted as a line in your assembly source file. No need to find a "buried and hard to find" MPLAB config menu. MPLAB X will take care of setting/clearing the CONFIG bits when your program is built and downloaded. The symbols (macros actually, according to Microchip) in the string above are defined in the pic12f675.inc file. The #include assembler directive should be the first line in your program (after any comments you want to throw in ahead of it) followed by the __CONFIG directive. It is not necessary to include all the bits in the __CONFIG directive, only the ones you want to change from their default "1" state to the "0" state or, in the case of the 3-bit FOSC bits, if you want something other than the default "111" state for those bits.

In your case, you have selected INTRC_OSC_NOCLKOUT which resolves to "100" for those three bits, which means use the internal 4 Mhz oscillator but suppress the "clock out" signal on GP4 and don't use the "clock in" signal on GP5, thus freeing those two pins for use as general purpose digital I/O or analog inputs. What those two pins become depends on bits you set or clear in program-accessible control registers that I described in an earlier post. Apparently their use can be changed "on the fly" by your program, but that sounds much more complicated and more difficult to interface to external circuitry. I wouldn't go there just yet.

Your __CONFIG statement looks okay. The important things are you have MCLR enabled on GP3, meaning you can't use GP3 for anything else except to reset the PIC; and the watchdog timer is turned off, meaning no un-expected resets from the watchdog timing-out will occur.

Leaving code protection and data protection off is a good idea IMO, but unless you read and subsequently save and restore the oscillator calibration bits stored by the factory in the last location of program memory, that location and all other locations in program memory will be erased when you program the chip. In other words, the program memory will be erased and then your program will be downloaded on top of the erased memory locations. If your program doesn't specifically code for a particular program memory location, that location will remain erased after your program is downloaded.

I don't know how to automagically save and restore the oscillator calibration byte, other than to use MPLAB X IDE to manually read the last location in PIC program memory before it is programmed and write down on paper the oscillator calibration byte, which Microchip has stored as the instruction MVLW 0xzz, where 0xzz is the calibration byte (expressed in hex). In my program, I org 0x1ff, where 0x1ff is the last address in program memory, and then I code MVLW 0xzz as the instruction there, effectively restoring what the factory programmed there and that MPLAB X IDE erased before it downloaded my program. In your case, the last instruction in program memory is at address 0x3ff as shown on page 9 of your datasheet.

If anyone knows how to preserve the factory-coded oscillator calibrate literal move instruction, I would sure like to know about it. Remember, I am a rank amateur at this.
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
but unless you read and subsequently save and restore the oscillator calibration bits stored by the factory in the last location of program memory, that location and all other locations in program memory will be erased when you program the chip.
Hi Hop, I returned here because I wasted a day on a breadboard that turned out to have an internal break between rows....... I had a LED that was blinking when it was supposed to be solid on!! :eek::mad: talk about frustrating. Apparently half of the breadboard is intact, that is where the 4017 resides currently. I ordered more breadboards needless to say! Obviously my thoughts returned to that development board I seemed to remember building some time ago. I think it's time for a revision and a working version so that I do not have to rely solely on a breadboard!

To your question above, apparently with Microchip tools, the osc. value is saved. See this forum, fourth post down. I have also seen it referenced somewhere else on Microchip's forum, but couldn't find the link.
 

hevans1944

Hop - AC8NS
Jun 21, 2012
4,878
Joined
Jun 21, 2012
Messages
4,878
Thanks for the link. Yes, I seem to remember reading somewhere that all is good if you use the MPLAB environment, which I do, to program your PICs. But just to be sure I always read that oscillator byte at the last program address, using the PICkit 3, whenever I use a new chip. Then I write the value stored there into my code to make sure it gets initialized properly. It is relatively easy to determine the calibration value yourself if you have a precision method of measuring the clock frequency. The calibration value is just a ± tweak of the nominal clock frequency. You can measure and tweak the value yourself.

BTW. I can't believe it has been almost a year since I last bread-boarded and programmed a PIC! When the flashlight project died, my wife made me clear off her sewing table and box up all my goodies. There they sit, awaiting me to finish clearing off the electronics workbench in the basement. I might be living in Florida before that happens. <sigh>

Hop
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
I might be living in Florida before that happens.
Dust it off, I might need your assistance before that happens ;)

I saw someone was using an interesting method of marking with nail polish the package above the pins in binary for the code, the first 4 pins represent the first number and the last 4 pins represent the second number in hex IIRC. Rather simple solution, of course now we have more advanced software that takes care of all that.

I am looking at Eagle and revising this schematic to fix my misunderstanding of the MCLR pin and its multiplexed use. I am tying it to a pull up resistor with a small cap to debounce (probably not necessary) and I intend to put a jumper at the junction of the pic pin, end of resistor and gnd - that way if the program calls for using that pin, I can clear the MCLR bit and use a jumper to pull out that pins functionality.
 
Last edited:

hevans1944

Hop - AC8NS
Jun 21, 2012
4,878
Joined
Jun 21, 2012
Messages
4,878
If you remake this board, can you send me one... with the holes already drilled? I found my Dremel drill-press stand, but NONE of my Dremel tools fit it! I won't risk breaking those spiffy carbide drill bits I got from China by not using a drill press. Maybe I can figure out a way to make one of my Dremel tools fit it by removing pieces and securing the Dremel tool with large hose clamps... The drill-press stand is a piece of junk, but the work is raised and lowered under the fixed-in-place Dremel tool, so if the Dremel tool is good (no run-out at the chuck) it should do the job. The drill bits I bought have 1/8" shanks so they fit perfectly in the collet head of the Dremel tool. I also have a 3-jaw chuck for use with small numbered twist drills, but these are useless for drilling circuit boards. One pass and they are dulled.

I think I have the free version of Eagle on one of my computers... maybe I can give it a try for drawing schematics... real soon now. :D

You should probably fix the potentiometer circuit too. IIRC it is wired as a rheostat instead of as a potentiometer. Are you sure that is what you want? Also, I use both 270 degree rotation pots (with and without a shaft) as well as multi-turn trim pots. Never had a problem figuring out which end the wiper was on. :cool:

Never saw a need to de-bounce the active-low MCLR pin. Who cares how many times it resets because of switch bounce?
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
If you remake this board, can you send me one... with the holes already drilled?
Sure, making two is as easy as one ;) - I think though, I will need a thorough review before I commit to making them - two heads are better than one!

Maybe I can figure out a way to make one of my Dremel tools fit it by removing pieces and securing the Dremel tool with large hose clamps
Misread that - yeah, that should work out!! Just have to make sure it stays perpendicular to the travel of the quill.

I think I have the free version of Eagle on one of my computers... maybe I can give it a try for drawing schematics... real soon now. :D
They just updated it according to a pop up I received today - I didn't update it, but there was some talk about better parts libraries!!!

You should probably fix the potentiometer circuit too.
Thank you - I was just looking at that and for the life of me couldn't figure out what I was trying to accomplish originally - botched it.., meh, learning!

Never had a problem figuring out which end the wiper was on. :cool:
LOL, that's what multimeter's are for, no :rolleyes::D:p
 

hevans1944

Hop - AC8NS
Jun 21, 2012
4,878
Joined
Jun 21, 2012
Messages
4,878
Well, with a year more of experience in your bag, please post a revised schematic and I will look it over. Probably want to post a revised circuit board, bottom and top views with the top "silk screened" using your toner transfer technique.

Hey! I just realized that I have an ancient copy machine in the basement that uses a laser toner cartridge. Probably not useful now, but if I shake it up and maybe dry it in the oven on really low heat I won't have to spend big bux for a new toner cartridge... if they are even still available. I will have to check on that. Haven't fired that puppy up in years, but I am gonna bet I can get it working before my HP Laser Printer... although there is a place here in town that I could take the printer in for repairs. A few hundred bucks might be worth it to have a real laser printer instead of an ink squirter.

Anyway, I could print artwork on the HP inkjet printer and copy it to toner transfer paper using the copy machine. Voila! Toner on paper to iron on and transfer to a circuit board prior to etching. Might have to do some experimenting to get the copy sized correctly, i.e., adjust the image size on the inkjet printer, but I think that would work. Now all I need is some thin catalog pages printed on slick paper for toner transfer... surely this stuff is available for sale now? I will investigate, remembering your advice to layer the toner transfer paper by taping the leading edge to regular paper stock. Fortunately, my copy machine allows me to hand-feed paper. More on this later! I am so excited! Why didn't I think of this before? And do I still have any ferric chloride stashed away? Never mind, I think the local Radio Shack store still has some on the shelf for sale at an exorbitant price. Or I could order a pint or two.

Hop
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
Well, with a year more of experience in your bag, please post a revised schematic and I will look it over. Probably want to post a revised circuit board, bottom and top views with the top "silk screened" using your toner transfer technique.
I am nearly finished - I don't know if that year can be considered as experiential or not... too much theory, LOL. Yes, I agree, too easy to mess up the board with not catching the 'mirror' ;-)

A few hundred bucks might be worth it to have a real laser printer instead of an ink squirter.
Jeez, if you have a few hundred to toss, you can get yourself a brand spanking new one! Only caveat, the older beastie might have a better resolution? Some of the old office sized units had really capable resolutions!!
LOL @ink squirter :D:D

I will investigate, remembering your advice to layer the toner transfer paper by taping the leading edge to regular paper stock
Do this cautiously, some folks have had problems where their tape gets on the drum! Do you have any kapton tape?

Now all I need is some thin catalog pages printed on slick paper for toner transfer... surely this stuff is available for sale now?
I have used some of this stuff and it works pretty good, I think its dextran coated. As for thin slick paper, sometimes the catalog paper that is not that glossy looking works really well. Trial and error. Steaming the paper off seemed to be the best - i.e. after transferring the image, spray the board with soapy water from a spray bottle and hitting it with the iron to 'lift' the paper. I will tell you this though, if you do it too much (water gets under the paper for too long) you will start to oxidize the copper surface in spots. But sometimes it works so well, the paper just washes off!!

Never mind, I think the local Radio Shack store still has some on the shelf for sale at an exorbitant price. Or I could order a pint or two.
They still exist in your neck of the woods?! :eek: With true electronics parts needs?!! LOL Pint? How's a liter for $15?
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
upload_2016-5-26_0-28-27.png

Values have not been calculated, i.e. - in/output caps of v.regulator are arbitrary minimums,etc.
The purpose of JP1 is to provide a convenient way to access any of the PIC's pins, jumpers 3-8 are actually two pin blocks that a shorting pin fits over (like the ones for hard drive jumpers). This allows the user to isolate the peripherals from the pic if they want to breakout the pic for other purposes. As shown, there are three simple digital i/o's setups with LED indicators, one potentiometer setup for ADC and two momentary push button switches. One of the tactile switches is used for MCLR, the other is used as an input. The pic is a 12F675, but this board should work for other 8 pin pic's that have pins 1 and 8 as the power pins since the rest are broken out via jumper 1.

Look it over and let me know what errors you spot. I will work on board layout tomorrow. Thanks again for your help!
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
Transferring your comment from the other thread:
I did review it, and thought I had left a reply on this thread, but it's not there. Schematic looks good except some components are labeled twice (capacitors) and some are not labeled at all (resistors). Not sure why you would want to place capacitors across the resistors in series with the two push-button switches. MCLR doesn't need it. Other switch can be (should be) de-bounced in software. Want to re-post the latest schematic in this thread?

I will try to tidy that up, they are actually for each respective cap which are physically stacked, but its a bit messy. The cap across the resistor was what I used on the breadboard to debounce a switch. I was using this since I had seen it to work in practice. Interestingly enough, there is much debate about PIC's MCLR pin's needing or not needing a RC network. Skipping the various opinions on the forums, I found this information from the datasheet:
<<
PIC12F629/675 devices have a noise filter in the
MCLR Reset path. The filter will detect and ignore
small pulses.
>>
So that is good news, but:
<<
The behavior of the ESD protection on the MCLR pin
has been altered from previous devices of this family.
Voltages applied to the pin that exceed its specification
can result in both MCLR Resets and excessive current
beyond the device specification during the ESD event.
For this reason, Microchip recommends that the MCLR
pin no longer be tied directly to VDD. The use of an RC
network, as shown in Figure 9-5, is suggested.
>>

upload_2016-5-30_9-37-47.png

So this varies a bit from what I found for debouncing a switch, but the manufacturer recommends at least a 1k Ω resistor in series with Vdd to MCLR. I assume, the optional capacitor is there to provide backup current for small dips in Vdd. Too large a value here and MCLR may not operate properly as the RC network's lag time would rise!! (Hey, I got this ;-)

Ok, I will revise my board layout, in the mean time, here is where I got to before revision. I decided to split the 8 port jumper into two 4 ports to make layout easier, with less routing around pins.

boarda.png
 

hevans1944

Hop - AC8NS
Jun 21, 2012
4,878
Joined
Jun 21, 2012
Messages
4,878
Man, that blue on black with the green and white overlays makes my head spin! Good thing you didn't throw some yellow in there or I would have gone blind! Maybe you should attach your Eagle file to an e-mail and I will try to fire up my copy of Eagle to look at it. That way I can toggle layers on and off for easier viewing. For example, I tried to follow the trace for S3 (MCLR) which is supposed to go to IC1-4 through jumper block JP3, but it looks like it goes to JP4 with a stop along the way at one end of R2 (not labeled on schematic).

Another thing I noticed is this is a single-sided board with traces only on the side opposite the component-mounting side... yet you have used no permanent jumper wires to make the layout simpler. I often used jumper wires on the component side (sometimes insulated, sometimes not if they were short) to avoid routing traces from Chicago to Detroit via Alaska. This may have been easier to do with taped artwork because it was simple to rip up traces and relocate them, but IIRC the one circuit board I made that wasn't taped artwork but was designed with PADS circa 1992, used a double-sided board with plated-thru holes... and still "needed" one or two jumpers to make the layout easier. Most of my single-sided boards from the 1960s and 1970s had many jumpers to simplify the routing of traces. At first I thought this was "cheating" and spent hours re-routing traces to avoid jumpers. Then I looked at some commercial single-sided PCBs and noted they used jumpers liberally. So, lesson learned: whenever it would prevent routing a trace over a convoluted path I would use a jumper on the component side to take a "short cut" from source to destination. You should investigate this technique too.

There are many other "tricks, traps, and techniques" associated with PCB layout and I don't remember them all, nor have any desire to do so. If I need a really complicated PCB manufactured, I would use someone else to do the layout... someone who does this every day for a living. Unfortunately those people are becoming hard to find at reasonable cost. Thank goodness for Eagle, so it is no longer strictly necessary to hire an "expert" if a person has the patience to learn.

Umm... one "trick" I learned early on but seldom use is to mount axial leaded components (like resistors) perpendicular to the board, bending the lead on the outside down next to the component to solder adjacent to the first lead. I remember a particular Japanese transistor radio I still have that used the technique to advantage to cram a few dozen components in the space you or I would fill with only one or two. Downside is it makes the routing of traces much harder, even if you do double-sided traces. The vertical mounting technique means you can't generally route traces under the component because there is no "under" anymore. <sigh> Maybe that's why I seldom use it.

I missed the Microchip note on not tying MCLR directly to Vcc, but I always tie it to Vcc through a resistor anyway, just in case I want to add an external reset switch. The capacitor from MCLR to ground will help eliminate noise spikes that could result in an erroneous reset, so better safe than sorry I suppose, but I wouldn't bother.

Hop
 
Last edited:

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
Maybe you should attach your Eagle file to an e-mail and I will try to fire up my copy of Eagle to look at it.
Sure :) - Sent. Way easier than seeing the schematic, agreed! When you have the ability to zoom in, it becomes way easier to follow along.
At first I thought this was "cheating" and spent hours re-routing traces to avoid jumpers.
LOL, I too thought it was poor sport to not at least try to get 100% rat's nest resolution. It took 5 iterations using the autorouter to come to this version. Basically toss the parts on in a somewhat logical fashion and then run autorouter to see what it comes up with and then move components judiciously to jump over traces, etc and repeat. I can start fresh and use vias with a trace on the top layer to simulate my jumper wires, but if there is no interference from anything, I would rather not waste too much time there. Maybe for academic reasons... (can't resist, LOL)
The capacitor from MCLR to ground will help eliminate noise spikes that could result in an erroneous reset, so better safe than sorry I suppose, but I wouldn't bother.
Microchip shows it as optional so if its hard to fit into the circuit board I can omit, no real cost difference and might be useful when I play with relays.
 

hevans1944

Hop - AC8NS
Jun 21, 2012
4,878
Joined
Jun 21, 2012
Messages
4,878
Received your three files and tried to open them in LTSpice. Got a message saying the "magic number" was wrong. Took me awhile to realize these were Eagle files, not LTSpice... a senior moment there. Took even longer to download the latest (7.6.0) 30-day trial version of Eagle, which was 56.3 MB on a 20 Mb per second connection, but I now have a working copy on the lap-top, good until July 2, 2016. I wonder if that is enough time to learn how to use Eagle?

And, yes, your board is much easier to see now. The schematic, not so much, but I like the mouse-wheel zoom feature. I found one place on the board where you could stick two vias and a jumper to eliminate the winding path from S3 to the microprocessor. Could possibly do even better with two sides and plated-through holes, but maybe you should leave that "improvement" for the next iteration since this version is for do-it-yourself rather than manufactured boards... and only two at that.

Yeah, relays and the loads they switch can wreak havoc on a microprocessor without careful attention to power supply by-passing and routing of load returns. You will learn with experience what works and what you should avoid. The oscilloscope is useful for this. I try to keep as separate entities logic supplies and load supplies carrying large transient currents, connecting their commons together at one well-defined point.
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
Received your three files and tried to open them in LTSpice. Got a message saying the "magic number" was wrong. Took me awhile to realize these were Eagle files, not LTSpice... a senior moment there. Took even longer to download the latest (7.6.0) 30-day trial version of Eagle, which was 56.3 MB on a 20 Mb per second connection, but I now have a working copy on the lap-top, good until July 2, 2016. I wonder if that is enough time to learn how to use Eagle?
I think the trial just reverts to a free status at the end with just the free content functionality - i.e. less than 300 nets or something of that nature. I have never run up against the limit, so I am unsure of the exact number.

The schematic, not so much
Yes, sorry about that, I kinda had to hack that apart to make way for the 2x 4 pin connector instead of 1x8 - it allowed more freedom on the board to route traces.

Yeah, relays and the loads they switch can wreak havoc on a microprocessor without careful attention to power supply by-passing and routing of load returns
Indeed, check out this circuit.

Off to etch, perfection can wait ;-)
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
I am soooo envious!
Don't be.... your's is in the picture too :p :D
There will be another thread about the green tint you see everywhere...

20160531_150246_zpsxhxvommp.jpg
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
Thanks Hop! Since the solder mask didn't work out (I had to sand it off!), I figured I should tin them instead :D:p
I only managed to get your's drilled today, I'll drill mine tomorrow while I wait for your silkscreen to dry.
Do you need any components?
 

hevans1944

Hop - AC8NS
Jun 21, 2012
4,878
Joined
Jun 21, 2012
Messages
4,878
Do you need any components?
Probably not. I have a good assortment of resistors and capacitors, and I think a few tactile push-button switches and some 8-pin IC DIP sockets. No surface-mount devices yet. I am going to see what kind of capacitor and resistor assortments are inexpensively available from China. No hurry on that until I learn to use EAGLE to layout my own boards, and perhaps manufacture them at home instead of using a PCB manufacturer.

How are you going to apply silk-screen legends to your board? Traditional way is to prepare the silk-screen photo-lithographically and squeegee the paint through the silk screen. I don't know how they photo-sensitize the silk screen, which IIRC is mounted in a frame to stretch and tension it. Maybe use the same photo-resist used to prepare boards for etching? I don't know enough about it now to even ask intelligent questions.
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
I am going to see what kind of capacitor and resistor assortments are inexpensively available from China
I have had this on my buy list for some time, but have skipped it since I have no decent way of storing all these little parts yet. I had seen a container system, if I find the link, I will edit and post it. It's a bit pricier than I would like - at that point probably better to order the caps/resistors in a binder format that is available on e-bay!

I use the term silkscreen loosely, as that is what Eagle calls the layer as well. Same method as before, toner transfer using dextran coated paper. As you can see in the photo, there was a shower of dust... hopefully the urethane was tack free enough that this will just wipe off. I should be able to mail yours out tomorrow if the urethane is ready :D
20160601_105611_zps0q5cy7ng.jpg
 
Top