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 22:29
Read: 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            01/01/70 00:00      
   What You Need to Do Yourself            01/01/70 00:00      
      need help - 93c46 using AT89s52 - mikroc            01/01/70 00:00      
         MikroC is unwise choice            01/01/70 00:00      
   help me with 93c46 and at89s52---MikroC            01/01/70 00:00      
      So check without scope - adjust code until testable            01/01/70 00:00      
         you have now 3 times asked help with 93c46/at89s52--MikroC            01/01/70 00:00      
            93c46/at89s52--MikroC            01/01/70 00:00      
               my suggestion            01/01/70 00:00      
               You have already been given suggestions            01/01/70 00:00      
                  help me with 93c46 and at89s52---MikroC            01/01/70 00:00      
                     Use a proper Compiler            01/01/70 00:00      
                        I wanna, I wanna, I wanna,            01/01/70 00:00      
                     Time to actually prove your logic and your delays            01/01/70 00:00      
                        ----thanks all for helping out            01/01/70 00:00      
                           do you REALLY expect ....            01/01/70 00:00      
                     If you can't get MikroC to work ...            01/01/70 00:00      
                        switching to keil            01/01/70 00:00      
                           Example code on this website            01/01/70 00:00      
                           why, oh why            01/01/70 00:00      

Back to Subject List