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.

bianchi77

Advanced Member level 4
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
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 have i2c debugger in ISIS and software simulator in Keil. In real life you have to use logic analyzer.
 

You have i2c debugger in ISIS and software simulator in Keil. In real life you have to use logic analyzer.
do you know how to use it ?
In keil, I can only see the port is blinking but can't see the exact data being sent
 

Buy an old HP logic analyzer; they're fantastic. They used to sell for $37,000, but you can now buy one for $100 if you look, on Ebay.
 

Just add debugger like other slave devices on bus.


---------- Post added at 08:42 ---------- Previous post was at 08:39 ----------

Buy an old HP logic analyzer; they're fantastic. They used to sell for $37,000, but you can now buy one for $100 if you look, on Ebay.
Are you kidding, man? Forget about old HP analyzers. Buy actual devices - USBee AX, DX, RX...
**broken link removed**
 

Just add debugger like other slave devices on bus.


---------- Post added at 08:42 ---------- Previous post was at 08:39 ----------


Are you kidding, man? Forget about old HP analyzers. Buy actual devices - USBee AX, DX, RX...
**broken link removed**
Like this one :
SPI.jpg
How to debug it ?
My computer became so slow if I put SPI there....
 

Wholesale free shipping, 2 in 1, USBee Dx / Saleae Logic Analyze, 16Channels


Is it a device that simulating my computer as an osciloscope ?

thanks
 

Just add debugger like other slave devices on bus.


---------- Post added at 08:42 ---------- Previous post was at 08:39 ----------


Are you kidding, man? Forget about old HP analyzers. Buy actual devices - USBee AX, DX, RX...
**broken link removed**

Is it the same with this :
**broken link removed**

---------- Post added at 13:42 ---------- Previous post was at 13:41 ----------

Just add debugger like other slave devices on bus.


---------- Post added at 08:42 ---------- Previous post was at 08:39 ----------


Are you kidding, man? Forget about old HP analyzers. Buy actual devices - USBee AX, DX, RX...
**broken link removed**

Is it the same with this :
**broken link removed**
 

Wholesale free shipping, 2 in 1, USBee Dx / Saleae Logic Analyze, 16Channels


Is it a device that simulating my computer as an osciloscope ?

thanks
No, it is 16ch logic analyzer and 2 channel oscilloscope.

Like this one :
View attachment 64858
How to debug it ?
My computer became so slow if I put SPI there....
First of all, you need to understand, that Proteus can't simulate microwave ovens, coffee machines and tea pots. When you attaching the crystal model, what are you trying to simulate? External quartz resonator? Forget about it. If you want to get correct results, just try to understand how the spice working. Hint: try to use only digital models. I can't explain you how to build a house if you don't know what is a brick.
And that voltmeter... what it for?

Is it the same with this :
**broken link removed**

---------- Post added at 13:42 ---------- Previous post was at 13:41 ----------



Is it the same with this :
**broken link removed**
I'm talking about logic analyzer with oscilloscope option.

---------- Post added at 19:07 ---------- Previous post was at 19:04 ----------

My computer became so slow if I put SPI there....
Even for realtime, you can optimize your project that will simulate few microcontrollers without any problems. Did you ever seen an labcenter examples? They launching unix in realtime!
 

First of all, you need to understand, that Proteus can't simulate microwave ovens, coffee machines and tea pots. When you attaching the crystal model, what are you trying to simulate? External quartz resonator? Forget about it. If you want to get correct results, just try to understand how the spice working. Hint: try to use only digital models. I can't explain you how to build a house if you don't know what is a brick.
And that voltmeter... what it for?

So you must help explain me what the brick is then :)
Never mind,

If I don't put a crystal, the MCS51 will not work, will it ?
Do you have an example on how to test SPI with MCS51 ?

---------- Post added at 22:41 ---------- Previous post was at 22:39 ----------

Even for realtime, you can optimize your project that will simulate few microcontrollers without any problems. Did you ever seen an labcenter examples? They launching unix in realtime!

Why did my computer become so slow then ?
I put SPI, MCS51, LED and voltmeter only, it's simple already.

---------- Post added at 22:43 ---------- Previous post was at 22:41 ----------

I'm talking about logic analyzer with oscilloscope option.

I thought it's USB Osciloscope...
 

So you must help explain me what the brick is then :)
No problem, I'll try.
If I don't put a crystal, the MCS51 will not work, will it ?
It will work. XTAL pins not modeled on all ISIS model except 4060 and some other logics.
ISIS can't correctly detect what frequency do you using for CPU. If you not using internal oscillator (i suppose you don't have it in this old cpu), you have to set it manually in model properties.
Do you have an example on how to test SPI with MCS51 ?
With MCS51 I don't. But what is the difference between SPI on MCS51 and others? You can simulate SPI without any controllers at all. Just take a two signals and manually adjust the second one. Possible, you will need the third signal for CS.
Why did my computer become so slow then ?
Because you trying to mix analog and digital models. Because you trying to simulate too many process. Many things. I simulating projects with USB on 48Mhz frequency in realtime on old dell laptop. It works fine you know.
I put SPI, MCS51, LED and voltmeter only, it's simple already.
LED model can be digital and analog. By default, it is analog. In this case ISIS have to count their current and voltage like on real device.
Voltmeter is always analog model. But what are you trying to do with battery?
ISIS can't simulate how the electronic part blowing. That's bad.
 

With MCS51 I don't. But what is the difference between SPI on MCS51 and others? You can simulate SPI without any controllers at all. Just take a two signals and manually adjust the second one. Possible, you will need the third signal for CS.
Thanks for the information, but for testing the code I need to put my uC there ?
Can it test my code without uC ?
But what are you trying to do with battery?
I thought it will not work without battery as a power supply, because I'm thinking the circuit will need a power supply.
I don't have to use LED as well then

Are you kidding, man? Forget about old HP analyzers. Buy actual devices - USBee AX, DX, RX...
Wholesale free shipping, 2 in 1, USBee Dx / Saleae Logic Analyze, 16Channels,

Is it saved buying from Aliexpress, I can't find that device in ebay. It's logic analyzer and osciloscope at once..

---------- Post added at 23:52 ---------- Previous post was at 23:50 ----------

I need a tool like this one ?
Logic Analyzer
 

Thanks for the information, but for testing the code I need to put my uC there ?
Can it test my code without uC ?
Attach you code and explain what I must to see. I'll try to simulate. Actually, you need only 89c52 model. No crystals, no batteries.
And one important think. All your schematics must have GROUND connection. ISIS don't like floating constructions.
I thought it will not work without battery as a power supply, because I'm thinking the circuit will need a power supply.
Look at the model properties. The HIDDEN PINS is the VCC and GND. VCC by default is always connected to +5V. So, the model is powered. The only exclusion is an ARM LPC models. They have simulated power pins.
I don't have to use LED as well then
No problem to use digital model of LED with simulated mcu. It is very useful for understanding what is going on really.
Is it saved buying from Aliexpress, I can't find that device in ebay.
Thats because it is a copy of original device. Possible, ebay too popular for pirats )))
It's logic analyzer and osciloscope at once..
First of all it is a analyzer. The scope don't have optical isolation. So, for me it is useless option.
 

Attach you code and explain what I must to see. I'll try to simulate. Actually, you need only 89c52 model. No crystals, no batteries.
And one important think. All your schematics must have GROUND connection. ISIS don't like floating constructions.
My friend,
The code :
void SPI_WriteByte(uchar spi_write_data)
{
uchar temp=0;
uchar i=0;
temp=spi_write_data;

//AT25320_CS=0;

for(i=0;i<8;i++) //send 8 bits
{
AT25320_SCK=0;

if(temp & 0x80)//MSB first
AT25320_SI=1;
else
AT25320_SI=0;

temp=temp<<1;

AT25320_SCK=1;
}

}

void AT25_WriteByte (unsigned int address,unsigned char dat)
{
AT25_WritePage(address,1,&dat);
}



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++;
}

AT25320_CS=1;

}


uint address,counter;
unsigned char pattern[8] = {0x3C,0x42,0xA5,0xA5,0x81,0xA5,0x5A,0x3C,};
address=0x0000;
counter=0;

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

}


I want to see : unsigned char pattern[8] = {0x3C,0x42,0xA5,0xA5,0x81,0xA5,0x5A,0x3C,};
are being written into 25640 Serial EEPROM,

Can you help with the simulation at ISIS ?
Thanks

---------- Post added at 08:23 ---------- Previous post was at 08:20 ----------

Just add debugger like other slave devices on bus.


---------- Post added at 08:42 ---------- Previous post was at 08:39 ----------


Are you kidding, man? Forget about old HP analyzers. Buy actual devices - USBee AX, DX, RX...
**broken link removed**
Is it safe buying from Aliexpress ?
**broken link removed**
 

I don't have a compiler for c51, so, please, attach HEX programm.

I know many people who buy there. Everything ok.

I attached the hex file, please try,
thanks
 

Attachments

  • serial_rw.zip
    1.1 KB · Views: 84

It works, but you have to increase delay for write cycle.
52_1322642791.png

Thanks my friend, where shoud I put the delay in the code ? on the loop when entering the data ? or somewhere else,
there are 3 functions related with writing...
 

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;

 }
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top