CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Microware 93S46 driver

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
rafaluc



Joined: 12 Apr 2006
Posts: 6

View user's profile Send private message

Microware 93S46 driver
PostPosted: Mon Sep 06, 2010 2:21 pm     Reply with quote

What does for the driver need below to write a 93S46?

Would anybody help please?
Code:

#ifndef EEPROM_SELECT
#define EEPROM_SELECT PIN_B0
#define EEPROM_CLK    PIN_B1
#define EEPROM_DI     PIN_B2
#define EEPROM_DO     PIN_B3

#define EEPROM_VSS    PIN_B4
#define EEPROM_W      PIN_B5
#define EEPROM_PRE    PIN_B6
#define EEPROM_VDD    PIN_B7
#endif

#define EEPROM_ADDRESS BYTE
#define EEPROM_SIZE    64

void init_ext_eeprom() { //93S46 16 BITS
   byte cmd[2];
   byte i;
     
   cmd[0]=0x80;
   cmd[1]=0x9;

   for(i=1;i<=4;++i){
      shift_left(cmd,2,0); 
      }
     
   output_high(EEPROM_SELECT);
 
   for(i=1;i<=10;++i) {
      output_bit(EEPROM_DI, shift_left(cmd,2,0));
      output_high(EEPROM_CLK);
      output_low(EEPROM_CLK);
   }
   output_low(EEPROM_DI);
   output_low(EEPROM_SELECT);
}

void write_ext_eeprom(EEPROM_ADDRESS address, long int data) { //93S46 X 16 BITS
   byte cmd[4];
   byte i;

   cmd[0]=0;
   cmd[1]=0;
   cmd[2]=0;
   cmd[3]=0;
   
BIT_SET(cmd[3],7);
BIT_SET(cmd[3],5);

if(bit_test(address,5))BIT_SET(cmd[3],4);

if(bit_test(address,4))BIT_SET(cmd[3],3);
if(bit_test(address,3))BIT_SET(cmd[3],2);
if(bit_test(address,2))BIT_SET(cmd[3],1);
if(bit_test(address,1))BIT_SET(cmd[3],0);
if(bit_test(address,0))BIT_SET(cmd[2],7);

if(bit_test(data,15))BIT_SET(cmd[2],6); 
if(bit_test(data,14))BIT_SET(cmd[2],5);
if(bit_test(data,13))BIT_SET(cmd[2],4);
if(bit_test(data,12))BIT_SET(cmd[2],3);
if(bit_test(data,11))BIT_SET(cmd[2],2);
if(bit_test(data,10))BIT_SET(cmd[2],1);
if(bit_test(data,9))BIT_SET(cmd[2],0);
if(bit_test(data,8))BIT_SET(cmd[1],7);
if(bit_test(data,7))BIT_SET(cmd[1],6);
if(bit_test(data,6))BIT_SET(cmd[1],5);
if(bit_test(data,5))BIT_SET(cmd[1],4);
if(bit_test(data,4))BIT_SET(cmd[1],3);
if(bit_test(data,3))BIT_SET(cmd[1],2);
if(bit_test(data,2))BIT_SET(cmd[1],1);
if(bit_test(data,1))BIT_SET(cmd[1],0);
if(bit_test(data,0))BIT_SET(cmd[0],7);

    output_high(EEPROM_SELECT);

   for(i=1;i<=25;++i)
      {
      output_bit(EEPROM_DI, shift_left(cmd,4,0));

      output_high(EEPROM_CLK);
   delay_ms(1);
      output_low(EEPROM_CLK);
      }

   output_low(EEPROM_DI);
   output_low(EEPROM_SELECT);

 delay_ms(11);
}
rafaluc



Joined: 12 Apr 2006
Posts: 6

View user's profile Send private message

Microware 93S46 driver
PostPosted: Thu Sep 09, 2010 6:28 pm     Reply with quote

How to do to write in eeprom 93S46?
some idea, please help!!!!!
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Thu Sep 09, 2010 7:20 pm     Reply with quote

Can you post a link to the data sheet and/or manufacturer?
When I search on "Microware 93S46" there are no hits. The only hit that seems to match is the M93S46 of ST Microelectronics but that is too far off from your description to spend time on.
rafaluc



Joined: 12 Apr 2006
Posts: 6

View user's profile Send private message

Microware 93S46 driver
PostPosted: Fri Oct 01, 2010 6:55 am     Reply with quote

the driver that I ordered belongs to the 93c46 and me need of the 93S46 or 93CS46



try: http://www.pjrc.com/tech/8051/93CS46.pdf
Ttelmah



Joined: 11 Mar 2010
Posts: 19496

View user's profile Send private message

Ttelmah
PostPosted: Fri Oct 01, 2010 7:32 am     Reply with quote

The drivers should be the same.
Both devices use the same Microwire protocol, same commands, same size and block layout.

Best Wishes
rafaluc



Joined: 12 Apr 2006
Posts: 6

View user's profile Send private message

rafaluc
PostPosted: Mon Oct 04, 2010 5:22 am     Reply with quote

Then, the difference is that to 93S has the protected area!!!

How to modify the driver of the 93C46 to write in the protected area?
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group