Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Thread Tools Display Modes
Old 14th February 2008, 07:19 AM   (permalink)
Default Wanna some tutorials on spi

Hi everyone,
i want some tutorials on spi in C.i am using two pic16f877a controllers.any simple tutorials like blinking leds.i have no concept of spi.please help me out if u guys have any information.
Thanx
hayee is offline   Reply With Quote
Old 14th February 2008, 07:22 AM   (permalink)
Default

This is a Micorchip reference. It's in assembler but it's a good overview on the SPI interface of PICs. If you understand how SPI works, it should be trivial to re-write the routines in C.

Last edited by eng1; 14th February 2008 at 07:28 AM.
eng1 is online now   Reply With Quote
Old 14th February 2008, 07:29 AM   (permalink)
Default

Thankx eng1.
I have already seen that file but i cant understand this.plz give me other links that r in C.i have no knowledge of assembly
hayee is offline   Reply With Quote
Old 14th February 2008, 09:33 AM   (permalink)
Smile Well...

Hi,

Simple...

http://www.best-microcontroller-proj...interface.html

Regards,

Simran..
__________________
Simran..
8051 Specialist..
simrantogether is offline   Reply With Quote
Old 17th February 2008, 05:58 AM   (permalink)
Default

Yes, there seams to be a lack of actual example code for SPI and if you can find some it's usually in asm. Here a some code written in C for Atmel.If anyone knows of more please share.
http://books.google.com/books?id=0vm...O3O0#PPA403,M1
firewater is offline   Reply With Quote
Old 17th February 2008, 06:31 AM   (permalink)
Default

Here's the Master asm code (page 32 of this) in C18.
Code:
void main(){
unsigned char Count=0;
unsigned char Dummy;
    TRISA=0;
    ADCON1=0x06;
    TRISC=0x10;
    SSPSTAT=0x40;
    SSPCON=0x31;
    while(1){
        LATAbits.LATA2=1;
        SSPBUF=Count++;
        while(!SSPSTATbits.BF);
        Dummy=SSPBUF;
        LATAbits.LATA2=0;
        DelaymS(100);
    }
}
By comparing the two, you should be able to convert the slave code as well.

Mike.
Pommie is offline   Reply With Quote
Old 17th February 2008, 09:30 AM   (permalink)
Default

Quote:
Originally Posted by hayee
Hi everyone,
i want some tutorials on spi in C.i am using two pic16f877a controllers.any simple tutorials like blinking leds.i have no concept of spi.please help me out if u guys have any information.
Thanx
Here is a link for CCS C tutorials.. It covers nearly everything to do with PIC programming, from turning ON and OFF LED to UART to SPI to LCD and others..

Hope that helps..
MrNobody is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Latest
SPI Testing with ENC28J60 mikesmixes777 Micro Controllers 9 17th January 2008 07:41 AM
DS1302 Real time clock questions, PIC18F2620 SPI mode and mcu memory usage ssylee Micro Controllers 2 18th December 2007 06:37 AM
Both parallel and spi in PIC microcontroller PLEASE HELP jitun2 Micro Controllers 12 24th October 2007 02:08 PM
Configuration Bits (Nigel's tutorials and Inchworm) lpinkai Micro Controllers 7 23rd January 2007 05:38 PM
Tutorials for PIC? falleafd Micro Controllers 14 7th July 2003 02:12 PM



All times are GMT. The time now is 09:04 AM.


Electronic Circuits  |  Electronics Wiki
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.