|
|
View previous topic :: View next topic |
Author |
Message |
rafaluc
Joined: 12 Apr 2006 Posts: 6
|
Microware 93S46 driver |
Posted: Mon Sep 06, 2010 2:21 pm |
|
|
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
|
Microware 93S46 driver |
Posted: Thu Sep 09, 2010 6:28 pm |
|
|
How to do to write in eeprom 93S46?
some idea, please help!!!!! |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Thu Sep 09, 2010 7:20 pm |
|
|
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
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
Ttelmah |
Posted: Fri Oct 01, 2010 7:32 am |
|
|
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
|
rafaluc |
Posted: Mon Oct 04, 2010 5:22 am |
|
|
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? |
|
|
|
|
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
|