|
|
View Full Version : microcontroller thread #3
hey everyone,
does anyone know anything about caller ID LCD displays? I was thinking of trying to control one with my pic18.
thanks,
Cato
the microcontroller knowledge on sciforums seems to be lacking.
kazakhan 07-19-06, 08:36 PM Electro-Tech (http://www.electro-tech-online.com/) would be a better place to ask...
superluminal 07-19-06, 08:43 PM the microcontroller knowledge on sciforums seems to be lacking.
Hi cato.
I think the information you are asking about is a little too specific. I've been designing with microcontrollers for 20+ years now. HC05, HC11, 8051 (and a million derivatives) ColdFire, Various ARM core devices... along with LCD displays, imaging devices, and a thousand other peripheral devices. But I have no idea about "Caller ID LCD's". Look at the specs for it and you can probably tell if you have enough of the right kind of I/O to control it. If you don't have the specs, then buy a cheap LCD (with a data sheet) that you know will work with the PIC18 and you'll have a lot more fun. IMHO.
leopold99 07-19-06, 08:46 PM caller ID displays are like any other display, LED or otherwise.
what gets displayed depends on the signals sent to it.
when you say 'control' what are you talking about exactly?
edit
you might want to start here:
http://www.google.com/search?client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial_s&hl=en&q=caller+ID+specs&btnG=Google+Search
well, the question was kinda 2 parts. first, I wanted to know if there was a difference between caller id LCDs and one you would buy specifically for, say, a pic18. secondly, I wanted a few pointers on where to start when it comes to programming for them. I have not been able to find good info. perhaps you could suggest some reading or google searches that may help.
thanks for your interest/help. I am still very new to microcontrollers.
kazakhan 07-20-06, 07:44 PM Cato, have you checked out Electro-Tech yet? You will certainly get the help you need there...
leopold99 07-20-06, 07:54 PM the only difference between caller ID displays and say a 7 segment led display is that a caller ID display operates on a dot matrix principle
i would assume that a caller ID display has a built in character generator so that when you send it the code for 'a' the generator supplies the proper signals for the LCD
let's take an example here
you have a caller ID hooked up to your phone to receive caller ID info.
when you list the various calls this is what happens.
an internal character position is set to zero
a line counter is set to zero
a character is sent to the character rom
the character rom sends a set of signals to the LCD at the position indicated by the position and line counters
the position counter is incremented by 1
if the end of line has been reached the position counter is set to zero and the line counter incremented if the end of message has been reached (3 lines) the line counter is set to zero and the charcter numger is set to zero and the intire message is redisplayed.
the above continues untill you request the next message.
the next message sequence is identical except the characters displayed will probably be different.
if you want to use the LCD by itself then you will have to provide the position and line counters in addition to the signals you want to display
superluminal 07-20-06, 08:10 PM well, the question was kinda 2 parts. first, I wanted to know if there was a difference between caller id LCDs and one you would buy specifically for, say, a pic18. secondly, I wanted a few pointers on where to start when it comes to programming for them. I have not been able to find good info. perhaps you could suggest some reading or google searches that may help.
thanks for your interest/help. I am still very new to microcontrollers.
Well, you picked a good family to start with. I happen to think the PICS are awesome. Are you stuck with this caller ID LCD or can you afford a few bucks on a documented LCD from say, DigiKey?
MetaKron 07-20-06, 08:20 PM Interfacing PICs to LCD displays (http://www.mikroelektronika.co.yu/english/product/books/PICbook/7_09chapter.htm)
This article tells you what you need to know. This type of display and the pinout are pretty common. You can go to this page (http://www.allelectronics.com/spec.html) and read some specs. All Electronics has a wide choice of displays. I have a few of them.
Also, Google "PIC" and "LCD". There is a lot of good stuff out there.
leopold99 07-20-06, 08:52 PM Interfacing PICs to LCD displays (http://www.mikroelektronika.co.yu/english/product/books/PICbook/7_09chapter.htm)
i agree. this link will tell you what you need to know about the lcd
it even has a couple of macros for you.
it also shows how the bit patterns are derived so you can use your own special characters.
Interfacing PICs to LCD displays (http://www.mikroelektronika.co.yu/english/product/books/PICbook/7_09chapter.htm)
I highly recommend the whole free book from this link to any beginner. I printed it out and read it several times. IMO, you should thoroughly study the first 3 chapters where it discusses architecture and and the basic blocks. You should also begin by studying the instruction set for 16F84 from the book and the data sheet even if you plan to program in higher than assembler language. Like anything else, if you start with the basics, it will save you a lot of frustration later on. Anyone's first microcontroller project should be "the blinking LED" project, then add to the circuit and program.
MetaKron 07-20-06, 09:39 PM I've done Myke Predko's 3-line LCD controller, and that is very, very handy. Any type of 74174 hex flip-flop works for the shift register that you need. At one time I had a workable vectored interrupt manager for the 16F84A, and it could tend to the LCD between interrupts.
http://www.rentron.com/pic.htm
wow, thanks guys. i'm glad I could pull you guys away from the boob thread =].
that will give me a lot to chew on. I prolly wont post again till sometime this weekend. LCDs may not end up being my first project. I have 2 small geard motors, and one out of a hand mixer that I am itching to use
MetaKron 07-20-06, 10:36 PM If you need pulse width modulation, look for chips that have a PWM timer built in. My own attempts to do this with a 16F84 only showed me that you can't do that all that well with its timers and an interrupt service routine. It gets confused after about 300 Hz if you want 1 percent precision.
leopold99 07-21-06, 01:37 AM wow, thanks guys. i'm glad I could pull you guys away from the boob thread =].
eh no problem cato.
this is frustrating as hell. I can't find any guides that use C/C++ (which is the only language I know). moreover, they all seem to use a $35 lcd screen. I would much rather pay $0.50 at goodwill. after all, I am a broke ass school boy. sorry just venting.
also, I have an off topic question, but I didn't think it was worth starting a new thread. I am looking to buy a new laptop battery, is it ok to replace a 14.8v battery with a 14.4v? they say it is compatible, and it would seem that .4v is not much difference, but I just thought I would ask.
MetaKron 07-22-06, 05:18 PM I see. Cato, you might be able to extract the display and see if it looks like it will work with one of the hookup diagrams that you can download from www.allelectronics.com
The $35 display probably comes with serial interface.
All Electronics has some character display LCDs for as low as $1.85 each. Mouser (click here) (http://www.mouser.com/catalog/626/9.pdf) has a 16 by 2 character display module for as low as $5.88, and that lets you combine shipping charges with your favorite PIC microcontroller.
Click here for freeware C compiler for PIC (http://www.htsoft.com/products/PICClite.php)
Google Search (http://www.google.com/search?num=100&hl=en&lr=&safe=off&q=%22c+compiler%22+PIC&btnG=Search)
yeah, I am not worried about the compiler, I already found a few. what I meant was that it is hard to follow a LCD tutorial when you don't know the programming language =]. just like math, I understand theory from examples better than examples from theory.
I haven't even got my programmer or pic18 in the mail yet, so I guess I am jumping the gun on the frustration =].
MetaKron 07-22-06, 06:06 PM You need to look up the mnemonics and that helps a lot. Assembly code is so simple that it is hard. Read the explanation carefully and you can see where you can plug your own variables in and run the assembly code, which you can do in C. Any C compiler should be able to run inline assembly code.
It would be fun to work with the PIC some more but most likely I am going to be an AVR man exclusively when I start up again. They have cheap chips that have two PWM controllers on board. My application needs symmetrical PWM for two outputs. It's going to be a pain to get started again also because none of my AVR chips has legs and I don't have the equipment that I used to use to make boards for SMT projects. My funding is also quite limited.
leopold99 07-22-06, 07:38 PM I am looking to buy a new laptop battery, is it ok to replace a 14.8v battery with a 14.4v?
if it will fit your laptop it should be fine.
leopold99 07-22-06, 08:50 PM yeah, I am not worried about the compiler, I already found a few. what I meant was that it is hard to follow a LCD tutorial when you don't know the programming language =].
LCD's do not have a programming language.
LCD's operate on digital ones and zeros
the most obvious reason you cannot find any tutorials in C/C++ is because most actuators are analog based with some being digital.
unless the situation has changed drasticly your I/O chip will be programmed in assembly language.
the chips i am familiar with operate on bytes
for example you would send the chip a control byte to configure it
the chip will put a byte on the data bus or it will latch a byte off the bus
like i said unless the situation has changed you will need to learn assembly for your pic
there are several compilers out there that can turn C into assembly. I did it all last semester with the 68hc11 I was working with. what I meant was, it was hard to see what operations the person's program were performing without understanding the language.
hmm, I think I figured out a project. I think I will try and make an autonomously guided vehicle, on a small scale. unless you guys have a better way, I was thinking about making the little robot-car have a directional antenna, that would rotate, and 2 NDBs (non-directional beacons) to allow triangulation of position. I could narrow the width of the antenna down really far, so I could get a precise measurement of the two signals.
what do you think?
MetaKron 07-23-06, 09:10 PM I think that three beacons would be better. You could also use a pair of dipole antennas at right angles to each other so you don't have to deal with the rotating mechanism.
leopold99 07-24-06, 08:59 PM I think that three beacons would be better. You could also use a pair of dipole antennas at right angles to each other so you don't have to deal with the rotating mechanism.
you could feed one dipole a certain frequency and the other a different frequency.
MetaKron 07-24-06, 09:03 PM They read the same signal and the ratio determines the vector. Even with a moving antenna it takes some doing to get a good front to back ratio so you need three beacons at three different frequencies to be able to get three lines that intersect.
leopold99 07-24-06, 09:19 PM i think blue_uk was thinking about a sonar type of deal to measure their room.
MetaKron 07-24-06, 10:25 PM That's a pretty good idea too and doesn't require external hardware.
i think blue_uk was thinking about a sonar type of deal to measure their room.
that is very hard because you don't know what you are looking at, all you know is how far away it is. with 3 external signals for guidance, you can figure out exactly where you are, and where you are going.
You could also use a pair of dipole antennas at right angles to each other so you don't have to deal with the rotating mechanism.
that sounds good, but I will have to figure out how dipole antennas work. I have never dealt with them before. I am sure I can figure it out though. I will go to wikipedia =]
ok, I think I understand dipole antennas enough to use them. although, I am nore sure how I can get around making it rotate.
Blue_UK 07-25-06, 06:35 PM Cato, are you trying to make a device that displays a caller ID, or simply trying to interface an LCD unit?
I've got the LCD working, if that helps
edit: I say 'the', I mean the standard Hitachi interface that 99% of 2x16 alphanumeric LCDs use.
yeah, I am not sure what I am going to do first. also, I may not end up doing a project until winter, since fall (college) is coming so fast. I need a project I can do in a month =]. which is why I wanted to do the LCD thing. however, I would like to automate something. like a robot arm, or little car, or something.
edit: but yeah, I was just trying to use the LCD. I don't really want to make a caller ID.
Blue_UK 07-25-06, 07:38 PM You should know that to use the LCD is actually very easy. What is not easy is to initially grasp the initialisation steps. The HD44780 (any 2x16 LCD you buy on ebay will most likely use this controller) needs to be sent some data to start up. The sequence - and the timings - aren't intuitive (at all). E.g. to start up: wait 15ms, send 0x18, wait 5ms, send 0x18 again, wait 100us, send 0x10, wait 40us.
Unlike many things where you can build up slowly, correcting as you observe the progress - all of this (and more) needs to be done before anything visible happens.
I was pulling my hair out trying to decipher the datasheets. I gained confidence, however, by downloading other people's routines and seeing how they worked. (I can give you the 'C' code if you like).
I strongly recommend trying to get an LCD to work, as they're cheap and provide useful experience.
Here's a picture of a simple program in action that runs a timer and converts the binary into decimal and into then ascii.
<a href="http://img96.imageshack.us/my.php?image=2607060131bg7.jpg" target="_blank"><img src="http://img96.imageshack.us/img96/2708/2607060131bg7.th.jpg" border="0" alt="Free Image Hosting at www.ImageShack.us" /></a>
ok, I will try that. I will go to goodwill sometime and pick up an LCD for like 1$ and see whats inside (chip wise).
leopold99 07-25-06, 11:28 PM The sequence - and the timings - aren't intuitive (at all). E.g. to start up: wait 15ms, send 0x18, wait 5ms, send 0x18 again, wait 100us, send 0x10, wait 40us.
http://www.doc.ic.ac.uk/~ih/doc/lcd/initiali.html
eh, I could not find anything at goodwil. perhaps I should just get one off ebay.
hey everyone! I got my programmer finally. well, it came Monday, but I was at work, and cold not get it till today.
anyway, does anyone know of a sample program I could use just to make sure everything is working fine? its a PIC18FL458.
I don't want to start programming until I test everything, what a waste of time that would be =].
uhh, I downloaded some MPLAB stuff with the c18 compiler addon, but I don't know how to compile =].
does anyone hae experience with MPLAB and/or C18?
leopold99 08-05-06, 01:49 PM does anyone hae experience with MPLAB and/or C18?
i have no experience but this might help
http://www.melabs.com/support/mplab.htm
i found that site from the following search page
http://www.google.com/search?client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial_s&hl=en&q=mplab+compilers&btnG=Google+Search
yeah, sorry, rookie mistake =]. I had it configured (well it was configured bu default) to use a different language suite. once I configured it to use c18 instead, everything was peachy =]
MetaKron 08-05-06, 05:48 PM Now you've got me itching to do something with microcontrollers. I have everything as long as I don't mind working with SMT devices that I have on hand. I'm really tempted to spend some money on chips with legs on them instead of doing that.
leopold99 08-05-06, 06:11 PM i agree.
the I/O chips i worked with were nothing more than a set of registers with a couple of interrupt lines.
from what i've read about these pics they not only provide I/O functions but they can also convert analog to binary, store bytes, and even alter their programming.
MetaKron 08-05-06, 07:13 PM They keep simple tasks simple so you don't have a lot of stuff between the program and the lines you want to control. They are fast enough that "bit-banger" ports are practical. It is sort of a shortcoming that the cheaper PICs don't have the kind of RAM you might want, but most of the tasks that you use an MCU for don't need kilobytes or megabytes of memory. I do wish that the under three dollar types had at least a few tens of kilobytes so they could spool text, but they're pretty good anyway.
One trick that can be done is to interface these with memory sticks so that you can use even the newer cheaper gigabyte memory sticks. That's like 30 hours or so of sound recording or 20,000 snapshots at decent resolution. Some of the applications may look like the tail wagging the dog, but you basically acquire the data from a device and record it to a device. Both devices may have a lot more computing power than your controller, but you treat them as black boxes that just do what you tell them and use the controller to tell them.
update: I think I got my "hello world" program done. I will test it in the morning. I still have to figure out how to get the program that interfaces with my board to run my program. with the stuff I did in class, they told us where the program started (memory location 1040) so all we had to do was type "go 1040" into hyper terminal.
the program will just blink an led at a half second rate. I still have to figure out how the bit masks work. I tried PB7 and RB7 but neither worked, I had to use 0x80. I know it does not seem like much of a days work, but the coastguard festival is in town and I kinda got pulled away =]
MetaKron 08-06-06, 12:40 AM Are you using the same board you used in class?
no, I used a 68hc11e9 in class, now I have a k149 with a PIC18LF458
leopold99 08-06-06, 11:52 AM no, I used a 68hc11e9 in class,
the part number sounds like it could be a motorola product.
did this chip have 6 registers arranged in 2 sets of 3 called an 'A' side and a 'B' side?
MetaKron 08-06-06, 12:11 PM Is there even a communications program installed on your chip? What I'm used to is simply switching on the power supply and watching what it does. It's not going to talk to your terminal without a communications program installed.
You can't use the communications protocol that is used for programming the chip at runtime. It has to be in program mode to use that.
leopold99 08-06-06, 01:02 PM the chips i'm familiar with had to be read by the cpu.
the I/O chip sent an INT to the cpu to tell it the byte was available.
it was a really simple setup
I am about to pull my hair out! I am using micropro.exe (came with the board) and it seems to communicate, it lets me program the board, then verify that it has been programmed. but I have no idea what is going on after that! is it running my program automatically? hell if I know, I can't find anything that would be a command to run it. I don't have anyplace to type a command such as "go 1040."
I used an led setup at first, and when it failed to flash, I thought maybe my LED was bad, so I put a voltmeter to the pins and got squat! maybe I have to enable the use of that pin first? I wish I could know that it was running my code, then I could tell if it was a code problem or what.
right now its 100% humidity, 90 degrees and I just got back from being lost for 45 minutes looking for the only place in 50 miles that sells brake pads (because its fucking sunday) that I have to put on in a rain soaked driveway! after getting low on gas and having the pump refuse my debit card, I almost had a stroke.
maybe I should hang it up for a while. =/
MetaKron 08-06-06, 01:42 PM The K149 that I can find doesn't seem to support breadboarding. Are you taking the chip out and putting it on another circuit?
You have a couple of things to look for here. Is your oscillator configuration correct for what you are using for the oscillator? This one doesn't have an internal oscillator mode. That's in 2.1 in the documentation for the chip.
Pin 1 (MCLR) needs to be high. I am presuming that you are using the DIP version.
hmm, maybe I don't have an oscilator. I just assumed there was one, since it supports ICSP.
http://i6.ebayimg.com/03/i/05/1c/82/f6_1.JPG
there seem to be a few incarnations of the k149, this is the one I have
MetaKron 08-06-06, 06:08 PM That oscillator is on the programmer. There is a certain default. I think it's for the crystal with the two capacitors.
You have crystal, RC, or external clock as sources. Read the documentation carefully and choose the one you like or have the parts for. You might find a clock or crystal on an old motherboard especially if you have some really old ones like 386 boards. Just to get it running, just use the RC type they have listed.
You are using the type of PIC that I would have liked to use, with enough room to run some video, Basic or C programs, games, whatever. It's a lot like those older small computers only better because it is faster and easier to hook up.
damn! I thought the fucker had a crystal on it! why the fuck does it have in circuit serial programming if you can't use the programmer in the circuit!?
I am so pissed off right now...
MetaKron 08-06-06, 07:29 PM The crystal or RC circuit are attached to the chip when it is in circuit, so ICSP will work just fine. It's pretty easy.
yeah, I was hoping to not have to hook anything up. now I have to get parts, breadboard, solder, and fuck around with it before I can even test it.
the whole reason I bought this fucking programmer was because I thought ICSP implied it could be run from the programmer without addition parts.
...fuck...
well, how do you think I should connect this thing to a breadboard? I was thinking about soldering two 20 pin data robbons to the bottom of the ZIF, and find something to adapt it to a breadboard. do you know what kind of connector can go from a data ribbon to a breadboard? moreover, where can I get some 20 pin data ribbons(preferably not buy them from a store [rip off])? I don't have any extra computer parts laying around. my brother in law might have some. I will see him next weekend.
MetaKron 08-06-06, 09:05 PM Use the 6 pin header.
you mean the ICSP pins? I would like to have a way to breadboard all of my I/O pins, without having to remove the MCU each time. unless you know of a better way
MetaKron 08-06-06, 10:11 PM 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?
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.
MetaKron 08-06-06, 10:45 PM 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.
One of them is made to be a programmer and a breadboard
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.
:cool:
MetaKron 08-06-06, 11:46 PM 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.
MetaKron 08-07-06, 12:10 AM 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.
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
leopold99 08-07-06, 03:11 PM 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.
safjklggr sdyhgapoik yaf fggf aoip
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.
ohh, I am calmed down today =]. I just had a really bad day yesterday =]
MetaKron 08-07-06, 05:12 PM 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.
Blue_UK 08-08-06, 08:04 AM 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.
I'll repost my comments from the 1st page ...
I highly recommend the whole free book from this link to any beginner. I printed it out and read it several times. IMO, you should thoroughly study the first 3 chapters where it discusses architecture and and the basic blocks. You should also begin by studying the instruction set for 16F84 from the book and the data sheet even if you plan to program in higher than assembler language. Like anything else, if you start with the basics, it will save you a lot of frustration later on. Anyone's first microcontroller project should be "the blinking LED" project, then add to the circuit and program.
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.
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.
MetaKron 08-08-06, 04:09 PM 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.
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.
Blue_UK 08-09-06, 06:36 AM he's using a 628? Ah didn't read that. Thought he might be tempted to try and use higher ranges all together.
MetaKron 08-09-06, 05:36 PM 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.
It doesn't take a higher level genius for that either, and I wish I had got one and learned it myself.
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.
MetaKron 08-11-06, 07:53 PM 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.
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. :D
http://img291.imageshack.us/img291/1866/wdpic18lf458ce0.jpg
MetaKron 08-13-06, 08:12 PM 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.
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.
yeah, I read that part, but I don't really know what is best to use.
MetaKron 08-13-06, 09:00 PM Try 10k and 180 pF. 220 pF, 330, 470, somewhere in there. Maybe try 4.7 k for the resistor, up to 20 or 30 k.
If you have a frequency counter you can get the frequency from the pin that says OSC/4 if it is in the right mode.
hmm, I guess. I have a program to measure frequency (from my class). but it is a huge pain to write a monitor program for the chip, just to know the frequency. I would not even know how to do it since the monitor program I did before used hyperterminal.
do you know of of any other way I could make sure I have the right frequency? I guess I could wait till school starts, and use the oscilloscope.
MetaKron 08-14-06, 06:23 AM I think that the biggest problem you will have is not knowing the exact timing of your processes. When you can, it is a good idea to invest in some crystals. Doesn't your school have a frequency counter, by the way?
yeah, our osciloscopes kick ass. they can do pretty much anything you want, and take a color image and save it if you like. if I want duty cycle, no prob, frquency, no prob. I can even plot two different inputs with respect to eachother (one probe is y-axis, other is x-axis) if I want.
yeah, you are right, I could just shoot for like 10MHZ or somthing, so my margin of error wont make much dif. besides, its not like the first couple of things I do will need a perfect clock.
forget it, I am just going to get a crystal. I found an electronic store I can get one from.
http://www.alliedelec.com/Search/SearchResults.asp?SearchQuery=crystal+20+mhz&SearchType=STANDARD
I was thinking I would get the third one in that list. it says on the main page that it is a 20MHz oscilator, but in the data sheet it lists a range. forgive me for not knowing much about crystals, but do the caps regulate the frequency? and if so, is there a way to calculate exactly what values of the caps I need?
invert_nexus 08-14-06, 02:39 PM It looks to me like the specific crystal there is 20 MHz. The frequency range is given for the product line in general, the XT49U line. But, when you buy one, you have to have a specific frequency and other specifications.
updated schematic:
http://img156.imageshack.us/img156/1085/wdpic18lf458vl4.jpg
let me know if I messed something up. besides the short across the cap, I already fixed it.
MetaKron 08-14-06, 08:04 PM Cato, on a breadboard it is a good idea to keep the frequencies down, so you might want a 4MHz crystal. You can program the chip to multiply the crystal frequency by 4, so when you are ready you can use a 10 MHz crystal. It is a smaller pain.
Parallel versus series resonance means that the crystal was calibrated for either a capacitative or an inductive load when it was made. I think that the documentation of those crystals implies that they use capacitative loading but I am not sure. You might want to log on to the manufacturer's site and see if you can find a better explanation.
yeah, thanks man, I didn't even think of the frequency problem. yeah I will go with 4mhz. would the crystal's package list whether it is parallel (cap) or series (L)? or would that be in the data sheet?
anyway, I should be able to get this mofo up next weekend. after the led "hello world" flasher, what other simple shit can I do. maybe I can learn some ADC or somthing.
later
MetaKron 08-14-06, 09:45 PM I really don't know. Crystals labeled "microprocessor" crystals are very likely to be parallel. It's a matter of the calibration according to some literature I read, There doesn't seem to be explicit labeling in the data sheets about the parallel versus series thing. Look at the loading they specify. Two capacitors of equal value in that pi configuration you showed me add up to half of that value, so you can add them up to the capacitative loading on the sheets. Try for one that says 15 to 18 pF and then the two 30 or two 33 pF capacitors will give you a value that is close enough.
For the most part you will never know the difference anyway, but with frequency counters you will need to make an effort to get that timing calibrated. You can make one of the caps a variable for that.
leopold99 08-14-06, 10:30 PM capacitors are notorious for having extremely wide tolerances.
-25% to +50% is typical
your best bet in this situation is to have a variable cap in series with one of the others to tweak the frequency. also make sure your supply voltage is regulated and that no stray capacitances is being coupled to your clock.
timing problems will definately be the biggest problem you will face in digital design. there are others of course, addig with carry instead of a straight add will drive you bananas tracking down the cause.
do you have a logic probe? if not get one, it's a good investment.
MetaKron 08-14-06, 10:41 PM Even without tweaking the calibration the clock should still be pretty accurate. There are all sorts of ways, including synchronizing with the WWV time signal if you have one. Can't do that over the net because of unpredictable delays.
Two capacitors of equal value in that pi configuration you showed me add up to half of that value, so you can add them up to the capacitative loading on the sheets. Try for one that says 15 to 18 pF and then the two 30 or two 33 pF capacitors will give you a value that is close enough.
what?
MetaKron 08-15-06, 05:22 PM The two little capacitors next to the crystal present their capacitance to the crystal in series.
Try for one that says 15 to 18 pF and then the two 30 or two 33 pF capacitors will give you a value that is close enough.
this is what I don't get. one what? crystal? what do you mean "says" says where? in the 18f458 data sheet?
its like a riddle =]
MetaKron 08-15-06, 06:55 PM Your schematic up the page here. To figure out the approximate capacitative loading that you have on the crystal, figure out the total of the two capacitors in series.
I guess I just don't understand why I need the total. the 18f458 data sheet (http://ww1.microchip.com/downloads/en/devicedoc/41159d.pdf) tells me what caps to use for what xtal.
MetaKron 08-15-06, 07:24 PM I was thinking that it helped to know that if you wanted to make one a variable to trim the frequency.
The crystal is calibrated for a certain capacitative load so I think if you aim for that much when using a variable in the circuit, that puts its rated capacitative load in the center of the adjustment range of the variable capacitor.
ohhhhhhhhhh, ok. it all makes sense now =].
MetaKron 08-15-06, 07:27 PM The data sheet offers a range that lets you use down to 5pF loading on the HS side, and the capacitors are often calibrated at something like 7 pF.
MetaKron 08-15-06, 07:28 PM It's something that I've been used to figuring out.
so, here is my cart at allied electronics' website. is there anything else you think I should add? the regs are for making my own supplies out of supplies of different voltages. also, I have 2 MCUs so I am buying crystals for both.
http://img139.imageshack.us/img139/4229/alliedelectronicscartng8.jpg
also, what are these connectors called?
http://www.8052.com/users/lionheart/8752b.JPG
(top of picture)
I may not buy the connectors, as they are not really important at this stage but I would like to add them in the future.
thanks
MetaKron 08-20-06, 08:45 PM Those connectors are called headers. I think Radio Shack carries them in that snappable format.
do you think I should buy anything else? or wait till I have a real project?
MetaKron 08-20-06, 11:38 PM Think about whether you want to grab a dollar or two worth of stuff to get it under the same shipping charge. It wouldn't hurt to get an extra capacitor or two in case you destroy one by accident.
any suggestions on things that might come in handy? I don't want to get my order and realize I forgot something =]. I am not really in a hurry anymore, as classes start next week, and I will still be working my co-op. I don't plan on doing anything major till winter.
MetaKron 08-21-06, 08:55 PM I was trying to find some low dropout voltage regulators on that site but I can't seem to find the ones I was looking for. Mouser has them.
Also, just in case, get a couple of 30 pF capacitors.
MetaKron 08-22-06, 10:17 PM I've decided to wait for a while to order any 40 pin PICs. The idea of using the 18F4550 is interesting because the computer can talk to it through the USB port, so it's a favorite right now. Maybe in a few weeks.
hmm, the 4550 looks interesting. do you think my programmer can program it? I wouldn't imagine there would be big changes from chip to chip.
MetaKron 08-24-06, 04:08 PM Most likely it can. Look at your list. I think that even if your programmer's software does not list the chip you can find the addresses of the registers and set up equates to names for them and then the programmer will program them like other memory addresses.
MetaKron 08-24-06, 10:26 PM One of my favorite ideas for the USB chip is to buy a 18F2550 in the 28 pin SOIC style. It's a lot easier to make a board for it and solder it than with the small form factors of the 40 pin chip.
speaking of communication, I was thinking about what it would take to make a pic wirelessly communicate with, say a computer. could one simply interface the pic with a 802.11 pcmcia card? or would one have to do the signal processing themselves? I have not really looked into it yet, but it seems like the signal processing and packet verification would be done within the card.
anyway, if you have a specific thing in mind, then yeah, I would only get as many pins as you think you will need. the reason I went with a pdip40 was because I figured that 34 I/O pins could cover me no matter what I need to do.
MetaKron 08-25-06, 06:05 PM I would look into using a USB ethernet adapter for that. There is prior art out there, you can just assume that and look for it on Google. Obviously the two-wire plus ground and power connection is quite appealing. The 2550/4550 type is cheap and fairly simple.
I don't have a specific thing in mind right now but the idea of a computer controlled shortwave receiver comes to mind.
I would look into using a USB ethernet adapter for that.
you mean like an airport card? (usb wifi). I just think it would be cool to wirelessly gather data, I don't really care if I use lots of pins.
MetaKron 08-27-06, 10:27 AM The absolute easiest way should be with a wireless USB extender, actually.
http://www.newegg.com/Product/Product.asp?Item=N82E16833130115
That one says it transmits and receives up to about 300 feet indoors. Interference could be a problem and I don't know how big a problem. Security is built in. You have to have documentation and code to get the project to talk to the adapter. The adapter needs some kind of setup and has useful features that should be transparent to the user.
Wireless USB products on Newegg (http://www.newegg.com/Product/ProductList.asp?N=2010410031+4093&Submit=ENE&SubCategory=31)
hmm, I was thinking about what it takes to make a joystick out of a microcontroller. I wonder how hard it would be to do a usb joystick. have you run across anything like that in your Internet travels?
MetaKron 08-30-06, 06:26 AM I think that these days all the joysticks that you can buy are USB or can do USB. I wouldn't make one without a special need.
It probably wouldn't hurt to get some 1 amp Schottky diodes when you send in your next order. They're pretty cheap. The people who put the projects out on the net seem to think that this improves the ICSP setups somehow. Look for a lower forward voltage drop like about .42, some of them have that.
ohh, ok. I will be sure to get some of those diodes.
the usb joystick is a potential class project. I was wondering what kind of work I am in for, and if you knew of any resources.
MetaKron 08-30-06, 08:29 PM You need to find the protocols to get the computer and the joystick to talk to each other. Microsoft publishes its HID protocols on its website for free, if I remember correctly, and there ought to already be one established for a USB joystick.
cool, I will have to check that out this weekend... or at my co-op tomorrow =]. my job is quite tedious at the moment.
|