EmbeddedRelated.com
Forums
Memfault Beyond the Launch

Need help programming a PIC16F72 in C

Started by Jason Hsu September 1, 2008
I'm trying to program a PIC16F72 microcontroller in C.  But I keep
reaching dead-ends.  The trouble with trying out different solutions
is that it takes time to keep up with all of them as well as to
implement them properly.

I'd like to hear from those of you who have successfully programmed
PIC16F72 microcontrollers (or similar) in C with a computer setup
similar to mine.

I have three computers:
1.  An old desktop (from 2000) with Windows 98: Yes, I know that
Windows 98 is obsolete and has inferior security.  That's why I bought
a used desktop and installed Linux on it so I could get onto the
Internet without relying on inferior Windows security.  I use the old
Win98-equipped computer strictly offline.
2.  A slightly newer desktop (bought used) with Damn Small Linux
3.  A 2-year-old laptop with Windows XP: (I bought it for digital
modes for amateur radio.)

I have successfully used MPLAB to program this microcontroller with
Assembly language in Windows 98 and XP.

I have been able to get PICC-LITE to work, but the most sophisticated
microcontroller it's compatible with seems to be the PIC16F84.

I tried installing GPSIM and GPUTILS on my Linux computer, but
dependency hell kept things from working properly.

I installed SDCC on my Win98 computer, and it seems to work.  But I'm
having trouble with GPSIM.  When I type the command GPSIM in DOS, I
get a message saying that the LIBGTK-WIN32-2.0-0.0.DLL file is linked
to missing export COMDLG32.DLL:PrintDlgExW .  I have no idea what this
mumbo-jumbo means.

Has anyone here successfully programmed a PIC16 microcontroller (more
sophisticated than the PIC16F84) in C using Windows 98, Windows XP, or
Damn Small Linux?  Exactly which programs do you use?  What tutorials
did you use to get started?  What I'm trying to do is copy what
already works for someone with a similar setup.

--
Jason Hsu
http://www.jasonhsu.com/swrwatt.html
http://www.jasonhsu.com/swrwatt-source_code.txt
NOTE: I am seeking employment as an embedded electronics engineer.
On Mon, 1 Sep 2008 14:20:51 -0700 (PDT), Jason Hsu
<jason_hsu@my-deja.com> wrote:

>I installed SDCC on my Win98 computer, and it seems to work. But I'm >having trouble with GPSIM. When I type the command GPSIM in DOS, I >get a message saying that the LIBGTK-WIN32-2.0-0.0.DLL file is linked >to missing export COMDLG32.DLL:PrintDlgExW . I have no idea what this >mumbo-jumbo means.
WRT GPSIM, I pretty much agree with this rant stolen from http://www.noicedebugger.com/help/faq.htm "What's the matter with simulators? "Personal bias. I have been an embedded systems programmer for over 25 years. I wrote NoICE for my own use, and I prefer to debug on real hardware whenever possible. Most embedded processors are used to control specialized external hardware, which is often difficult or impossible to simulate exactly. "Instruction set simulation is quite straightforward, and that is what the NoICE simulator supports. However, simulating the UARTs, timers, and other peripherals found on current microprocessors is a very complex task - at least, if you want a good (i.e., useful) simulation. The cycle-by-cycle operation of these peripherals is seldom publicly documented, and anything less than a cycle-by-cycle simulation will mask the problems which occur in real systems." Don't get into the trap of depending on a simulator to tell you what's happening. I find them to be occasionally useful to check my understanding of an instruction set, watching the registers until the brain-light goes on. However, with so much embedded programming being C-based, there's often not much need to grok an instruction set that deeply. The architecture, yes; details of asm instructions, not so much.
>Has anyone here successfully programmed a PIC16 microcontroller (more >sophisticated than the PIC16F84) in C using Windows 98, Windows XP, or >Damn Small Linux? Exactly which programs do you use? What tutorials >did you use to get started? What I'm trying to do is copy what >already works for someone with a similar setup.
My general approach to bringing up a new processor and toolchain is an embedded version of Hello, World! where I just toggle a selected GPIO pin at 1 Hz based on a timer interrupt. That involves successfully solving the mechanics of compiling and loading runnable code, understanding how interrupts are handled and initialized, how to talk to the device peripherals, and how to configure the GPIO pins. Once that's done, the rest is just application development. If you've got SDCC working, you're basically good to go. -- Rich Webb Norfolk, VA
On Sep 1, 5:20=A0pm, Jason Hsu <jason_...@my-deja.com> wrote:
> I'm trying to program a PIC16F72 microcontroller in C. =A0But I keep > reaching dead-ends. =A0The trouble with trying out different solutions
The first question I reslly have to ask is - why are you trying to do this? The "no strings attached" sections of craigslist will hook you up with all the dominatrices you could hope to experience in a lifetime. And if you don't enjoy being tied to a bed of red-hot coals with barbed wire and being whipped with a salted licorice rope, why are you inflicting the PIC family on yourself? Having said that - If you go to microchip.com, download MPLAB 8.14 interim release, and download the PICC demo version, it all "just works". I would not attempt to do this under any OS besides Windows XP - such an attempt adds extreme body modification to the mere physical torture.
On Mon, 1 Sep 2008 15:24:04 -0700 (PDT), larwe <zwsdotcom@gmail.com>
wrote:

>On Sep 1, 5:20&#4294967295;pm, Jason Hsu <jason_...@my-deja.com> wrote: >> I'm trying to program a PIC16F72 microcontroller in C. &#4294967295;But I keep >> reaching dead-ends. &#4294967295;The trouble with trying out different solutions > >The first question I reslly have to ask is - why are you trying to do >this? The "no strings attached" sections of craigslist will hook you >up with all the dominatrices you could hope to experience in a >lifetime. And if you don't enjoy being tied to a bed of red-hot coals >with barbed wire and being whipped with a salted licorice rope, why >are you inflicting the PIC family on yourself?
Lovely rant on the PIC family in <http://groups.google.com/group/comp.arch.embedded/msg/c8480f9711574df7> -- Rich Webb Norfolk, VA

Memfault Beyond the Launch