[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re: I2C

From: Jeff Mann   jeffjeffmann.com
Date: Sun, 29 Aug 2004 08:49:57 -0700

A! Sent via the Art & Robotics Group mailing list: arg-list@xxxxxxxxxxxxxxx
R! Use your "Reply All" to  reply to the list, "Reply" for private response
G!

Hi -

How do you program the 16F819, do you have a C compiler for it?

For programming the PIC in C, I would normally suggest the venerable PIC16F877A. There's a free version of the Hi-Tech C compiler available for it. It's the same as their $1500 commercial compiler, but it only works with the 16F877A, 16F628A, and a couple of other ones:

http://www.htsoft.com/products/PICClite.php

The 16F877 has hardware for i2c, but with a little more work you can also do it in software on the 16F628 if chip size is an issue. Note you can't run i2c over long cables... use RS485 or MIDI instead.

Otherwise, I would also recommend the 18F452 (or the 28-pin version, the 18F252). It's faster and easier to program in assembler, and costs about the same as the 16F877. Actually the pinout is the same, so if you build a board, it could work with either one. Definitely use the 18*F*452, the flash version. Sandor, you are needlessly torturing yourself with the 18C452 (which has to be erased with a UV lamp), the 18F452 works great.

The PicBasic Pro compiler is also really good, especially if you've used Basic Stamps. It works with all PICs, $249US.

Another thing is that I find an In-Circuit-Debugger to be absolutely invaluable. You can stop the program anywhere and read the values of all your variables to see what's going on. I have the Microchip ICD-2, but I've heard the one from Olimex is ok, and much cheaper.

Finally, you should think about using the Atmel Atmega instead of the PIC, because it works with the GNU C-compiler (gcc). You can get a whole tool-chain of free software development tools - and you don't have to run Windows. At the moment I'm programming PICs using VirtualPC on my Mac, and it's a pain... but I've already invested too much in the PIC to easily switch over now.

cu later <Jeff


Sandor Ajzenstat wrote:
A! Sent via the Art & Robotics Group mailing list: arg-list@xxxxxxxxxxxxxxx
R! Use your "Reply All" to  reply to the list, "Reply" for private response
G!

Hey Victoria,

I would like to recommend the PIC18C452.  My approach has been to choose
this one PIC and stick with it and I've been very happy with it.

Features:

- 40 pin DIP runs at a max clock speed of 40 Mhz.
- 32 K of  8-bit program memory
- 1.4K of data memory.
- A/D converter, 8 Analog inputs.  10-bit resolution.
- IC2 interface supports master, multi-master and slave modes.
- Asynchronous serial I/O
- Three 16-bit timers and one 8-bit timer.
- Two Capure/Compare  Pulse Width Modulation modules.
- 8 bit hardware multiplier instruction executes in a single instruction
cycle.
- Parallel slave port can directly interface to an 8-bit microprocessor data
bus.


Notes:

I don't know C, so I can't speak for running C code on this chip.

I've never worked with IC2 so I can't speak for its implementation in this
chip, although they sure spend lots of pages in the data sheet discussing
it.

Machine code programming is made easier in this chip than in other PICs by
the fact that you almost never need to be concerned with page boundaries.

There is a flash version, the PIC18F452.  Personally I will not use those
chips because I spent far too long trying to get the tiniest peep out of
them with zero success.  Either I was doing something wrong, or the chips I
was using were at fault. If it was infact the chips, then perhaps they've
fixed the problem in more recent stock.

The data sheet I have for the 18C452 is serial number DS39026B.  It is
riddled with typos and errors.  I haven't looked around on the Microchip
site recently to see if there are any erratta sheets, there weren't when I
downloaded it. Besides the errors, the data sheet is just plain badly
written.  It is truely the worst manual I hope to ever come across.
Hopefully they've updated it.

I would be more than happy to try to answer any questions you might have
pertaining to the 18C452.

It's great to hear from you Victoria,
Take care,
Sandor







(There is a flash version 18F452, and I'm sure it's fine, but I've
personally never gotten it to work)
----- Original Message -----
From: "Victoria Scott" <toria@xxxxxxxxxxxxxx>
To: <arg-list@xxxxxxxxxxxxxxx>
Sent: Saturday, August 28, 2004 6:09 PM
Subject: ARG: I2C



A! Sent via the Art & Robotics Group mailing list:

arg-list@xxxxxxxxxxxxxxx

R! Use your "Reply All" to reply to the list, "Reply" for private

response

G!

Hey ARG,

Nice to see that the list is perking up again, must signify the end of
summer fuzziness.

I'm trying to control six devices (wee 'robots' each programmed with
the 16F819 to move a stepper 180 degrees) with synchronous serial
communication, maybe with I2C.

So I have my slaves lined up, but i need a good Master (I never tire of
electronics metaphors).

Does anyone have a favorite PIC flavour for such a task. The Master
will also be receiving a sensor input (most likely a photocell), so
AtoD is also a necessary requirement.

I'm still in the throes of leaning C and only been working with the PIC
for a year (self taught at this point) so go easy please.

best.victoria


A! R! messages saved at http://www.interaccess.org/arg/arg-list.html G! unsubscribe/help requests to mailto:Majordomo@xxxxxxxxxxxxxxx



A! R! messages saved at http://www.interaccess.org/arg/arg-list.html G! unsubscribe/help requests to mailto:Majordomo@xxxxxxxxxxxxxxx



A!
R!      messages saved at http://www.interaccess.org/arg/arg-list.html
G!      unsubscribe/help requests to mailto:Majordomo@xxxxxxxxxxxxxxx