Help me please in my project(Matlab,Proteus,MikroC Pro)

Discussion in 'Programmer's Corner' started by Eng_Bandar, Aug 25, 2010.

  1. Eng_Bandar

    Thread Starter Active Member

    Feb 27, 2010
    50
    1
    Hi all,

    I work now in a project contains Matlab, Porteus, MikroC Pro and Virtual Serial Port Driver. My project if I send 'g' letter to PIC 16F877 LED will be turn on. Unfortunately LED not work. I don't know where is the problem.

    MikroC Pro Code

    Code ( (Unknown Language)):
    1. [FONT=Courier New]char data_1;[/FONT]
    2. [FONT=Courier New]void main()[/FONT]
    3. [FONT=Courier New]{[/FONT]
    4. [FONT=Courier New]trisd=0; // all portb are output[/FONT]
    5. [FONT=Courier New]portd=0;[/FONT]
    6. [FONT=Courier New]UART1_Init(9600); // speed is 9600[/FONT]
    7. [FONT=Courier New]delay_ms(100);[/FONT]
    8. [FONT=Courier New]while(1)[/FONT]
    9. [FONT=Courier New]{[/FONT]
    10. [FONT=Courier New]if(UART1_Data_Ready())[/FONT]
    11. [FONT=Courier New]{ // when receiving data[/FONT]
    12. [FONT=Courier New]data_1 = UART1_Read(); // read data and store it in variable[/FONT]
    13. [FONT=Courier New]if(data_1=='g') {[/FONT]
    14. [FONT=Courier New]portd=0B11111111;[/FONT]
    15. [FONT=Courier New]delay_ms(500);[/FONT]
    16. [FONT=Courier New]portd=0;[/FONT]
    17. [FONT=Courier New]delay_ms(500);}[/FONT]
    18. [FONT=Courier New]}[/FONT]
    19. [FONT=Courier New]}[/FONT]
    20. [FONT=Courier New]}[/FONT]


    Matlab Code



    Code ( (Unknown Language)):
    1.  s = serial('COM1');
    2. set(s,'BaudRate',9600);
    3. fopen(s);
    4. fprintf(s,'%s','g');
    5. fclose(s)
    6. delete(s)
    7. clear s
    8.  
    Also you can see my vedio to see every thing about this project.

    http://www.2shared.com/video/69quZb2C/Untitled2.html
     
Loading...