microcontroller thread #3

Discussion in 'General Science & Technology' started by cato, Jul 19, 2006.

Thread Status:
Not open for further replies.
  1. MetaKron Registered Senior Member

    Messages:
    5,502
    Put the chip on your choice of breadboard and run your wires from the programmer to the breadboard. You can either wire them to a six pin connector that goes to the header or you can find the right openings in the ZIF socket. One of the links I gave you a while back was to a place that also sold the cable to fit the six pin cable.

    Did they send you the documentation for that programmer?
     
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. cato less hate, more science Registered Senior Member

    Messages:
    2,959
    no, no documentation at all.

    why do I want the MCU out of the programmer? wouldn't it be easier just to run wires to the breadboard? if I want it in the breadboard I still have to buy all the wires for my various pins, but also an extra socket. I don't see the advantage over just running it in the programmer.
     
  4. Google AdSense Guest Advertisement



    to hide all adverts.
  5. MetaKron Registered Senior Member

    Messages:
    5,502
    If you have the MCU on a breadboard, you only have to run five wires from the programmer. You can run the sixth if that programmer has the low voltage programming enable line, but basically you need just five lines from the programmer. If you make it so that you can plug it in and unplug it, that's a convenient way to disengage the programmer. 40 pin sockets cost about a dollar at Radio Shack. If you anticipate moving the MCU a lot, it's better if you can afford to buy a socket with machine-tooled pins that can plug into another socket.

    Part of the problem is that you are going to have a devil of a time getting your MCU to run on the breadboard. MCLR has to be set to five volts during runtime, that's pin 1. If you apply power the programmer is going to want to do something. It's probably going to keep your MCU in some mode other than the one you want. Separating the MCU gets rid of that problem.

    Those breadboards we discussed earlier come with the six pin connector so that it's easy to plug them into the programmer. One of them is made to be a programmer and a breadboard. The others do exactly what I've been talking about, just connect those six lines to the programmer and let the programmer do the work.

    One fancy thing to do is to find a way to let the five volt connection from the programmer switch the MCU on and off so that when it is plugged in the MCU is under the total control of the programmer. One way to do that is with an inverter and a P-type MOSFET. That's getting a little involved. You might be able to do it with an LM324, too, and those are easier to come up with.

    There is a certain amount of overhead involved in this.
     
  6. Google AdSense Guest Advertisement



    to hide all adverts.
  7. cato less hate, more science Registered Senior Member

    Messages:
    2,959
    thats what I thought i was buying =/

    damn, now I have a bunch of shit to do. I have to figure out how to make the crystal, make a power supply... basically put together a whole second board... not what I wanted to do.

    I wanted this to be a summer project, but now it is looking like I wont even be able to do shit with it until winter break! god that pisses me off.

    thanks for being so patient meta, this whole thing has had me pissed off all day. it took me 20 minutes do type this out because I kept getting so pissed off I wanted to put my fist through a wall.

    Please Register or Log in to view the hidden image!

     
    Last edited: Aug 9, 2006
  8. MetaKron Registered Senior Member

    Messages:
    5,502
    Well, you only need a resistor and a capacitor for the oscillator. You need a five volt regulated supply. You can make your breadboard from Radio Shack stuff. Run some wires from the right places on the socket and connect them with alligator clips. You can have this up in a day or two. Just match the pins on the socket to the pins on the chip on the motherboard. Hang some wires on there to clip to.
     
  9. MetaKron Registered Senior Member

    Messages:
    5,502
    I am patient because I know what it's like. I had a hell of a time with that stuff for various reasons. If I can help someone else get it off the ground I'm glad to do so.
     
  10. cato less hate, more science Registered Senior Member

    Messages:
    2,959
    hmm, I can't find anything on google about wiring up a board to run it on. I am not sure what pins go to the ICSP.

    can you point me to some info?

    edit:solved one of my problems
     
    Last edited: Aug 7, 2006
  11. leopold Valued Senior Member

    Messages:
    17,455
    jeez cato calm down man.
    if something this minor gripes your butt then maybe digital design isn't for you.
    wait until you run into race conditions or timing glitches on your flip-flops if you want something to drive you up the wall.

    too bad i have no experience with the particular part you are working on.

    maybe if you can put up some pictures of what you are working on we could help you better.

    to be honest i thought a 'breadboard' was a device with a bunch of holes in it spaced to hold DIP IC's. the pins on a DIP are standard spacing.
     
  12. cato less hate, more science Registered Senior Member

    Messages:
    2,959
    ohh, I am calmed down today =]. I just had a really bad day yesterday =]
     
  13. MetaKron Registered Senior Member

    Messages:
    5,502
    Having to deal with car troubles usually gives me some kind of brain seizure.

    Pin 1 is MCLR, pin 39 is ICSP clock, pin 40 is data I/O for ICSP. 38 is low voltage programming enable, I would run that to the programmer just to be on the safe side. Use the corresponding pins on the ZIF socket. The best thing is #22 wire, preferably solid. You can also do circuit tracing to figure out which pin on the 6 pin connector corresponds to which function.

    11 and 32 are power supply. 12 and 31 are ground. Yes, they are duplicate connections and you can use them in any combination.

    The version of the chip that you are using is quite happy with 2 to 5.5 volts, so you can use a two or three of any common low voltage cells like AA or AAA, or you can use one lithium battery. You don't have to whomp up a power supply for this. As far as I know it also won't hurt the chip to put a 100 ohm resistor between it and the power supply, that's a trick to keep it from melting if it is hooked up wrong, to use during breadboarding. Ignore that last sentence if you want.

    So, basically, run 1,(11 or 32), (12 or 31), 38, 39, and 40 from the breadboard to their corresponding positions on the programmer. I always double-check this kind of information when I do this and I also double-check where pin 1 is.

    Here is the data sheet:

    http://ww1.microchip.com/downloads/en/DeviceDoc/41159d.pdf

    You see, one thing about this is that the programmer isn't using the EUART to communicate with the chip. It is resetting the chip, then setting MCLR, RB6, and RB7 at the appropriate levels at the appropriate times to put the chip into program mode. Then it uses RB6 as the synchronous data clock for both read and write, and RB7 to send data back and forth. Which way the data goes depends on the commands sent, and there is a thing about 64 byte packets and stuff, which is more technical than you have to get, but it's nice to be somewhat aware of what is going on.

    This document is also helpful:

    http://ww1.microchip.com/downloads/en/DeviceDoc/31028a.pdf

    Between them you can see what is going on, but where it refers to "programming specifications" in 31028a.pdf, go to chapter 2 on the 41159d document. It's not the same title, and it caused me a little bit of hair loss to figure that out the first time.

    You can put a 1k or larger resistor, not ridiculously large, between the programmer and the inputs that are not ground and VCC. This protects the programmer from receiving current from the circuit. The circuit may or may not work correctly with the programmer attached but it won't harm the programmer. Those are high impedance inputs. It won't bother them to have a resistor between the programmer and those pins, 1, 38, 39 and 40.

    I looked up the schematic for the K149 at www.kitsrus.com . It does not match the device that you have. Might yours be another one in the series?

    Some Kitsrus notes worth reading:

    http://www.kitsrus.com/icsp.html

    It says don't let the breadboard use power from the programmer. This means you have to do something or remember to do something to keep them separate. Somehow, switch the power going to the chip from the board's power to the programmer's power when you program. I have actually used a tiny switch to do that.

    There is a diagram showing a diode for switching the power supplies. You can get away with using a regular rectifying diode in your case instead of a Schottky, which has a somewhat lower voltage drop. This may make it hard to flash LEDs with just 3 volts for the power supply, but if you use 4.5 you're OK.

    And, you can use a resistor and a capacitor for the oscillator. You do have to set bits in the oscillator control register to do this.
     
  14. Blue_UK Drifting Mind Valued Senior Member

    Messages:
    1,449
    Cato, get yourself a PIC16F627 if you're still at the early stages. This has an internal oscillator that can be used instead of a crystal if you config it properly. You'll need to be comfortable with this range before going into the hardcore stuff unless you really are a genius.

    All the commercial compilers will make code for this device without any constraints (i.e. no $$$ required).

    I recommend Hi-TECH Ansi PICC-C. It's so easy to program with that compiler and integrates perfectly into MPLAB.

    Today I made a key-code device with the 16F627 in HI-TECH 'C'. In HTC, EEPROM access is so easy it hurts.
     
  15. dsdsds Valued Senior Member

    Messages:
    1,678
    I'll repost my comments from the 1st page ...

     
  16. cato less hate, more science Registered Senior Member

    Messages:
    2,959
    it shows you how to make a crystal (or RC oscillator) in the data sheet. I already have MPLAB configured with C18, and I use micropro.exe to load the .hex. I was just having a bad day, and then got pissed that it was going to require more work before I could get it up and running.
     
  17. MetaKron Registered Senior Member

    Messages:
    5,502
    As far as I can tell, it's no big deal to use the one that Cato is using. You have more pins and a faster machine is all. The machine code is pretty much the same. The programmer does all the work of programming the chip.

    The difference between the 16F627 and the 16F628 is only a few cents and the 16F628 has twice as much space for code. Actually, some of the 16F628s are cheaper. If you go to Mouser, unfortunately they list most of their MCUs as having KBytes where they have just plain bytes.

    Cato's chip can work with just a resistor and capacitor for timing, so that's no big deal either.
     
  18. Blue_UK Drifting Mind Valued Senior Member

    Messages:
    1,449
    he's using a 628? Ah didn't read that. Thought he might be tempted to try and use higher ranges all together.
     
  19. MetaKron Registered Senior Member

    Messages:
    5,502
    No, Cato's using an 18LF458. It has 40 pins instead of 18 and a lot more SRAM and flash memory. Still, it works just the same as the 16F628 or 16F84A, only more so.

    The chip is between five and six dollars in single quantities. It gives you the possibility of emulating, roughly, an old TRS-80 Model 4 except this works better and you have a lot more options.

    I might go back to a 16xxx series Microchip type because I'm more familiar with it, but AVR has an ATTiny chip for just over $2 that has symmetrical PWM outputs, non-overlapping and programmable, which is exactly what I need. I have ten of them in SMT but I don't know that I want to screw with making the circuit boards right now.

    Cato is already used to using higher range chips like the 68HC11. It doesn't take a higher level genius for that either, and I wish I had got one and learned it myself.
     
  20. cato less hate, more science Registered Senior Member

    Messages:
    2,959
    why not? =].

    it was not that expensive to get started. I am, so far, at about $50. thats not too much, and almost all of that is the programmer. you can find them cheaper, I just wanted one with USB. the chip itself is only like $5. if it happens that you get stuck on something, I will be working in parallel.

    p.s. I found a new car, so I wont be so stressed in the future.
    97 Honda accord, in really nice shape.
     
  21. MetaKron Registered Senior Member

    Messages:
    5,502
    I'm looking at doing something like that, but I have a couple of different directions to go, Cato. It is indeed just another $5. I can do that.

    One item I need is a microcontroller-based controller for a battery charger that can be slipped inside a power tool or cordless phone. There is no model of any such item using a Nicad or NiMH battery that turns off the charge current when the battery is charged. A 12F675 (LF version) has a 10 bit A/D converter. It is an 8 pin chip, and comes from Mouser in versions down to ridiculouly small. It will probably work for this application even using the regular size. This will tremendously extend the usable lifespan of batteries in rechargable tools and cordless (not cell) phones. It will also make it unnecessary to worry about taking them off the charger to avoid overheating.

    The other application which I have needed for a while uses the ATTiny26's pair of PWM outputs. I've needed that since time immemorial. I have a very specific project for that.

    I will be using a serial or parallel programmer, home-brewed. Actually I don't know why I bought the serial connectors at Radio Shack. I would rather wire it to the parallel port. It doesn't make a lot of difference.
     
  22. cato less hate, more science Registered Senior Member

    Messages:
    2,959
    so, I started putting together a wd of my pic. let me know if I messed something up.

    also, I am not sure what values of the RC oscilator to get. I will continue looking for info tomorrow, I am done tonight. if you can point me to values, that would be great.

    Please Register or Log in to view the hidden image!



    Please Register or Log in to view the hidden image!

     
  23. MetaKron Registered Senior Member

    Messages:
    5,502
    It's section 2.3 of the documentation. They don't tell you what the frequency is going to be. They want the resistor to be between 3k and 100k and the capacitor to be at least 20 pF.

    Take the R*C figure as a ballpark. That's still going to be wide of the mark but it will get you closer.
     
Thread Status:
Not open for further replies.

Share This Page