On Apr 12, 2008, at 6:28 PM, <[EMAIL PROTECTED]>  
<[EMAIL PROTECTED]> wrote:

> I hate the fact that I’m announcing this, but I’m looking for some  
> assistance with PIC, STAMP, whatever programming and learning how to  
> read what some one else already put on an IC. At a club meeting a  
> few years ago, the pres at the time did a presentation about PIC  
> microcontrollers and gave a demo. He showed us that it either was 64  
> lines or pages of code to turn a little LED on and off with a  
> momentary push button and I thought was a waste of time to put that  
> much effort into perform such a simple task…. Open mount, insert  
> foot. (how many lines of code do you think the ASIMO programmers  
> have to write to make it the damn thing turn it’s head one degree?)

Why do you hate it?  You're just asking for help with something new.

First, I'll say that for my "taste" you're going about it backwards --  
you need to decide if the phones you're using can even be brought into  
the ham bands by analyzing and controlling them manually and measuring  
their performance in the band, before worrying about how you're going  
to control their features/gadgets.  If the RF deck in the phone wasn't  
designed for the ham band, you have some serious modifications ahead  
of you and studying of the components on the board and the service  
manuals to even see if the device will go to ham frequencies.  I  
wouldn't even THINK about working on the digital user-interface or  
control circuits, until you know the basic RADIO will do what you  
want.   But, with that said... I'll move on to microcontrollers and  
such.

What he was probably showing you was programming the PIC  
microcontroller in Assembly Language.  Every single thing the chip  
does is accessible to you at this "low-level" language, down to  
individual bits and any low-level math functions.  (When was the last  
time you did mathematical division -- for example -- by writing a loop  
that looked at an individual address spaces holding two numbers  
represented in binary, and then did addition (or subtraction -- which  
is really only backwards bit-wise abddition in CPU's) to individual  
bits at a time, while also having another loop moving in and out of  
memory locations using an 8 bit binary scheme?  That's low-level  
Assembly programming!  Remember, digital logic is at it's lowest- 
level, just a giant bunch of transistor switches that can be set to on  
or off... 1 or 0 in programmer's language.)

Writing in Assembly is both "old-school" these days, and also the  
"only way to learn it right", so to speak.  But... with that said,  
there's PLENTY of people who've never programmed a microcontroller in  
a low-level language like Assembly.  They'll never know if the program  
the high-level language's compiler is "right" nor can the tell if it  
uses the chip in the most optimized way, saving the VERY limited  
program memory and on-board flash on these tiny little processors --  
but with higher level languages you can write code for  
microcontrollers in BASIC, C/C++, etc.  There are also some people  
who've written complete special languages that make it "easier" to  
write "simple" code for a microcontroller.

There are a MULTITUDE of 8-bit and larger microcontrollers on the  
market nowadays.  Most hobby applications use the Microchip PIC and/or  
the Atmel AVR types, but there are others... each specializing in  
market "niches".  Both Microchip and Atmel have cheap/non-production  
programmers that often double as in-circuit serial debuggers when  
using the right chips (a feature where the chip supports special  
instructions where the developer can literally step through his low- 
level code one line at a time and see what the circuit does *IF* you  
used their free Assembly language/C tools.).

A couple of places to start:

Of course, the manufacturers:
<http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=74 
 >
<http://www.atmel.com/products/avr/default.asp>

(Those are the links for only the 8-bit microcontroller products, both  
companies now have product lines all the way up to 32-bit  
architectures.)

Community sites:
http://www.piclist.com
http://www.avrfreaks.net
http://forums.microchip.com

I originally stopped programming in Assembly in the 1980's, and then  
came back to it in microcontrollers much later, for "fun" -- other  
than messing with the types of things you mentioned above, "blink an  
LED" and the like I didn't really do a whole lot "productive" with  
them, but it reminded me of the "simpler" days of computing... when  
all you had was an 8-bit microprocessor and a very tiny amount of RAM.

Today, to accomplish things in a reasonable amount of time as a hobby,  
you have to realize that the amount of coding effort to make a  
microcontroller (without an HLL or... "high-level language") is not  
trivial!  If you're unfamilar with microcontrollers, you'd better lay  
out a plan to work through things like "blink an LED" and build that  
simple circuit first, get the code working, and then move on from  
there.  It's going to take a while to get the hang of it, and  
depending on how much time you can devote to it, you're looking at  
months of "night engineering labs" in the basement, or whatever.

One of the best ways to learn is to duplicate some things other hams  
have built.  The PIC is by far more popular a "platform" for ham hobby  
work, but the AVR's work great also.  Google is a good source to find  
finished projects, and you'll find more examples out there for the  
PIC, but you'll also find that FAR too many of them are for the  
completely obsolete (but still available and popular) 16F84 chip.   
There are FAR better chips from Microchip with more on-board memory,  
and nifty accessories built-in for the same price in low-quantity  
(remember, anything in electronics, less than 1000 chips is "low  
quantity").

You're going to need a development set of hardware to get started.   
Most folks nowadays are using the PICKit2 from Microchip for the PIC's.

<http://www.microchipdirect.com/ProductDetails.aspx?Catalog=BuyMicrochip&Category=Getting%20Started%20Programmers
 
 >

And the AVRFreaks site has some "Tutorial" information about AVR's  
that includes information on the available options for programming  
them.  AVRs first popularized in-circuit serial programming, but  
everyone else has long-since caught up.  Early AVR fans loved that all  
they needed were four or six wires going to their circuit board, they  
never had to remove the chip being programmed, etc.

To me, the "community" websites for AVRs are now far are cleaner and  
easier to navigate and understand than places like PICList and the  
Microchip Forum, but there are plenty of great people in both groups.   
(Again, I haven't used them, but have met hams who have and liked them.)

http://www.avrfreaks.net/wiki/index.php/Documentation:Getting_Started_with_AVRs

If phrases like "Harvard Architecture" and "Accumulator" are not in  
your vocabulary, the learning curve is VERY steep to program  
microcontrollers at a low-level using Assembly.  It really only starts  
to make sense after you've got a bit of experience with it, and the  
only way to get that experience?  Get one of the cheap (all are at or  
under $50 US) "beginner" development kits from either manufacturer and  
start building digital circuits!

Even with the PIC tools -- the PICKit 2 comes in two bundles, a "low- 
pin count" version, that seems to focus on the types of PICs that are  
available in DIP packaging (what most people think of when they think  
of a "chip") and a "44-pin" demo board version that uses a newer  
microcontrolle that's surface-mount... you start having to make  
hardware "design" decisions right up front.  Both are the same  
price... making the decision even tougher.

Lots of the information on the web is OLD about both product lines.   
You see TONS of articles about using the Microchip PIC 16F84 in ham  
projects, still to this day.  Most serious PIC developers left the  
16F84 in the dust YEARS ago, but it's still a good "learning" chip, I  
guess.  It really all depends on what you want to do with the hardware.

Get VERY used to reading 100+ page datasheets, if you're going to get  
into microcontrollers.  ALL of the information about what a particular  
chip does is in there, but it's a slog to get through them.  Even the  
lowly "hobby" PICKit2 supports hundreds of models of PIC chips  
nowadays... so you have to ramp up on the basics of the chips and  
their processor instructions, then learn about all of the possible on- 
board peripherals...

For example, many popular chips now have low-bit-count not-very- 
accurate Analog-to-Digital converters on board, that can be used to  
read voltages, etc... but you have to know how to both turn them on  
and off in your Assembly (or chosen high-level language) program when  
you "initialize" the chip.  One of the absolute most common "newbie"  
problems on the PIC is NOT explicitly setting the chip's "flags" for  
the on-board peripherals, setting pins as logic inputs or outputs,  
forgetting that a particular pin only has an open-collector on it and  
can't act as an output on a particular chip, etc.  There are also  
peripherals like dedicated PWM outputs (pulse-width modulation)  
typically used by robotics and other folks needing to control motors,  
and things like dedicated serial UART pins for serial communications,  
and on some even USB built-in... etc etc etc.  The list is huge.

You definitely want to get plugged into one of the community sites and  
read along, if you're going to self-teach yourself how to program  
microcontrollers.  There are plenty of people who will help, many of  
them professional EE's who do nothing but program microcontrollers and  
microprocessors all day for a living.

To give some background:  I first started delving into PICs when a  
friend (who was a ham) was playing with them using PicBASIC from  
Melabs.  (http://www.melabs.com/)  They have nice tools and their  
BASIC has a lot of "libraries" for commonly done things... you  
mentioned driving an LCD.  I'll get back to that here in a second.

He said it was the "simple" way to get started, but I decided to buy  
Myke Predko's book "Programming and Customizing the PIC  
Microcontroller" because I had done some Assembly Language programming  
on the Motorola 6809E in the 1980's and Assembly "didn't scare me!".   
I read that thing cover to cover, and plugged into the PICList and  
started reading, and reading, and READING... and as I read and learned  
I decided on a programmer called the Warp-13 from Newfound  
Electronics.  Back then, in-circuit programming wasn't common -- you  
built your circuit, and took the PIC off the board, stuck it in the  
DIP socket on the programmer, and programmed it... then put it back in  
your circuit, saw what it did, and then back and forth, back and forth.

(By the way, Myke's book is VERY dated now, and doesn't cover many of  
the developments of the past 5-8 years.  BUT... it does step you  
through what you're doing in Assembly on some VERY OLD Microchip  
products.  There are newer more interesting books that won't cure  
insomnia, and if you do buy Myke's book THROW AWAY THE CIRCUIT BOARD  
IT COMES WITH.  Tab Books had him design a chip programmer, but it has  
some SERIOUS design flaws, and I've NEVER seen anyone get the thing  
working PROPERLY on the PICList, other than those who've got enough  
experience in electronics to FIX his design flaws and adjust the  
circuit appropriately.)

I learned from reading Myke's book, and just "bit-banging" a commonly  
available LCD via it's on-board controller is an entire chapter in  
that book.  Today, you pick a relatively cheap high-level language,  
and maybe even some of the free ones, and there will be a complete  
code library to handle driving an LCD screen, if it's using a common  
LCD controller chip on the LCD module.  Your code will be just a few  
lines, and it'll be expanded "magically" by your compiler into the  
appropriate low-level code to be programmed into the micro to handle  
sending text to the LCD screen.  The more you pay for the tools  
(usually!  buyer beware!) the more libraries they will have, etc.

Anyway... things are VERY different now.  In-circuit programming via  
just a few wires has become commonplace, and high-level languages for  
programming these things abound, and are flourishing.  ESPECIALLY on  
the 18F series, which is far better suited to HLLs than the popular  
16F series of chips for various reasons you'll "get" if you ever work  
with either one in Assembly Language.  There are also a LOT of open- 
source tools for various platforms, including Linux now.  Nothing back  
then.  I had to set up a Windows 98 PC "just to program these silly  
chips" when I was heavy into Linux on the desktop machines back then.   
Now there's not only command-line tools but IDEs (Integrated  
Development Environments) that are graphical that "talk" to the low- 
level commands.

Costs have also come WAY down.  The tools available now for the newbie  
are cheap and come with tutorials and things.  There are also TONS of  
knock-offs and copies of the manufacturer's tools, but I wouldn't  
recommend STARTING with a knock-off.  Get the "real deal" from  
Microchip and/or Atmel and learn from there.

This is getting VERY long, so I'll stop here... hopefully that gives  
you some idea of where to start, but not really -- I know.  It's a  
huge world out there in choosing a chip, and development hardware,  
software, and what-not.  There are whole TEAMS of engineers that  
struggle with such issues when designing complex electronics at a  
company, these days.

To keep this only SLIGHTLY on-topic... take a look at the schematics  
of MANY of the popular repeater controllers on the market, and you'll  
find a PIC or an AVR running "under-the-hood".  There are some bright  
folks (probably lurking on this list) who've programmed a LOT of code  
on both platforms.  (Those that I know for sure are NHRC... Lots of  
PIC's on those controllers over the years, and I think Ken at Arcom is  
an AVR fan?  There have also been the articles in QST, and they even  
have a page dedicated to microcontroller articles on the ARRL  
website...)

http://www.arrl.org/tis/info/pic.html -- cool huh?

You'll be delving into a whole new world... for example, hams like  
chips that look like the "chips" we've seen for years, but most of the  
"real world" has moved on to surface-mount technology.  You can still  
get a lot of parts in the traditional DIP packaging, but many people  
find that they need a specific chip with specific features, and its  
either not available in DIP, or it's just too darn many pins that they  
need for their circuit design.

In that case, they start learning how to home-brew surface mount PC  
boards (or buy them from the MANY cheap and simple board houses out  
there, after laying out their board on their computer and sending it  
off via e-mail to the board house), how to get the components on them,  
and all sorts of other design questions that electronics makers and  
the people who work for them, make every day.

Again with board etching, it's "ease of use" versus "doing it  
right"... do you want to download the free software from PCB123 ( 
http://www.pcb123.com/ 
  ) and be "stuck" with using them for your boards (they're actually  
very good, and their prices are "reasonable") or do you want to learn  
how to lay out "Gerber" files that ANY board house can follow to make  
your board... but if you screw them up, you'll be sitting on a pile of  
boards that you either have to rework tediously by hand, or throw out  
and start over?  You can always go the "old-school" route and etch  
your own, there's tools for printing toner-transfer pages in a laser  
printer, transferring that to a board, and etching it with chemicals  
in your garage, too... ultimately it's YOUR process that you like the  
best.

For example:  Ever think about building or buying a controller to turn  
a cheap toaster oven into a reasonable replacement for the very  
expensive solder-reflow ovens that electronics manufacturers use?  Or  
soldering component so small you can barely see them?  Where a sneeze  
can wipe out your entire inventory of a specific resistor?

http://www.geocities.com/vk3em/smtguide/websmt.html
http://www.amqrp.org/kits/micro908/smt_construction.pdf
http://en.wikipedia.org/wiki/User:WillWare/Homebrew_surface-mount_construction
http://articulationllc.home.comcast.net/~articulationllc/sm0402.htm
http://www.seattlerobotics.org/encoder/200006/oven_art.htm

And then of course, there's the new RoHS requirements that have  
changed all the solder to not having Lead in it... and the resulting  
issues in re-learning how to solder...

I think -- and you may be seeing this now -- that your "just use a  
microcontroller" comment leads to a much bigger learning curve than  
you think -- first get some training tools that are pre-built and have  
some tutorials included on the software CD along with the  
manufacturer's development software... that's the best start.  Then  
you start getting into choosing chips, laying out your board, figuring  
out how to assemble/solder it together (and gathering tools to do it),  
learning basic digital electronics, then re-learning them when you put  
your first board in a high-RF environment (GRIN... ground planes,  
baby... and lots of bypass capacitors!), etc etc etc.

--
Nate Duehr, WY0X
[EMAIL PROTECTED]




------------------------------------



Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/Repeater-Builder/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/Repeater-Builder/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Reply via email to