Sign in

Not a member? | Forgot your Password?

Search piclist

Search tips

Subscribe to piclist

Free PDF Downloads

Advanced Linux Programming

What Every Programmer Should Know About Memory

Introduction to Embedded Systems

C++ Tutorial

Embedded Systems - Theory and Design Methodology

Microcontroller Programming and Interfacing

Introduction to Microcontrollers


More Free PDF Downloads

Discussion Groups

See Also

ElectronicsDSPFPGA

Find us on Facebook





Discussion Groups | Piclist | Programming a PIC16F72 microcontroller in C

A discussion group for the PICMicro microcontroller. Also called the Microchip PIC, this list is dedicated to the use and abuse of this fine, simple, microcontroller. Close to topic posts are welcome, ie. general electronics.

Programming a PIC16F72 microcontroller in C - Jason Hsu - Sep 1 17:33:05 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 D a m n 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
D a m n 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, AA0II
http://www.jasonhsu.com/
I am seeking a position as an embedded engineer and would appreciate
any leads.


Re: Programming a PIC16F72 microcontroller in C - "John J. McDonough, WB8RCR" - Sep 1 17:44:46 2008

The PIC16's are a poor choice for C, but I have successfully programmed a
PIC16F88 using SDCC on Linux (Fedora). It took a little dancing around to
get memory sorted on the PIC16 but it did work just fine. It went quite a
bit easier with a PIC18F1320.

As you have figured out, though, if your distro doesn't have yum or
something similar, getting anything installed on Linux can be quite a
challenge.

I have just written a draft release note for Fedora 10's amateur radio apps.
It has a link to F10's embedded development apps which I am still working
on. Fedora does include gputils and gpsim in the distro, so you avoid all
the dependency issues. It also includes SDCC but the version curently
packaged is 2.6.0. I haven't had the time to be sure, but at this point I'm
feeling like SDCC 2.8.0 is a step backwards from 2.6.0, so maybe 2.6.0 isn't
such a bad thing. I had 2.6.0, 2.7.0 and 2.8.0 installed on FC6 before I
caught it in the F8 distro, and I installed those from tarballs without
incident. But DSL is pretty light on frills, so you may well spend months
resolving the dependencies.

72/73 de WB8RCR http://www.qsl.net/wb8rcr
didileydadidah QRP-L #1446 Code Warriors #35

----- Original Message -----
From: "Jason Hsu"
To:
Sent: Monday, September 01, 2008 5:32 PM
Subject: [piclist] Programming a PIC16F72 microcontroller 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 D a m n 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
> D a m n 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, AA0II
> http://www.jasonhsu.com/
> I am seeking a position as an embedded engineer and would appreciate
> any leads.
>
>
> to unsubscribe, go to http://www.yahoogroups.com and follow the
> instructions

_____________________________
 Free pdf download: What Every Programmer Should Know About Memory.


Re: Programming a PIC16F72 microcontroller in C - Staiger - Sep 2 5:26:44 2008

> Has anyone here successfully programmed a PIC16 microcontroller (more
> sophisticated than the PIC16F84) in C............

Yes, I've written several programs in C for the 16F818. I use MP-LAB in Windows
XP, a PICStartPlus programmer and the SourceBoost C compiler:

http://www.sourceboost.com/

So far it's been great.

It's also worth pointing out that Hi-Tech C Pro:

http://www.sourceboost.com/

.......is now available in 'Lite' mode, which supports all 16-family PICS. I've installed it
but not tried it out yet. In truth, they are both quite similar; SourceBoost state that
they are aiming to compete with Hi-Tech.

Having used 'C', which removes most of the hassle associated with banked
memory, there's no way I'd want to go back to assembler programming. OK, it's
"macho" and fun, but my productivity is 'C' is far higher.

Staiger


Re: Programming a PIC16F72 microcontroller in C - rtstofer - Sep 3 11:39:33 2008

I use Linux for almost all of my coding effort - EXCEPT PICs. It may
be that SDCC is finally working but the last time I looked,
development efforts for 14 bit PICs was abandoned.

So, I use cc5x (the demo version) and I have used it under Win98,
Win2k and WinXP. It supports the 16F72 and I have personally used it
for the 16F877(A), 16F88 (my favorite), 16F628 and probably a couple
of others.

Go to http://www.bknd.com/cc5x/ and have a look.

I have also used PIC C Lite with great success but I believe I used it
on just the 16F877.

Richard



Re: Programming a PIC16F72 microcontroller in C - Dennis Clark - Sep 3 12:10:51 2008

> I use Linux for almost all of my coding effort - EXCEPT PICs. It may
> be that SDCC is finally working but the last time I looked,
> development efforts for 14 bit PICs was abandoned.
>
> So, I use cc5x (the demo version) and I have used it under Win98,
> Win2k and WinXP. It supports the 16F72 and I have personally used it
> for the 16F877(A), 16F88 (my favorite), 16F628 and probably a couple
> of others.
>
> Go to http://www.bknd.com/cc5x/ and have a look.
>
> I have also used PIC C Lite with great success but I believe I used it
> on just the 16F877.

I use CCS C compiler for my PIC C stuff on the 14 bit cores usually
(when I don't just use assembly, which is more common.) Their compiler
is about $150 and it runs in Linux native. I don't think that they have
an IDE for Linux, but they might. Regardless, if you have a Linux
native PIC programmer then this is the way to go.

DLC

> Richard
>
>
>
> to unsubscribe, go to http://www.yahoogroups.com and follow the
> instructions

_____________________________
 Free pdf download: What Every Programmer Should Know About Memory.


Re: Programming a PIC16F72 microcontroller in C - rtstofer - Sep 4 11:19:53 2008

--- In p..., "Dennis Clark" wrote:

> I use CCS C compiler for my PIC C stuff on the 14 bit cores usually
> (when I don't just use assembly, which is more common.) Their compiler
> is about $150 and it runs in Linux native. I don't think that they have
> an IDE for Linux, but they might. Regardless, if you have a Linux
> native PIC programmer then this is the way to go.
>
> DLC
>

Very interesting! That means I could use CCS C with the Ecliplse IDE
and, presumably, standard makefiles.

t would be very nice to do Arm, AVR, PIC and all the other stuff with
the same environment.

Richard


_____________________________
 Free pdf download: Advanced Linux Programming.


Re: Programming a PIC16F72 microcontroller in C - Jason Hsu - Sep 5 9:53:10 2008

Thanks for the suggestions.

I finally found a solution that works for me: the free version of
HI-TECH C PRO (not to be confused with PICC-LITE) with MPLAB 8.10 and
Windows XP. HI-TECH C PRO does not work with Windows 98.

I am still interested in programming PIC microcontrollers in D a m n
Small Linux, and I will revisit that and tackle the "dependency hell"
issues at a later date.

Jason Hsu, AA0II
http://www.jasonhsu.com/
I am seeking a position as an embedded engineer and would appreciate
any leads.


_____________________________
 Free pdf download: Introduction to Embedded Systems.


Re: Programming a PIC16F72 microcontroller in C - jvoytovich - Sep 8 8:02:25 2008

Yeah, I've come in to this discussion late, but the last posting
mentioning that you're looking for an embedded position raised some
issues. I did a quick lookup on the 16F72 chip and noticed that it
does not include some features that you probably would want to become
familiar with, such as EEPROM, an internal oscillator, and UART and
SPI peripheral interfaces. Also, unless you'll be working with some
EXTREMELY cost conscious products, I'd go with the 18F family, which
has more generous memory and peripheral allotments.

I've worked doing embedded programming, and unless you'll be working
with totally self-contained unit, some form of external communications
will almost always be necessary. Becoming familiar with at least some
of the simpler protocols would prove to be very useful. Even without
external communications, there are many peripheral ICs that use SPI
for an interface. I'm currently working on connecting to a chip that
measures relative humidity that has an SPI output. Of course, you can
do that with software on the 16F72, but learning how the SPI module
works will be useful when you need more speed for other chip types.

Also, a lot of the 16F family can be upgraded to 18F with an actual
drop in chip price, since 18F uses a newer technology (Microchip sales
explanation). I've got a board that uses 16F877 that could see a
savings of about 20% if I had the ok to redesign the board (the 877
used is a PLCC).

AND with an 18F you can use the free Microchip compiler and not worry
about going to an outside source.

Hope I didn't start you thinking TOO much about more changes, but this
is just like work when the boss comes in after you've laid out the
whole project and says "...I think we need to change this..."

I saw your SWR project; looks good!

Good luck on the job search.

Joe



Re: Programming a PIC16F72 microcontroller in C - jvoytovich - Sep 8 8:05:11 2008

I've used the old Hi-Tech C compiler (program and RAM size limited)
for the 16F877 on a few work projects, and I was very impressed with
the small code that it generated. There is NO way to do that by
hand-coding with assembler. It allows you to focus on the application
and not on the implementation (bank switching, etc).

I've also taken a look at the new Hi-Tech Lite version (which works
without optimization - they have to hook you somehow), and noticed
something rather interesting. Loading a 2 byte INT variable takes 4
lines of program space, whereas loading a single byte CHAR variable
takes 5 bytes. And the compiler generates a message that the final
program size of 24 bytes could be 12 bytes smaller with optimization.

I guess there's no free lunch...

Oh, and the HT web site is at www.htsoft.com

--- In p..., "Staiger" wrote:
>
> > Has anyone here successfully programmed a PIC16 microcontroller (more
> > sophisticated than the PIC16F84) in C............
>


_____________________________
 Free pdf download: Introduction to Embedded Systems.