Share on facebook
Share on twitter
Share on linkedin
Share on whatsapp

Interfacing Proteus with Matlab

It is very important topic that how Interfacing Proteus with Matlab is done? And it is obvious that after interfacing Proteus with matlab lots of way is open for simulating microcontroller based project. We know that in Proteus there has lack of sensor. So if we done Interfacing Proteus with Matlab then we can easily introduce all blocks of matlab as a input or output device for microcontroller.

Now question is how we shall do Interfacing Proteus with Matlab ?

For Interfacing Proteus with Matlab, we need support additional software (Virtual serial Ports Emulator) for making virtual com port. We have to making pairing between the ports which are used to interfacing Proteus with Matlab. So it is now clear that we can connect matlab with Proteus by serial Port. In bellow block diagram shows how it possible. 

Interfacing Proteus with Matlab

Code for MiKro C Pro :

To run the project we need the hex file. And here I used Mikro c pro for Pic to write the c program and making the hex file. In bellow see the C code for Interfacing Proteus with Matlab by UART port

Embedded C Code
// Name : Interfacing Proteus with Matlab
// Purpose : Serial communication between PC with Microcontroller.
// Author : Subham Dutta
// Date : 27-12-13
// Website : www.nbcafe.in
unsigned int uart_rd;
sbit LCD_RS at RD2_bit;
sbit LCD_EN at RD3_bit;
sbit LCD_D4 at RD4_bit;
sbit LCD_D5 at RD5_bit;
sbit LCD_D6 at RD6_bit; // Initialize lcd
sbit LCD_D7 at RD7_bit;
sbit LCD_RS_Direction at TRISD2_bit;
sbit LCD_EN_Direction at TRISD3_bit;
sbit LCD_D4_Direction at TRISD4_bit;
sbit LCD_D5_Direction at TRISD5_bit;
sbit LCD_D6_Direction at TRISD6_bit;
sbit LCD_D7_Direction at TRISD7_bit;
void main() {
int i;
lcd_init();
ANSEL = 0; // Configure AN pins as digital
ANSELH = 0;UART1_Init(9600); // Initialize UART module at 9600 bps
Delay_ms(100); // Wait for UART module to stabilizewhile (1) { // Endless loop
if (UART1_Data_Ready()) { // If data is received,
uart_rd = UART1_Read();
UART1_Write(uart_rd); // read the received data,
if (uart_rd == ‘a’){
lcd_cmd(_LCD_MOVE_CURSOR_LEFT);
lcd_cmd(_LCD_MOVE_CURSOR_LEFT);}
lcd_chr_cp(uart_rd);}
}
}

Code for Matlab:

For sending data form Matlab via serial port, we should define the com port and send the data through that.Here I give you the matlab code for sending data through serial port.

clear all
s = serial(‘COM1′,’BaudRate’,9600);
fopen(s);
fprintf(s,’%s’,’NBCAFE’);
fclose(s);
clear s

For Proteus circuit diagram and how the total simulation from the beginning step by step process must see the video given bellow.

 

Not Enough, Need More

E-Mail Subscription





5 thoughts on “Interfacing Proteus with Matlab”

Comments are closed.

E-Mail Subscription





Table of Contents
Subham Dutta

Subham Dutta

Hi myself Subham Dutta, having 15+ years experience in filed of Engineering. I love to teach and try to build foundation of students. Try to make them imagine what they learn.

Need more this type of content in your E-Mail?



NBCAFE