DIYstompboxes.com

DIY Stompboxes => Digital & DSP => Topic started by: Garrett on November 17, 2005, 04:00:47 PM

Title: MICROHIP
Post by: Garrett on November 17, 2005, 04:00:47 PM
WASUUP,   Anyone ever messed with "MICROCHIP" programming stuff?  I do PLC programming for a living (AB). I found an old "Microchip" box here at work and it had a serial pic programer and two long chip cases full of different microcontrollers(nec,amd,). It also had manuals. I found the latest programming software online and it's free. I am going to persue this and see If I can make a TB switching box using spst switches and dpdt relays just for the hell of it. And maybe combine effects with one footswitch. They are at my disposal for free. So why not.
Title: Re: MICROHIP
Post by: jrem on November 17, 2005, 04:41:25 PM
I mess with them, the learning curve is steep if you choose assembly.  There is a email list called piclist (www.piclist.com) that you want to be a part of, the emails are generated from an MIT server, the archive is by a guy in CA.

Microchip PIC's rock, for sure, a hell of a lot of power in a $1.50 device.  But they don't drive much other than an LED, you'll need a power transistor to drive a relay.  And, like I said, learning assembly is a long road, but rewarding.  Else there are higher level languages that compile but I haven't used any (well, for the PIC that is).

Another way to go is the PicAxe, www.picaxe.com.   It's like a BasicStamp (www.parallax.com) but 1/20th the price, avail from www.phanderson.com state-side.  They work in tokens instead of compiling assembly code.  If you're new to that world you should start there instead of a full blown chip, unless you've messed with zilog or 8088's, or something before.  The picaxe is cheap and easy and fun.
Title: Re: MICROHIP
Post by: Garrett on November 17, 2005, 04:53:53 PM
jrem,

thanx for the info.  Very useful.  Picaxe is cheap.  I may order it first.

      thx, garrett
Title: Re: MICROHIP
Post by: jrem on November 17, 2005, 05:04:49 PM
yes, buy from phanderson, he'll send you instructions and the two resistors.

get a breadboard, make up a serial cable to three pin header.

some other pic projects are at http://jrem.webhop.org/stuff/geek/

open the readme.htm file (I did that instead of index so you can see the size of the files in case you're on a dial up).

Let me know if you want to see pics of the picaxe setup.

regards, John.
Title: Re: MICROHIP
Post by: Peter Snowberg on November 18, 2005, 10:44:27 AM
When I started messing with PICs in 1992 when there were only four EPROM/OTP devices available, now there are about a zillion different PICs.

I've used them for all sorts of stuff from stepper motor drivers, to fully networked sensing and control nodes with analog and digital I/O and optical fiber networking.

It was an easy sell to clients back in the early 90s because PICs were busy watchdogging the braking controllers in Mercedes anti-lock brakes and they were used somewhere for missile fuse arming/disarming. Highly reliable little chips and the originals (16C5X) were just amazingly hard chips to kill. They're the only microcontrollers that I know of where you could plug them in backwards for 1/2 hour and they still worked fine when flipped into correct orientation.

Some past PIC projects:
- uni-polar stepper motor drivers
- a networked phone line switching system installed in Madison Square Garden
- the robotic camera controllers used to capture the frames that would later be "stitched" together in the first QTVRs
- robotic camera controllers for Boeing, Disney, and others
- I/O interfaces for the Japanese educational market
- interface prototypes for a couple post cardiac surgery pacemaker devices (not implants)
- IR remote controls

Very cool little chips, but these days I'll take Atmel parts hands down over PICs.
Title: Re: MICROHIP
Post by: Garrett on November 18, 2005, 11:34:49 AM
wow, information . 

   I'm sure the communications and programming will be key.  I will probably just use the chips for discrete I/O.


Title: Re: MICROCHIP
Post by: Dave_B on November 18, 2005, 12:11:35 PM
Not sure if it helps, but there's a conversation about getting started with PIC's over here:
http://www.diystompboxes.com/smfforum/index.php?topic=38987

Peter (or anyone who cares to jump in), is there a layman's way of explaining the advantages of Amtel?  I'm guessing the need to bankswitch PIC's is part of it?   :)  As I've mentioned elsewhere, I'm new to these things and I've only used assembler so far, but I can't understand the advantage of designing them with several little banks of memory that I have to keep track of when programming.  One large bank just seems more sensible. 
Title: Re: MICROHIP
Post by: Peter Snowberg on November 18, 2005, 01:14:15 PM
Bank switching was sure a BIG motivator, but I like the instruction set MUCH better.

Microchip was an early leader (PICs have been around since the 1970s), but Atmel made faster, more capable chips that ran on less power before Microchip went in that direction. I switched to Scenix parts for a couple of years (like a PIC16C57 equiv. that was rated at 50MHZ and would easily overclock to 75MHz), but dropped dealing with those too. Scenix is now Ubicom.

I wrote a 230.4Kbps communications controller complete with a DPLL that did bit-banging to emulate a Zilog 85C30 SCC (to get IBM's SDLC encoding) using a Scenix SX28 at roughly 50MHZ. The code also contained much of Apple's LocalTalk protocol stack and I2C..... all within 2K(!). That may be the height of my microcontroller gymnastics.

The SX28 only had a couple of changes from a 16C57 apart from the faster speed. It really is an amazing architecture. The whole concept of RISC has been lost as technology advances, but for a bunch of years the Microchip 16C5x parts were king of that hill and they are still found in zillions of products.

I was looking at a hybrid device (dual-slope A/D) in the 1990s that had a bunch of chip caps, printed resistors, and a few IC dies attached to a ceramic substrate. It suddenly hit me that one of the dies was the same PIC die that you can see through the window of the windowed EPROM parts. From that point on I started to notice them EVERYWHERE.

Learn one microcontroller and you're fairly set to know them all. Any knowledge you glean from old Microchip development tools will still be useful and then some. :)

Oh yea, the bank switching was there to allow the core to be narrower. If instructions only have to hold a little address data, they can be trimmed by a couple of bits which translates into LOTS of transistors. The program memory of the early PICs was only 12 bits wide, 8 of which could contain address data.

On the little PICs, I wouldn't use anything but assembler. Parallax made some GREAT tools including an assembler that was full of highly useful macros. I quickly didn't want to code in anything except the Parallax environment. Parallax did the development tools for the Scenix parts and Microchip went ballistic. That was the end of that marriage.

BTW: The parallax environment worked excellently on an old 8086 (!) laptop.
Title: Re: MICROHIP
Post by: jrem on November 18, 2005, 01:45:33 PM
Quote from: Peter Snowberg on November 18, 2005, 01:14:15 PM
Bank switching was sure a BIG motivator, but I like the instruction set MUCH better.

Atmel is French.  I ain't messing with them.  But all kidding aside, once you understand how to bank it's not that big of a deal.  I think the ends justifies the means, so if one is happier with Atmel than PIC or Zilog or Zenix, whatever, IMHO.

Quote
<snip>  Parallax made some GREAT tools including an assembler that was full of highly useful macros.

huh?  Parallax made something other than the token code environment for their BasicStamps?

Quote
BTW: The parallax environment worked excellently on an old 8086 (!) laptop.

Yes, I still use it on an 80C88 Toshiba, but it's for a Stamp.  How do you port the token code into assembly?

The only assembly tool I use is the Microchip integrated development environment (IDE), it fricken' smokes.  Full blown emulator, stack, registers, addresses, all of it, and you can watch it run.  Awesome and a far cry from the TI99 that I learned jmp routines etc on in the 80's.

But I still suggest if one just wants to do descrete I/O they should definitely consider the PicAxe system, much faster learning curve and if you just need tens to a hundred or so lines of basic-style program (which converts to tokens, not assembly, much like the *current* parallax software) then it's the way to go.  And did I mention it's CHEAP?
Title: Re: MICROHIP
Post by: Dave_B on November 18, 2005, 08:48:42 PM
Not my thread, but I do want to say thanks.  You guys have caught me before I got set in my ways on these chips, which I tend to do.  I'll do some reading on PicAxe and the Amtel this weekend. 


Title: Re: MICROHIP
Post by: Peter Snowberg on November 18, 2005, 09:14:12 PM
Quote<snip>  Parallax made some GREAT tools including an assembler that was full of highly useful macros.

huh?  Parallax made something other than the token code environment for their BasicStamps?
Yep!  :D

Before Scenix got going, Parallax made a programmer and a bond-out based emulator for the PIC16C5x series. The emulator allowed you to dump code into the chips without having to use the EPROM testing cycle (erase chip using UV light for 20 minutes, program it, plug it into the target, power up and test, unplug and put back in the eraser, and repeat all day). If you wanted to make lots of little changes you needed to have LOTS of EPROM based parts because you are constantly having to erase them. It was a BIG pain before the Parallax emulator. The emulator was based on the ORIGINAL PIC16C64 which was a bond-out of the 16C57. That number was re-used later for a more capable part. The bond-out chips were not publicly available from Microchip (they were marked "INT USE ONLY") and when Parallax modified their environment for the Scenix chips, Microchip cut their supply off. So much for that. It was a GREAT environment for what it did!!!

The Scenix tools were just as wonderful and MORE. The programmer they came up with was about the size of a stick of chewing gum (a little thicker though) and the Scenix parts have FLASH MEMEORY!!!! None of the Microchip parts did at that time, so testing on the Scenix parts became a snap. It had other cool features like a programmable oscillator too.

I just looked at their web site and they still sell the SX stuff! 8) 8) 8)
http://www.parallax.com/sx/index.asp

Wonderful chips if you need a rocket engine speed CPU in a couple of square centimeters. It's rather wild to me that you can write a program to generate a 25MHz square wave!

Quote
But I still suggest if one just wants to do descrete I/O they should definitely consider the PicAxe system, much faster learning curve and if you just need tens to a hundred or so lines of basic-style program (which converts to tokens, not assembly, much like the *current* parallax software) then it's the way to go.  And did I mention it's CHEAP?
I'll second that.  :icon_cool:

These little BASIC style micros are wonderful, and they cut the learning curve down dramatically! Excellent points.
Title: Re: MICROHIP
Post by: Hal on November 19, 2005, 01:37:03 PM
I found assembly really easy :-D.  HOWEVER, none of my stuff worked.  It all compiled and simulated fine on electronics workbench, but didnt work on the PIC.  I need to get back to it.
Title: Re: MICROHIP
Post by: Peter Snowberg on November 19, 2005, 02:18:47 PM
Hal, check your oscillator fuse settings. That's it much of the time.  What PIC were you using?
Title: Re: MICROHIP
Post by: Dave_B on November 19, 2005, 02:20:59 PM
The fuse settings got me too.  I was useing a 16f88 and couldn't get anything to work until I unchecked all the fuse boxes in ICProg (the free programming software I use).
Title: Re: MICROHIP
Post by: Hal on November 20, 2005, 02:19:07 AM
Quote from: Peter Snowberg on November 19, 2005, 02:18:47 PM
Hal, check your oscillator fuse settings. That's it much of the time.  What PIC were you using?

16f628.  Yes, I was using hte internal oscillator.  I tried burning the program with like...every oscillator setting, using external R/Cs,  a crystal, a cermaic oscillator...etc etc etc etc. 

I bet it was something small and stupid.
Title: Re: MICROHIP
Post by: jrem on November 20, 2005, 10:40:39 AM
well if your chip programs but doesn't seem to be alive, it could be a few things.  a) maybe it's just not doing what you expect, i.e., stuck in a loop.  b) maybe it isn't getting started.

I have found the internal oscillator to be pretty good.  I've ran an LCD clock off of the 16f628 and it only lost a couple of seconds a day.  Never have a problem with it getting going.

The config settings are most important, though, I set them in the __config word.  Then ICprog pulls in all the right bits, but you must select the right chip prior to hex program load.

If you have something simple I can take a look at it or try and load a chip, email me off line.
Title: Re: MICROHIP
Post by: Dave_B on November 20, 2005, 10:59:17 AM
Quote from: Hal on November 20, 2005, 02:19:07 AM
I tried burning the program with like...every oscillator setting, using external R/Cs,  a crystal, a cermaic oscillator...etc etc etc etc. 
I bet it was something small and stupid.
Have you tried the simple stuff, like making an LED blink? 
Title: Re: MICROHIP
Post by: Hal on November 20, 2005, 11:48:56 AM
Quote from: bellyflop on November 20, 2005, 10:59:17 AM
Quote from: Hal on November 20, 2005, 02:19:07 AM
I tried burning the program with like...every oscillator setting, using external R/Cs,  a crystal, a cermaic oscillator...etc etc etc etc. 
I bet it was something small and stupid.
Have you tried the simple stuff, like making an LED blink? 

yup, that worked :-D.

Then I thought the next simple thing to do was to make a 7-segment "count" sequentially.  That didnt work.  I guess I just need to spend some more time playing around.
Title: Re: MICROHIP
Post by: Hal on November 20, 2005, 11:51:18 AM
Damn the lack of an edit.

JRem - thanks for the offer!  Unforunitely, all my stuff is at home, and I'm at school.  I doubt I'm gunna have time over thanksgiving, but I'll probably get back to it over december break.  Maybe I'll need the support then :-D.

Cool - I want to do an LCD clock, too.  I have a 4x7-segment that would be perfect for it already.  Pulled it off this treadmil consolse I scored for free.
Title: Re: MICROHIP
Post by: Dave_B on November 20, 2005, 12:31:54 PM
Quote from: Hal on November 20, 2005, 11:48:56 AM
Then I thought the next simple thing to do was to make a 7-segment "count" sequentially.  That didnt work.  I guess I just need to spend some more time playing around.
Make sure you're wiring it up correctly.  7-segs can be either common cathode or common anode.

My personal path started like this:
  * Make an LED blink
  * Make the entire port blink, Night Rider style.
  * Make the ADC work, displaying the result on the LED's.
  * Make a second channel of the ADC work.
  * etc. etc.
Title: Re: MICROHIP
Post by: Hal on November 20, 2005, 01:52:55 PM
does a 16f628 even have an adc?

::searches::  cool, looks like it does!  The book that I learned off of was pretty much aimed at 16f84s...I read online that the code is 99% the same, but thats why I didnt hear about an ADC or anything.  Maybe my other problems are comming from there.  Argh, now I'm more and more curious.
Title: Re: MICROHIP
Post by: The Tone God on November 20, 2005, 08:33:26 PM
Quote from: Hal on November 20, 2005, 01:52:55 PM
does a 16f628 even have an adc?

::searches::  cool, looks like it does!  The book that I learned off of was pretty much aimed at 16f84s...I read online that the code is 99% the same, but thats why I didnt hear about an ADC or anything.  Maybe my other problems are comming from there.  Argh, now I'm more and more curious.

I hope you don't think that the onboard A/D is good enough for audio ?

Andrew
Title: Re: MICROHIP
Post by: Dave_B on November 20, 2005, 09:03:49 PM
Quote from: The Tone God on November 20, 2005, 08:33:26 PM
I hope you don't think that the onboard A/D is good enough for audio ?
I've use it to read knobs.  Has anyone ever tried to use it for audio?  It's limited to 10-bits, so probably not anything other than novelty stuff.
Title: Re: MICROHIP
Post by: The Tone God on November 20, 2005, 09:09:22 PM
Quote from: bellyflop on November 20, 2005, 09:03:49 PM
I've use it to read knobs.  Has anyone ever tried to use it for audio?  It's limited to 10-bits, so probably not anything other than novelty stuff.

Knob reading and things of that sort is fine. Audio...I wouldn't even try. Just was checking that you weren't getting your hopes up.

Andrew
Title: Re: MICROHIP
Post by: Peter Snowberg on November 20, 2005, 09:18:54 PM
If you want to get your hopes up about using PICs for digital audio, grab an outboard CODEC or a pair of the Wavefront A/D & D/As and a dsPIC30F4013. 8)

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1335&dDocName=en010345

http://www.microchip.com/ParamChartSearch/chart.aspx?branchID=8071&mid=14&lang=en&pageId=75
Title: Re: MICROHIP
Post by: MR COFFEE on November 26, 2005, 11:29:07 PM
Thanks for the informative discussion, guys. Its been great to eavesdrop on.

Looks to me like the PIC '628 or '683 might do for the envelope follower project and even output a control voltage via the PWM. A software Bissell EF.

I'm going to have to check out the Atmel parts you are so keen about, Peter.

Thanks again guys.
Title: Re: MICROHIP
Post by: Hal on November 27, 2005, 02:53:51 AM
I think the 16f88 replaced the 16f628 as the new mid-level standard part.  Its the same way they phased out the 16f84a's, better prices, more features, almsot backwards capatable...

I read an article in nuts and volts a while back about doing DSP with pics.  I need to find it again.  IIRC, it was centered around a certain dev board, though.
Title: Re: MICROHIP
Post by: Dave_B on November 27, 2005, 08:55:12 AM
That's what I read too, Hal.  I bought a few 16f88's from glitchbuster.com to get the basics down and test my homemade programmer. 

Unfortunately, if a person is really starting out with zero knowledge, there doesn't appear to be much plug-n-play code for the 16f88.  A little bit of reading will get you past that point, but I appreciate that sometimes folks just need to prove the hardware works before moving up to the "Hello World" phase. 

On the same topic, it's amazing how you can be working feverishly on something, then lose all interest when a minor problem crops up.  My programmer has become intermittent over the last week after working flawlessly for a couple of months.  I recently added a full-size 70's era stereo to my workbench and it just occurred to me that the problems started around that time... 
Title: Re: MICROHIP
Post by: Hal on November 27, 2005, 09:23:02 PM
Quote from: bellyflop on November 27, 2005, 08:55:12 AM
On the same topic, it's amazing how you can be working feverishly on something, then lose all interest when a minor problem crops up. 

yea, i have massive project add