Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to see a serial data being sent ?

Status
Not open for further replies.
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
 

25640.jpg
25AA640, how to connect to Vcc ?
 

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

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 ?
 

how can I make VCC for WP and HOLD at 25AA640 ?
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.

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 ?
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);"
 

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

I got :
memory3.jpg

??
 

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);"

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]
 }


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 ?
forget about nop command. Delete them all.
 

Code:
while (address<0x0008)
 {
 while (counter<8)
 {
 AT25_WriteByte(address,pattern[counter]);

 }
[COLOR="#FF0000"]address++;[/COLOR]
 }



forget about nop command. Delete them all.

Ok I will....
I must reset uC to run it ? the real chip ?
I put Vcc and ground off line and install all the chip then reset ?
 

Code:
while (address<0x0008)
 {
 while (counter<8)
 {
 AT25_WriteByte(address,pattern[counter]);

 }
[COLOR="#FF0000"]address++;[/COLOR]
 }



forget about nop command. Delete them all.

It's fine in simulation but different in chip....
Simulation :
memory6.jpg
 

Sorry, not understanding you. With real chip it write another data? Show me your schematic.
 

Hardware result :
memory7.jpg

Do you know what the cause is ?
Could be a bypass capasitor ? or because I put on off and reset ?
What's the proper procedure to test it ?

Thanks
 

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.
 

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.

Ok I will, I scratch a schematic already in paper and pencil, do you need it ?
 

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 :
Code:
 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

Still got mixed up pattern in chip, anyone can give any clues ?
data7.jpg
thanks
 

Ok I will, I scratch a schematic already in paper and pencil, do you need it ?
the delay :
Code:
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.

I saw from 25LC640 :

==Write Cycle Time: 5 ms max==
Does it matter for the delay ? since I still got random data but the simulation is ok already ??
 
Last edited:

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..^^
 

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 ?
 

pelles c
Is it IDE like keil ?

Pelles C is where you can test your code whether it is working or not ..yes its like KEIL..u can test ur code in KEIL also but quite hard..so the simplest way is using pelles c..try it first..
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top