PIC Programming?
Moderators: pompeiisneaks, Colossal
- JazzGuitarGimp
- Posts: 2357
- Joined: Mon Jul 23, 2012 4:54 pm
- Location: Northern CA
PIC Programming?
Hi All,
I know some of you are wizard PIC programmers. I've been designing hardware for years, but I've never taken the time to learn how to code. I am wondering if any of you could point me in the direction of a concise tutorial on programming PIC procs. I know absolutely nothing about this, so the tutorial is going to have to start from square one. I am running Windows XP Pro, SP 3 on a MAC Mini, so if you could also point me in the direction of the necessary hardware and software (USB cabling, please), I would really appreciate it. I am wanting to write a program that reads an optical rotary encoder to control the Texas Instruments PGA2311 Stereo Volume chip. Maybe down the road, I can learn to program a logarithmic taper response.
Cheers,
Lou
I know some of you are wizard PIC programmers. I've been designing hardware for years, but I've never taken the time to learn how to code. I am wondering if any of you could point me in the direction of a concise tutorial on programming PIC procs. I know absolutely nothing about this, so the tutorial is going to have to start from square one. I am running Windows XP Pro, SP 3 on a MAC Mini, so if you could also point me in the direction of the necessary hardware and software (USB cabling, please), I would really appreciate it. I am wanting to write a program that reads an optical rotary encoder to control the Texas Instruments PGA2311 Stereo Volume chip. Maybe down the road, I can learn to program a logarithmic taper response.
Cheers,
Lou
Lou Rossi Designs
Printed Circuit Design & Layout,
and Schematic Capture
Printed Circuit Design & Layout,
and Schematic Capture
Re: PIC Programming?
You'll need a copy of MPLAB:
http://www.microchip.com/pagehandler/en ... ly/mplabx/
and a programmer of some sort. Sparkfun has good prices and development boards:
https://www.sparkfun.com/categories/6
https://www.sparkfun.com/categories/9
You'll also need to learn at least one language - C and PIC assembly would be a good pair.
Hope this helps!
http://www.microchip.com/pagehandler/en ... ly/mplabx/
and a programmer of some sort. Sparkfun has good prices and development boards:
https://www.sparkfun.com/categories/6
https://www.sparkfun.com/categories/9
You'll also need to learn at least one language - C and PIC assembly would be a good pair.
Hope this helps!
Re: PIC Programming?
Think I've something like "PIC for Dummies".....
I'm serious!
Re: PIC Programming?
See
http://en.wikipedia.org/wiki/Arduino
Super easy for beginners, large library of code already created by users.
http://en.wikipedia.org/wiki/Arduino
Super easy for beginners, large library of code already created by users.
I build and repair tube amps. http://amps.monkeymatic.com
Re: PIC Programming?
Forgot - there's a lot of user groups and libraries on th enet, bot for PIC and Arduino....
- JazzGuitarGimp
- Posts: 2357
- Joined: Mon Jul 23, 2012 4:54 pm
- Location: Northern CA
Re: PIC Programming?
Thanks everyone! In keeping with "the path of least resistance" axiom, I have ordered the Arduino Mega 2560 board. I didn't know about Arduino before today. It looks like an easy portal into programming.
Thanks again,
Lou
Thanks again,
Lou
Lou Rossi Designs
Printed Circuit Design & Layout,
and Schematic Capture
Printed Circuit Design & Layout,
and Schematic Capture
Re: PIC Programming?
The arduinos are great for playing around with, there are a gazillion tutorials on the web. Although I have not played around with them for the last two years, IIRC the hardest part I had was configuring the communication port on my old XP laptop and getting the usb driver to load...
I always wanted to use the PWM for a univibe type effect.
Ping LeftyStrat, I think he knows boatloads about the arduino.
I always wanted to use the PWM for a univibe type effect.
Ping LeftyStrat, I think he knows boatloads about the arduino.
- JazzGuitarGimp
- Posts: 2357
- Joined: Mon Jul 23, 2012 4:54 pm
- Location: Northern CA
Re: PIC Programming?
Thank you, John!
Cheers,
Lou
Cheers,
Lou
Lou Rossi Designs
Printed Circuit Design & Layout,
and Schematic Capture
Printed Circuit Design & Layout,
and Schematic Capture
-
Cliff Schecht
- Posts: 2629
- Joined: Wed Dec 30, 2009 7:32 am
- Location: Austin
- Contact:
Re: PIC Programming?
I'm relearning C++ for the umpteenth time but this time I plan on making it stick. I've been able to read C/C++ code for years but when it comes time to write it, it's been like pulling teeth in the past because I put up this front of "oh I can't program and will never be able to". I've had to ditch that attitude and started forcing myself to watch some of the awesome tutorials available online. I'm about halfway through a series that breaks each topic down into one or many 6-8 minute tutorials and just got to a point where I'm really learning stuff again (currently on using pointers). The next step for me later this week is meeting up with one of my buddies that codes and having him give me some homework type questions to work through.
Lefty is an insanely great programmer and has been a fantastic resource as well. I try not to weigh him down with low level questions but if I have something more advanced that I'm stuck on or need direction on what to study, he's the guy I talk to.
Lefty is an insanely great programmer and has been a fantastic resource as well. I try not to weigh him down with low level questions but if I have something more advanced that I'm stuck on or need direction on what to study, he's the guy I talk to.
Cliff Schecht - Circuit P.I.
-
vibratoking
- Posts: 2640
- Joined: Tue Nov 10, 2009 9:55 pm
- Location: Colorado Springs, CO
Re: PIC Programming?
Cliff, your situation sound familiar. What tutorials are you working through? I think I'd like to do the same.
-
Cliff Schecht
- Posts: 2629
- Joined: Wed Dec 30, 2009 7:32 am
- Location: Austin
- Contact:
Re: PIC Programming?
So far I've been using this one on Youtube: https://www.youtube.com/playlist?list=P ... 8440AA6B83
Each video is 6-8 minutes and he covers every topic pretty quickly with some form of humor. I probably wouldn't recommend these vids for someone first learning a language but if you want a refresher that you can get through in a few days or so they're worth a watch. I'll watch 10 or so in a sitting and pontificate over what I learned for a while. Then I have my buddy sending me C++ problems to work through. It really helps to put what you learned to use - even if you're writing simple code it gets you thinking like a programmer (even if I am writing pretty inefficient software currently).
Once I get C++ down a bit better I'll move on to Verilog and start coding stuff that is synthesizable with standard logic gates. I can work with either Icarus (Verilog simulator) or through Altium which can synthesize logic and load it to an FPGA all in one software package. The latter is probably more meaningful because I can actually buy an FPGA development board and start developing different functional blocks to eventually string together into a larger system. The initial goal here is to understand the design flow from blank sheet to fully functioning and realizable logic that can be implemented via hardware. I don't think I'll have access to Synopsys quite yet but my ultimate goal is to understand the Synopsys design flow from start to finish which will make me much more versatile as an IC designer. Regardless just learning Verilog will open a whole lot of doors for me that would otherwise be closed. Might take a while to learn everything but I'll be damned if I fall into the same rut I was in before I went to work in Seattle.
Each video is 6-8 minutes and he covers every topic pretty quickly with some form of humor. I probably wouldn't recommend these vids for someone first learning a language but if you want a refresher that you can get through in a few days or so they're worth a watch. I'll watch 10 or so in a sitting and pontificate over what I learned for a while. Then I have my buddy sending me C++ problems to work through. It really helps to put what you learned to use - even if you're writing simple code it gets you thinking like a programmer (even if I am writing pretty inefficient software currently).
Once I get C++ down a bit better I'll move on to Verilog and start coding stuff that is synthesizable with standard logic gates. I can work with either Icarus (Verilog simulator) or through Altium which can synthesize logic and load it to an FPGA all in one software package. The latter is probably more meaningful because I can actually buy an FPGA development board and start developing different functional blocks to eventually string together into a larger system. The initial goal here is to understand the design flow from blank sheet to fully functioning and realizable logic that can be implemented via hardware. I don't think I'll have access to Synopsys quite yet but my ultimate goal is to understand the Synopsys design flow from start to finish which will make me much more versatile as an IC designer. Regardless just learning Verilog will open a whole lot of doors for me that would otherwise be closed. Might take a while to learn everything but I'll be damned if I fall into the same rut I was in before I went to work in Seattle.
Cliff Schecht - Circuit P.I.
Re: PIC Programming?
I use the CCS compiler which is ANSI C. I don't think they do a good job of explaining all their idiosyncratic crap needed to actually compile and make the thing work.
// Generic include files.
#include <18F6722.h> // Target device header file.
#device adc=10 // Specifies that PIC A/D converter will have 10 bits accuracy.
#fuses H4,PUT,NOWDT,NOBROWNOUT,NOPROTECT,MCLR,NOLVP
#use delay(clock=39321600)
// FAST_IO(n) forces port n to determine its direction only from set_tris_n() instructions.
#use FAST_IO(A)
#use FAST_IO(B)
#use FAST_IO(C)
#use FAST_IO(D)
#use FAST_IO(E)
#use FAST_IO(F)
#use FAST_IO(G)
// Generic include files.
#include <18F6722.h> // Target device header file.
#device adc=10 // Specifies that PIC A/D converter will have 10 bits accuracy.
#fuses H4,PUT,NOWDT,NOBROWNOUT,NOPROTECT,MCLR,NOLVP
#use delay(clock=39321600)
// FAST_IO(n) forces port n to determine its direction only from set_tris_n() instructions.
#use FAST_IO(A)
#use FAST_IO(B)
#use FAST_IO(C)
#use FAST_IO(D)
#use FAST_IO(E)
#use FAST_IO(F)
#use FAST_IO(G)
-
Cliff Schecht
- Posts: 2629
- Joined: Wed Dec 30, 2009 7:32 am
- Location: Austin
- Contact:
Re: PIC Programming?
The gist of my programming knowledge is with embedded systems/microcontrollers. The Arduino setup is probably the simplest I've used. Most real compiler suites have a decently steep learning curve though. Code composer and IAR workbench (which TI uses for MSP430) have idiosyncrasies that you have to learn to work with/around (setup and choosing the right options mostly) before you are cranking out programs. Same with the PIC stuff (that uses C), I tried learning the PIC software in a day at work once and realized that I completely wasted the day trying to get a port to blink an LED. That's why once I pick a platform, I tend to stick with it for a while. Learning new software can be full of unnecessary and unforeseen headaches when you just want to start writing code.
Even Codeblocks gave me a bit of trouble the first time I installed it. Took a few tries to figure out how to tell it where the actual compiler was located..
Even Codeblocks gave me a bit of trouble the first time I installed it. Took a few tries to figure out how to tell it where the actual compiler was located..
Cliff Schecht - Circuit P.I.