Searching \ for 'SPI to PIC Interfacing' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ios.htm?key=spi
Search entire site for: 'SPI to PIC Interfacing'.

Truncated match.
PICList Thread
'SPI to PIC Interfacing'
1995\10\02@001612 by Tommy Brown

flavicon
face
Hi all, first of all an introduction, I am American, working overseas, as
Consultant.  Presently based in South East Asia, in Jakarta, Indonesia.
I support process controll equipment used in oilfield applications measuring
and acquiring data on flow, pressure, density, rheology, ph, temperature etc.
Also control applications such as mixing and injecting chemicals into a flow
line in controlled concentrations using open and closed loop controls, or
hydraulic speed controls using all sorts of controllers such as Z80, 8085,
6802, 68k etc.

I joined this list because I am very interested in the PIC microcontrollers.
I have been studying both the 94/95 Microchip Embedded Control handbook, and
the 94 microchip data books I got from the the distributor in Singapore.  I
have also retrieved every possible code sample snippets I could locate on
FTP locations in USA and Europe/UK.  I have Microchip mpasm, mpsim, as well
as the parallax variants, disasemblers for hex code back to
microchip/parallax source, info for building programmers, etc.  Also any
other software I found to be of any use, including PIC FAQ, FAQ's on
Parallel ports etc.  I am studying PIC code and writing short programs for
mpsim at present, to see how the code works.

I have been receiving the piclist for about two months now.  I wanted to see
what was discussed and what wasn't.  I am needing information on serial
communications between two or more SPI capable IC's and a PIC, and RS232 to a
comm port.  I have latest Microchip data and embedded manuals, I found
information on the I2C spec.  Unfortunately, what I am interested in is the
newer serial 14 and 16 bit ADC's that are available from Analog Devices and
Maxim.  I want the resolution you get with 14/16 bits, (If you measure 20,000
psi and need 1 psi accuracy, you know what I mean).  Both support SPI
interface, which are either 3 wire or four wire interfaces.  Analog Devices
or Maxim give timing diagrams and relative information on the AD itself
(command structure) etc.

Since I would like to avoid reinventing the wheel, I would like to know if
anyone out there on PICLIST, has interfaced SPI IC's to PIC's?  Any info on
pin connections between PIC and periferals?  How about Realtime Serial
communications with PIC and host Comm port?

What I am looking for is examples of code which I can use to help me understand
the SPI to PIC serial protocol better, as well as the serial comms also.

For example, I would like to do the following: send serial code over SPI
which acesses the device (usually you must also enable the chip select
also), normally
the code defines start of A/D Conversion, channel number to convert, mode of
device, etc., and then clocks the 14 or 16 bit binary number to multiple
data registers of the PIC RAM area, from one of these devices.  Since the
PIC ram area is only 8 bits wide, at a minimum, two 8 bit ram locations
would be needed for
each 14/16 bit data word.  Since I would like to use the multi channel
varients that means looping this routine n times before returning.  I don't
quite
understand how to split up the binary number received via the SPI and load
it into two places in RAM (You must also split off the leading and trailing
controll characters etc.

Once I have the 14 or 16 bit number in RAM, I would like to retrieve the 14
or 16 bit number from their respective RAM locations, assemble them as a
serial data stream of n channels of comma delimited data and send it out via
RS232 to a comm port.

I have found math examples that reference manipulating two 16 bit numbers,
to get
a 16 bit double precision number, but I would like to know what happens when
you have a 14 or 16 bit real binary number, split into 2 8 bit locations,
where least significant number is 8 bits, and most significant number is 6
bit with 2 leading zeros (for 14 bit) or 8 bits (for 16 bit).  How do you
put the number back
together before sending via RS232?

In Embedded controll, there are examples of using PIC to communicate via RS232
but the examples are using a lookup table to printout characters, and don't
really address my need to understand how to read ram and send via RS232 in
realtime.

All of examples I have found so far reference I2C and usually 8 bit data.

All of my experience is mainly hardware only, and with bytewide uP interfaces
using MUX to link multiple analog and digital inputs.  I didn't need to program
in software because the companies I worked, for wrote their own proprietary
software programs for their equipment.

As a hobby, I am now developing my own hardware and writing my own software.
I have experience with Fortran (IBM 370) and Basic programming (PC), some
assembly language (IBM 370), but has been some years since I did any
programming like
that (1980).  I chose the PIC because of it's RISC archtecture, small size,
little need for additional periferal components to get it up and running,
and reasonable development costs, and is available easily from electronic
jobbers, and it looks to be a good performer for my applications.

Thanks in advance, Tom Brown


********************************************************************************
* Tom Brown
E-Mail:spam_OUTtombrownTakeThisOuTspamindo.net.id  *
* Bumi Karang Indah                                Phone: 62-21-7508264        *
* Jalan Karang Asri II,       **************************************************
* Blok C2/#43, Lebak Bulus  *    "If somthing is worth doing,                 *
* Jakarta, Seletan 12440   *           It's worth doing right the first time"  *
* Indonesia               *                                                    *
********************************************************************************

More... (looser matching)
- Last day of these posts
- In 1995 , 1996 only
- Today
- New search...