Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/03/12 16:29
Read: 1676 times


 
#187607 - help me with 93c46 and at89s52---MikroC
sir, please help as am unable to get the desired output from the code below in Mikro C for 8051--

//define pin
sbit Chip_Select at P3.B7;
sbit SoftSpi_CLK at P3.B6;
sbit SoftSpi_SDI at P3.B5;
sbit SoftSpi_SDO at P3.B4;

unsigned char i;

void OP_ER_Enable(){
Chip_Select=1;
Soft_SPI_Write(1);
Soft_SPI_Write(0);
Soft_SPI_Write(0);
Soft_SPI_Write(0x60);
Chip_Select=0;
//DI=0;
}
void OP_Clear_Chip(){
Chip_Select=1;
Soft_SPI_Write(1);
Soft_SPI_Write(0);
Soft_SPI_Write(0);
Soft_SPI_Write(0x40);
Delay_ms(30);
Chip_Select=0;
//DI=0;
}
void WR_to_Chip(){
Chip_Select=1;
Soft_SPI_Write(1);
Soft_SPI_Write(0);
Soft_SPI_Write(1);
Soft_SPI_Write(0x00);
Soft_SPI_Write(0x28);
Chip_Select=0;
//DI=0;
}
unsigned char Read_from_Chip(){
unsigned char dtt=0;
Chip_Select=1;
Soft_SPI_Write(1);
Soft_SPI_Write(1);
Soft_SPI_Write(0);
Soft_SPI_Write(0x00);
i=0;
while(i<8)
{ dtt |= SoftSpi_SDO;
dtt <<= 1;
i++;
} return dtt;
Chip_Select=0;
//DI=0;
}


void main()
{
Soft_SPI_Init();
OP_ER_Enable();
//Delay_ms(30);
OP_Clear_Chip();
WR_to_Chip();
Delay_ms(30);
P0 = ~Read_from_Chip();
while(1)
{
//P2=0xff ;
for(i=0; i<8; i++)
{

P2=0xFE;
delay_ms(400);
}
}
}


at the moment, all the segments are being lighted..

List of 20 messages in thread
TopicAuthorDate
help me with 93c46 and at89s52---MikroC      Mandeep Singh      06/03/12 16:29      
   What You Need to Do Yourself        Michael Karas      06/03/12 17:33      
      need help - 93c46 using AT89s52 - mikroc      Mandeep Singh      06/09/12 04:59      
         MikroC is unwise choice      David Prentice      06/09/12 09:34      
   help me with 93c46 and at89s52---MikroC      Mandeep Singh      06/09/12 05:01      
      So check without scope - adjust code until testable      Per Westermark      06/09/12 06:04      
         you have now 3 times asked help with 93c46/at89s52--MikroC      Erik Malund      06/11/12 07:36      
            93c46/at89s52--MikroC      Mandeep Singh      06/11/12 10:36      
               my suggestion      Erik Malund      06/11/12 11:27      
               You have already been given suggestions      Per Westermark      06/11/12 11:55      
                  help me with 93c46 and at89s52---MikroC      Mandeep Singh      06/12/12 08:33      
                     Use a proper Compiler      David Prentice      06/12/12 08:42      
                        I wanna, I wanna, I wanna,      Erik Malund      06/12/12 09:15      
                     Time to actually prove your logic and your delays      Per Westermark      06/12/12 09:21      
                        ----thanks all for helping out      Mandeep Singh      06/12/12 10:54      
                           do you REALLY expect ....      Erik Malund      06/12/12 11:29      
                     If you can't get MikroC to work ...      Richard Erlacher      06/12/12 15:25      
                        switching to keil      Mandeep Singh      06/13/12 14:32      
                           Example code on this website      David Prentice      06/13/12 15:05      
                           why, oh why      Erik Malund      06/13/12 18:06      

Back to Subject List