bianchi77
Advanced Member level 4
- Joined
- Jun 11, 2009
- Messages
- 1,313
- Helped
- 21
- Reputation
- 44
- Reaction score
- 20
- Trophy points
- 1,318
- Location
- California
- Activity points
- 9,442
Code:void AT25_WritePage(uint address, //from this address; uchar num_of_byte, //the number(<32) of bytes to write; uchar* source //data to write. ) { uchar i=0; /* Filter the parameters */ if(num_of_byte>32) num_of_byte=32; //if(address>4096) address=0; if(address>8192) address=0; /* make sure that the device is write enabled */ AT25320_CS=0; _nop_(); SPI_WriteByte(WREN); AT25320_CS=1; _nop_(); _nop_(); /* write op_code,address and data into the device */ AT25320_CS=0; _nop_(); SPI_WriteByte(WRITE); //op_code SPI_WriteByte((uchar)(address >>8)); SPI_WriteByte((uchar)(address)); for(i=0;i<num_of_byte;i++) { SPI_WriteByte(*source); source++; [COLOR="#FF0000"]DELAY SHOULD BE HERE[/COLOR] } AT25320_CS=1; }
Very valuable information, I will try now, I have tried at ISIS, it works, my question, how can I make VCC for WP and HOLD at 25AA640 ?
I'll let you know the result soon...
Thank you very much
for(i=0;i<num_of_byte;i++)
{
SPI_WriteByte(*source);
source++;
delay_ms(10);
}
Press the "Terminals Mode" button on left panel. Choose "POWER". Place the power terminal to the schematic, open properties, enter VCC in "string" value.how can I make VCC for WP and HOLD at 25AA640 ?
nop is 'nothing to operate' instruction. It is useless in your case. Delay_ms library using nop instructions to proceed the delay.I put like this, now compiling and upload to chip....
Code:for(i=0;i<num_of_byte;i++) { SPI_WriteByte(*source); source++; delay_ms(10); }
---------- Post added at 11:32 ---------- Previous post was at 11:23 ----------
or I use _nop_(); for delay ?
Press the "Terminals Mode" button on left panel. Choose "POWER". Place the power terminal to the schematic, open properties, enter VCC in "string" value.
By default, unnamed power terminal already connected to +5V.
nop is 'nothing to operate' instruction. It is useless in your case. Delay_ms library using nop instructions to proceed the delay.
So, if you have delay library, just use "delay_ms(10);"
void delay_ms(unsigned int msec) //delay function
{
//;
unsigned int i,j;
for(i=0;i<msec;i++);
for(j=0;j<1;j++);
[COLOR="#FF0000"]_nop_(); [/COLOR]
}
for(i=0;i<num_of_byte;i++)
{
SPI_WriteByte(*source);
source++;
delay_ms(10);
[COLOR="#FF0000"]_nop_();[/COLOR]
}
while (address<0x0008)
{
while (counter<8)
{
AT25_WriteByte(address,pattern[counter]);
}
[COLOR="#FF0000"]address++;[/COLOR]
}
forget about nop command. Delete them all.Found the power, thanks
will be like this :
Code:void delay_ms(unsigned int msec) //delay function { //; unsigned int i,j; for(i=0;i<msec;i++); for(j=0;j<1;j++); [COLOR="#FF0000"]_nop_(); [/COLOR] } for(i=0;i<num_of_byte;i++) { SPI_WriteByte(*source); source++; delay_ms(10); [COLOR="#FF0000"]_nop_();[/COLOR] }
I put like that ?
Code:while (address<0x0008) { while (counter<8) { AT25_WriteByte(address,pattern[counter]); } [COLOR="#FF0000"]address++;[/COLOR] }
forget about nop command. Delete them all.
my schematic is exactly the same with simulation...Sorry, not understanding you. With real chip it write another data? Show me your schematic.
Looks like the same data but mixed address. I can't explain why. Try to include delay before the main program run. Possible, about 100 ms or more.
I tried to give a delay :Looks like the same data but mixed address. I can't explain why. Try to include delay before the main program run. Possible, about 100 ms or more.
uint address,counter;
unsigned char pattern[8] = {0x3C,0x42,0xA5,0xA5,0x81,0xA5,0x5A,0x3C,};
delay_ms(50);
address=0x0000;
counter=0;
for(address=0x0000;address<0x0008;)
{
for(counter=0;counter<8;counter++)
{
AT25_WriteByte(address,pattern[counter]);
}
address++;
} //end of while for address
the delay :Ok I will, I scratch a schematic already in paper and pencil, do you need it ?
void delay_ms(unsigned int msec) //delay function
{
//;
unsigned int i,j;
for(i=0;i<msec;i++);
for(j=0;j<1110;j++);
}
Looks like the same data but mixed address. I can't explain why. Try to include delay before the main program run. Possible, about 100 ms or more.
Guys,
How can I see a data being sent into SI pin of 25640?
I want to see data at P3^6 ( byte by byte ), for example I send 1B 2A 3C 4B, how can I see them byte by byte correctly being sent ?
Watch ? capture ? Debug ?
How can I do it with keil / ISIS ?
Thanks
you can use pelles c..download it..its free..execute your program there..but of course need to modified your program to assume an input and just print out byte by byte at the end of program..compile n run..^^
pelles c
Is it IDE like keil ?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?