Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 10, 2016, 02:07:01 02:07


Login with username, password and session length


Pages: [1]
Print
Author Topic: SPI(software based) code or refrenece needed for AT89c51  (Read 1257 times)
0 Members and 1 Guest are viewing this topic.
tension885
Guest
« on: April 06, 2008, 07:44:30 19:44 »

hi,
i need some good reference or sample code for software based SPI
for AT89c51 (only for master side).i have searched but not getting code or reference which show how to implement SPI in software. so please help me with your valuable
suggestions and ideas or experience.
also what is SPI mode 0,0 and 1,1?? how they will be implemented in software?

please do reply  Cry Cry Cry
Logged
Epegic
Newbie
*
Offline Offline

Posts: 7

Thank You
-Given: 0
-Receive: 0


« Reply #1 on: April 09, 2008, 05:03:11 05:03 »

You may try and modify the following code fragment. It was used on drive N3310 phone LCD.   


#ifdef SoftSPI
// send one byte (command or data) to display controller
void lcdSendByte(uint8 outByte) {
   uint8 i;
Senable = Low;                  // chip select, active low
for (i=0; i<8; i++) {
   // strip off msb
   if (outByte & 0x80) Sdata = High;
   else Sdata = Low;
   // strobe clock
   Sclock = High;
   Sclock = Low;
   // prepare for next bit
   outByte <<= 1;
   }
Senable = High;
}
   #endif
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC