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.

interfacing PC(MATLAB) with AT89C51

Status
Not open for further replies.

upasana2007

Junior Member level 1
Joined
Mar 20, 2010
Messages
16
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
india
Activity points
1,414
Hi All,

I have interfaced my data aquisition system consisting of a AT89C51 microcontroller with MATLAB on my PC for real time Harmonic analysis of power signals( continuous monitoring). My question is is there a way to notify my microcontroller tht the input buffer of the MATLAB is full so that it stops sending data and begins anewcyle? Please pleasehelp!
Thanks
 

Hi thanks for replying....but my book says tht the 8051 UART doesnt support handshaking signals in RS232,,,,,,that is only the Rx, Tx and ground lines are connected between the microcontroller and the RS 232 pin connector in my microcontroller evaluation board.......
So is there any other way to do wat i want to achieve?


Yes, it's called software or hardware flow control:

RS232 flow control and handshaking

Practical RS232 Design Considerations

Hardware Handshaking for AVR

**broken link removed**

Using the USART of AVR Microcontrollers : Reading and Writing Data

Hope these links help you implement flow control.
 

Well that leaves only software flow control, XON and XOFF.

Here's a link to a AT89C51 Serial Port Interface:

AT89C51 Serial Port Interface

Discusses many of the issues concerning AT89C51 and Serial Interface.

You most likely can implement software flow control (XON, XOFF), the receiver issues XON when ready and XOFF when not ready. Another alternative is using external interrupts tied to the CTS line of RS-232 to implement your own hardware flow control. You can always roll your own flow control as well, have the MCU send a set size block of data and then wait for a response from the PC side before sending another block. You should also be able to increase the buffer size on the Matlab side.

The last alternative is to upgrade your MCU, the newer AVRs have hardware flow control, SPI to write data to flash card, etc.
 
Hi....thanks for helping! I am looking into the software flow control....
I am also thinking this: since I am not using the Rx pin on my microcotroller or any other purpose, I can use this to notify the microcontroller when the MTLAb programme has completed one run and is ready to recieve more data. That is, the last line of my matlab program can send a dummy value(a byte of any value) to the microcontroller....wen it is recieved, the RI(recieve interrupt ) will go high, and the microcontroller will start sending again.......do u think its a feasible solution?


Well that leaves only software flow control, XON and XOFF.

Here's a link to a AT89C51 Serial Port Interface:

AT89C51 Serial Port Interface

Discusses many of the issues concerning AT89C51 and Serial Interface.

You most likely can implement software flow control (XON, XOFF), the receiver issues XON when ready and XOFF when not ready. Another alternative is using external interrupts tied to the CTS line of RS-232 to implement your own hardware flow control. You can always roll your own flow control as well, have the MCU send a set size block of data and then wait for a response from the PC side before sending another block. You should also be able to increase the buffer size on the Matlab side.

The last alternative is to upgrade your MCU, the newer AVRs have hardware flow control, SPI to write data to flash card, etc.
 

It's definitely a possible solution. I was just looking over the Matlab docs concerning flow control, buffer size of serial objects and the use of multiple serial objects.

I'll let you know if I come across anything relevant to your problem. There are features in the Matlab serial object which allow for the monitoring of the amount of data in the buffer, this feature may come in handy.

**broken link removed**

Both the Bytes-Available Event and Pin Status Event may have some use.
 

Thank you so so much for ur time and effort.....really appreciate it :)




It's definitely a possible solution. I was just looking over the Matlab docs concerning flow control, buffer size of serial objects and the use of multiple serial objects.

I'll let you know if I come across anything relevant to your problem. There are features in the Matlab serial object which allow for the monitoring of the amount of data in the buffer, this feature may come in handy.

**broken link removed**

Both the Bytes-Available Event and Pin Status Event may have some use.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top