The Godfather talking
Share your stuff or I will make you regret it.
Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
April 19, 2024, 08:39:05 08:39


Login with username, password and session length


Pages: [1]
Print
Author Topic: SPI(software based) code or refrenece needed for AT89c51  (Read 3557 times)
0 Members and 1 Guest are viewing this topic.
tension885
Guest
« on: April 06, 2008, 06:44:30 18: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, 04:03:11 04: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