News:

SMF for DIYStompboxes.com!

Main Menu

PIC of the litter

Started by Mark Hammer, September 12, 2017, 02:27:35 PM

Previous topic - Next topic

amz-fx

Mikro has compilers for a bunch of different microprocessors in several different languages:

https://www.mikroe.com/products/#compilers-software

Just pick the one that you want to use and give it a try. Basic, Pascal, C? They have them all. They also have demo versions that can compile up to 2k, which is plenty for a lot of pedal projects.

One hint is that even if you know the language that you are going to use, I find that some knowledge of assembly, ports, registers and other basic stuff about the microprocessor is essential in getting the project to work.

regards, Jack


Mark Hammer

Hootchie mama!!  Are you sure there's enough choice, there, Jack?  :icon_lol:

We covered all the ports, handshaking, registers, rising/falling edges in class back in 1982 (as a research psychologist, I had to learn about real-time control of lab equipment and data acquisition).  The clock speeds have changed significantly since then, but a lot of the basic stuff still holds, I gather.

Many thanks,
Mark

samhay

#22
Quote from: potul on September 13, 2017, 08:44:16 AM
The good thing about PICs is that there is a product for almost every need, depending on the project, and there is  a lot of information online.
On the other hand,  you really need a deep understanding of the hardware architecture of the device you are using, and this can be very time consuming.


This and this (my underlining).

I'm a PIC guy too. If you have some experience writing code in just about any language, then I don't think it will take long to pick up enough C to get a PIC to do something interesting and/or useful via the free microchip xc compilers.

As potul said, the major time suck is reading the data sheet. As an example, this is the datasheet for a fairly new 8-pin PIC, which I have used to generate LFOs, etc.
http://ww1.microchip.com/downloads/en/DeviceDoc/40001737C.pdf
It is 397 pages long.
Of course, you won't have to read all of it, but you will have to read enough to work out how to make use of the very cool peripherals that take care of PWM, ADC, etc.
I'm a refugee of the great dropbox purge of '17.
Project details (schematics, layouts, etc) are slowly being added here: http://samdump.wordpress.com

Mark Hammer

I think my mind got made up for me by happenstance.  When I got home from work, I dug out the Velleman PIC programmer I bought last year and discovered there was a 16F627A PIC sitting in foam that came with the programmer.  Seems to have enough in common with other MCUs that it's a reasonable place to start.  No shortage of support for it out there either.

PRR

> Joel and Steve frequently use microcontrollers to manipulate

Then go with what they do. Even throw that decision in their lap. If say Joel is hep for the XYZ987, then he will show you how to wire and code, and will know right-off if a Hammer bright-idea doesn't quite suit the XYZ987 as good as a HAL9001.

As R.G. says, they are not partnering you for 40 years of bit-boffing experience, but your decades of listening and music-theorizing. At some point you *can* show them a breadboard smothered in jumper-cables, lengthy re-patching, and if it has the ZING factor they'll work the control interfacing.

A point that I used to think was important (maybe less today): User Interface. My Stamp project was one button and one LED (and a relay). You can "easily" interface a 40x2 text display and bang it like a teletype, but that was ho-hum 25 years ago. Still ample for some things, way behind-times for other things in this icon-mad world. There are small graphic displays but I could see wasting a lot of time making-nice. OTOH an rPi direct-connects TV and such for rich display with standard computer interface, but won't fit in a Hammond.

And there is a trend to off-load the whole GUI through boo-tooth to a cellphone. But this immediately begs iPhone+Android, and O/S drift 5 6 7 8..? revisions..... And security: punk in the crowd or the other band reprograms your gear?

Which leads back to a Stamp with prototype area. Any amount of analog patching/parameters can be set on-the-fly with a button or two. The rig covers a bench but consolidation is chimp-work compared to innovation. This type BASIC is nearly pseudo-code already, so any C or Python geek can easily extract the key actions and wrap it up pretty.
  • SUPPORTER

Mark Hammer

I think that's all sage advice.  I think it behooves me to at least explore what is possible a bit, simply as a way of generating ideas I might not have thought of before.

One always needs to give serendipity a bit of a headstart, right?

amz-fx

An interesting thing about the Mikroe compilers is that they generate assembly code that is saved in a file and then compiled into the hex for use in programming.

Once you get to looking at the asm code, one computer language is about the same as the others, so use what you are comfortable with. There is not going to be any difference between Basic or C or Pascal once the final code is generated.

regards, Jack

amptramp

I have a Velleman K8048 kit that programs 8, 14, 18 and 28 pin PIC controllers.  It needs a Pentium PC with Windows from 95 to XP, a CDROM and a serial RS232 port that cannot be a USB to RS232 cable.  This looks like it is going to be a pain - I have a Dell Inspiron laptop connected to the internet but it has no RS232 port.  I have an older XP tower that is not currently connected to the internet but it might have an RS232 port.  I am not too sure how to get the programming done here.  This looks like it is going to be a pain to use.  The RS232 cable needs pins 3, 4, 5, 7, 8 and 9.  The 15 VDC adapter is something I can get.

Once I get the hardware sorted out, I can download code to program stuff.  PIC code seems a bit off-putting - I can see what they are doing but it all seems so awkward.  So I have a programmer and access to devices but I have no idea whether I will ever get anything done with it.

Mark Hammer

Exact same one I have.  I think we'll be PM-ing a bit in the future.

ElectricDruid

Welcome aboard, Mark! Glad to have more people exploring this sort of stuff! It's an exciting place to be for effects, and the combination of analog processing with digital control offers a lot of possibilities without having to turn everything into just another DSP algorithm.

Since it looks like you're heading PICwards, I'll add a couple of things to what other people have said.

The newer "enhanced" PICs with numbers that start 12F1xxx or 16F1xxx are a big improvement over the earlier chips. They're faster, they have more powerful peripherals, and they add several extremely useful instructions to the instructions set which fill in the holes that the early chips had (add with carry, for example).

People have mentioned PWM as a way of doing analog output, and that works. However, the NCO peripheral (where available) can be set up to do a better job, using Pulse Density Modulation rather than Pulse Width Modulation.

The best way of all of doing an analog output is using a DAC! Several of the newer chips include either 5-bit or 10-bit DACs which are very easy to use.

Finally, trying to use a Velleman programmer connected to a serial port is going to get old fast. A USB programmer will do the job quicker. I use a PICKit3, which is good and not too expensive, but there are clones which are cheaper.

HTH,
Tom


Digital Larry

Quote from: PRR on September 13, 2017, 07:07:34 PM
>
A point that I used to think was important (maybe less today): User Interface.

I don't think it's any less important today.  The ability to put text an graphical displays on pedals has made those units more flexible at the inevitable expense of usability.  There's a local guitar player I'm working with on some pedal ideas.  He currently owns a Z Vex thing a ma bob, which he told me "is totally tweakable, but I just always leave it on one setting".  So why not have that setting just be the one setting (for him and people who want to sound like him)?  I use the FV-1 a lot, and one of its inherent limitations is the number of knobs you can put on it to tweak parameters.  3 usually, 4 if you add some circuitry and code.  I can easily create patches that want MORE than that for full tweakability... but it can't be done.

so then I often do things like double controls on one pot, e.g. LFO width and scaled inversely, speed, for a chorus... but that means I have locked you out of super fast super wide (spaceship) sounds.  I'm sure it's the 5,000th time I've said it, but making these tradeoffs is IMO a way tougher decision than coming up with the sonic possibilities in the first place.  But since a simple FV-1 circuit (without a micro to drive it and save "presets") has these limitations that tilt it towards a performance rather than studio application, you have to make those tradeoffs.  There's no obvious formula to follow either, because my sensibilities about these things are personal and not guaranteed to match those of any other individual.  So that's one reason it's nice that DIY, where your target audience is just YOU, has come a long way since I was a kid.
Digital Larry
Want to quickly design your own effects patches for the Spin FV-1 DSP chip?
https://github.com/HolyCityAudio/SpinCAD-Designer

ElectricDruid

Totally agree with Larry. Never underestimate the UI! Especially on digital stuff where it's even easier to screw it up completely and have some hideous thing with ten modes accessed by multiple button presses or hold-for-two-seconds-while-standing-on-one-leg or press-X-while-holding-down-Y and so on. ARGGH!! So wrong. Adding the sophistication of a LCD display and actual words doesn't always make it better either - just encourages people to add every single parameter as an editable option, whereupon you're in that tedious world of trying to paint the hallway through the letterbox.
As Larry says, the hard choices about what gets tweaked and what doesn't are a big part of making something useable. Sometimes having limitations that force you to make those choices makes for a better design in the end. That's one of the reasons I still use a lot of 8-bit PICs. I *like* the fact I can't just sling the kitchen sink in there. Forces me to make my mind up about what's important and what's not, and that's crucial.


Tom

R.G.

I'll add a third to that. Historically, the user interface is the most difficult part of most programing applications. Even when the only user interface is a switch and an LED, it's usually the most difficult part.

That's because what you're doing is NOT making the part flip bits. You are crawilng inside the unknown user's head and trying to figure out how they can MIS-understand what that blinky light means. More sophisticated UIs just add more ways for them to get it wrong.

You're really trying to get a desired result from an unknown user, not just get the thing to work. And the human mind is the most complicated object in the known universe to date.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

merlinb

#33
Pic, PicKit, C, MPlab. Can't go wrong. Plus it's the most common sort of entry-level embedded programming you find in the industry (at least in UK). If you can program a PIC in C, someone will employ you.

PRR

> If you can program a PIC in C, someone will employ you.

Good advice; but Mark is retiring from work.

Which means he will be busier than when he worked.
  • SUPPORTER