Need help programming a PIC16F72 in C

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

formatting link
formatting link
NOTE: I am seeking employment as an embedded electronics engineer.

Reply to
Jason Hsu
Loading thread data ...

WRT GPSIM, I pretty much agree with this rant stolen from

formatting link

"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.

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
Reply to
Rich Webb

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.

Reply to
larwe

Lovely rant on the PIC family in

--
Rich Webb     Norfolk, VA
Reply to
Rich Webb

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.