+ Post New Thread
Results 1 to 7 of 7
  1. #1
    Junior Member level 1
    Points: 548, Level: 4

    Join Date
    Mar 2010
    Location
    india
    Posts
    16
    Helped
    0 / 0
    Points
    548
    Level
    4

    interfacing PC(MATLAB) with AT89C51

    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

    •   Alt28th May 2011, 06:37

      advertising

        
       

  2. #2
    Administrator
    Points: 68,870, Level: 64
    Achievements:
    Created Album pictures Created Blog entry 7 years registered
    bigdogguru's Avatar
    Join Date
    Mar 2010
    Location
    Southwest, USA
    Posts
    9,797
    Helped
    2348 / 2348
    Points
    68,870
    Level
    64
    Blog Entries
    4

    Re: interfacing PC(MATLAB) with AT89C51



    1 members found this post helpful.

  3. #3
    Junior Member level 1
    Points: 548, Level: 4

    Join Date
    Mar 2010
    Location
    india
    Posts
    16
    Helped
    0 / 0
    Points
    548
    Level
    4

    Re: interfacing PC(MATLAB) with AT89C51

    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?


    Quote Originally Posted by bigdogguru View Post



    •   Alt28th May 2011, 07:46

      advertising

        
       

  4. #4
    Administrator
    Points: 68,870, Level: 64
    Achievements:
    Created Album pictures Created Blog entry 7 years registered
    bigdogguru's Avatar
    Join Date
    Mar 2010
    Location
    Southwest, USA
    Posts
    9,797
    Helped
    2348 / 2348
    Points
    68,870
    Level
    64
    Blog Entries
    4

    Re: interfacing PC(MATLAB) with AT89C51

    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.


    1 members found this post helpful.

  5. #5
    Junior Member level 1
    Points: 548, Level: 4

    Join Date
    Mar 2010
    Location
    india
    Posts
    16
    Helped
    0 / 0
    Points
    548
    Level
    4

    Re: interfacing PC(MATLAB) with AT89C51

    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?


    Quote Originally Posted by bigdogguru View Post
    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.



    •   Alt28th May 2011, 09:23

      advertising

        
       

  6. #6
    Administrator
    Points: 68,870, Level: 64
    Achievements:
    Created Album pictures Created Blog entry 7 years registered
    bigdogguru's Avatar
    Join Date
    Mar 2010
    Location
    Southwest, USA
    Posts
    9,797
    Helped
    2348 / 2348
    Points
    68,870
    Level
    64
    Blog Entries
    4

    Re: interfacing PC(MATLAB) with AT89C51

    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.

    Events and Callbacks of Serial Object

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



  7. #7
    Junior Member level 1
    Points: 548, Level: 4

    Join Date
    Mar 2010
    Location
    india
    Posts
    16
    Helped
    0 / 0
    Points
    548
    Level
    4

    Re: interfacing PC(MATLAB) with AT89C51

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




    Quote Originally Posted by bigdogguru View Post
    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.

    Events and Callbacks of Serial Object

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



--[[ ]]--