[Programmation] communication série proteus labview
Répondre à la discussion
Affichage des résultats 1 à 3 sur 3

communication série proteus labview



  1. #1
    electroelectro

    communication série proteus labview


    ------

    Bonjour , dans le but de réaliser une communication labview-proteus , j'utilise la laiason série rs232 avec le pic 18f4520. En fait, j'ai du mal à configurer le protocole uart . Mon objectif et de faire le diagnostic des transistors en panne et en marche et indiquer ça avec des leds sur une interface labview ,quelqu'un pourra m'aider svp ? vous trouvez ci joint mon schema isis et le code mikro c

    -----
    Images attachées Images attachées
    Fichiers attachés Fichiers attachés

  2. #2
    JPL
    Responsable des forums

    Re : communication série proteus labview

    Il est préférable d'intégrer le code dans le message avec la balise Code (# dans la barre d'outils de l'éditeur avancé).
    Rien ne sert de penser, il faut réfléchir avant - Pierre Dac

  3. #3
    electroelectro

    Re : communication série proteus labview

    Code:
    sbit LCD_RS at RB4_bit;
    sbit LCD_EN at RB5_bit;
    sbit LCD_D4 at RB0_bit;
    sbit LCD_D5 at RB1_bit;
    sbit LCD_D6 at RB2_bit;
    sbit LCD_D7 at RB3_bit;
    
    sbit LCD_RS_Direction at TRISB4_bit;
    sbit LCD_EN_Direction at TRISB5_bit;
    sbit LCD_D4_Direction at TRISB0_bit;
    sbit LCD_D5_Direction at TRISB1_bit;
    sbit LCD_D6_Direction at TRISB2_bit;
    sbit LCD_D7_Direction at TRISB3_bit;
    
    
    #define latch_pin PORTE.F2     // 74HC165 PIN #1
    #define clock_pin PORTE.F1      // 74HC165 PIN #2
    #define data_pin PORTE.F0       // 74HC165 PIN #9
    char buttons[48];
    void read_inputs_165() {
        int m ;
       for(m=0;m<48;m++)
       latch_pin = 0;
       latch_pin = 1;
    
      for(m=0;m<48;m++) {
          clock_pin = 0;
          if(data_pin) buttons[m] = '1'; else buttons[m] = '0';
          clock_pin = 1;
       }
    }
    
    void display_bloc(int b){
       short i;
        char txt3[]="00000000";
    
        if(b==1){  for(i=0;i<8;i++){txt3[i]=buttons[i];}}
        if(b==2){for(i=8;i<16;i++){txt3[i-8]=buttons[i];}}
        if(b==3){ for(i=16;i<24;i++){txt3[i-16]=buttons[i];}}
        if(b==4){for(i=24;i<32;i++){txt3[i-24]=buttons[i];}}
        if(b==5){ for(i=32;i<40;i++){txt3[i-32]=buttons[i];}}
        if(b==6){  for(i=40;i<48;i++){txt3[i-40]=buttons[i];}}
    
    
       Lcd_Cmd(_LCD_CLEAR);
       if((b==2)||(b==4)||(b==6))Lcd_Out(1,1,"NPN TEST ");
       if((b==1)||(b==3)||(b==5))Lcd_Out(1,1,"PNP TEST ");
       Lcd_Out(2,1,txt3);
       delay_ms(2000);
    
    }
    void display_bloc_uart(int c) {
    short a ;
    short b ;
    if (c==1) { for (a=0;a<8;a++)
                  { for (b=0;b<8;b++) { Uart1_Write(b);} }
    if (c==2) { for (a=8;a<16;a++)
                  { for (b=0;b<8;b++) { Uart1_Write(b);} }
    if (c==3) { for (a=24;a<32;a++)
                  { for (b=0;b<8;b++) { Uart1_Write(b);} }
    if (c==4) { for (a=0;a<8;a++)
                  { for (b=0;b<8;b++) { Uart1_Write(b);} }
    if (c==5) { for (a=32;a<40;a++)
                  { for (b=0;b<8;b++) { Uart1_Write(b);} }
    if (c==6) { for (a=40;a<48;a++)
                  { for (b=0;b<8;b++) { Uart1_Write(b);} }
     }
    
    void main() {
    UART1_init(9600) ; //Initialize UART module at 9600 bps
      delay_ms(100); //wait for uart module to stabilize
    
     TRISD=0xFF;
      TRISC=0b10111111;
      TRISE.B0=1;
      TRISE.B1=0;
      TRISE.B2=0;
      PORTA.B0=1;
      PORTA.B1=1;
    
    
      ADCON1 = 0XFF;//configure all pins as digital
      CMCON = 0x07; //disable comparator
    
    Lcd_Init();                        // Initialize LCD
    Lcd_Cmd(_LCD_CLEAR);               // Clear display
    Lcd_Cmd(_LCD_CURSOR_OFF);
    
    
    
    
    
    while(1){      char *txt1="00000000";
      char *txt2="00000000";
        lcd_cmd(_lcd_clear);
        Lcd_Out(1,1,"BLOC 1");
        Lcd_Out(2,1,"TEST EN COURS...");
        delay_ms(2000) ;
        if (RD0_bit) txt1[0]='1'; else txt1[0]='0';
       if (RD1_bit) txt1[1]='1'; else txt1[1]='0';
       if (RD2_bit) txt1[2]='1'; else txt1[2]='0';
       if (RD3_bit) txt1[3]='1'; else txt1[3]='0';
       if (RD4_bit) txt1[4]='1'; else txt1[4]='0';
       if (RD5_bit) txt1[5]='1'; else txt1[5]='0';
       if (RD6_bit) txt1[6]='1'; else txt1[6]='0';
       if (RD7_bit) txt1[7]='1'; else txt1[7]='0';
    
        lcd_cmd(_lcd_clear);
        Lcd_Out(1,1,"PNP TEST ");
       Lcd_Out(2,1,txt1);
       delay_ms(2000);
    
       if (RC0_bit) txt2[0]='1'; else txt2[0]='0';
       if (RC1_bit) txt2[1]='1'; else txt2[1]='0';
       if (RC2_bit) txt2[2]='1'; else txt2[2]='0';
       if (RC3_bit) txt2[3]='1'; else txt2[3]='0';
       if (RC4_bit) txt2[4]='1'; else txt2[4]='0';
       if (RC5_bit) txt2[5]='1'; else txt2[5]='0';
       if (RA0_bit) txt2[6]='1'; else txt2[6]='0';
       if (RA1_bit) txt2[7]='1'; else txt2[7]='0';
    
       lcd_cmd(_lcd_clear);
       Lcd_Out(1,1,"NPN TEST");
       Lcd_Out(2,1,txt2);
       delay_ms(2000);
    
    
        read_inputs_165();
       Lcd_Cmd(_LCD_CLEAR);Lcd_Out(1,1,"BLOC 2");Lcd_Out(2,1,"TEST EN COURS..");delay_ms(2000);
       display_bloc(1);
       display_bloc(2);
        Lcd_Cmd(_LCD_CLEAR);Lcd_Out(1,1,"BLOC 3");Lcd_Out(2,1,"TEST EN COURS..");delay_ms(2000);
       display_bloc(3);
       display_bloc(4);
        Lcd_Cmd(_LCD_CLEAR);Lcd_Out(1,1,"BLOC 4");Lcd_Out(2,1,"TEST EN COURS..");delay_ms(2000);
       display_bloc(5);
       display_bloc(6);
    
    if (PORTD.F0 == 1)    (UART1_Write('a'));
    if (PORTD.F0 == 0)    (UART1_Write('b'));
    if (PORTD.F1 == 1)    (UART1_Write('c'));
    if (PORTD.F1 == 0)    (UART1_Write('d'));
    if (PORTD.F2 == 1)    (UART1_Write('e'));
    if (PORTD.F2 == 0)    (UART1_Write('f'));
    if (PORTD.F3 == 1)    (UART1_Write('g'));
    if (PORTD.F3 == 0)    (UART1_Write('h'));
    if (PORTD.F4 == 1)    (UART1_Write('e'));
    if (PORTD.F4 == 0)    (UART1_Write('f'));
    if (PORTD.F5 == 1)    (UART1_Write('g'));
    if (PORTD.F5 == 0)    (UART1_Write('h'));
    if (PORTD.F6 == 1)    (UART1_Write('i'));
    if (PORTD.F6 == 0)    (UART1_Write('j'));
    if (PORTD.F7 == 1)    (UART1_Write('k'));
    if (PORTD.F7 == 0)    (UART1_Write('l'));
    
    if (PORTC.F0 == 1)    (UART1_Write('m'));
    if (PORTC.F0 == 0)    (UART1_Write('n'));
    if (PORTC.F1 == 1)    (UART1_Write('o'));
    if (PORTC.F1 == 0)    (UART1_Write('p'));
    if (PORTC.F2 == 1)    (UART1_Write('q'));
    if (PORTC.F2 == 0)    (UART1_Write('r'));
    if (PORTC.F3 == 1)    (UART1_Write('s'));
    if (PORTC.F3 == 0)    (UART1_Write('t'));
    if (PORTC.F4 == 1)    (UART1_Write('u'));
    if (PORTC.F4 == 0)    (UART1_Write('v'));
    if (PORTC.F5 == 1)    (UART1_Write('w'));
    if (PORTC.F5 == 0)    (UART1_Write('x'));
    if (PORTA.F0 == 1)    (UART1_Write('y'));
    if (PORTA.F0 == 0)    (UART1_Write('z'));
    if (PORTA.F1 == 1)    (UART1_Write('A'));
    if (PORTA.F1 == 0)    (UART1_Write('A'));
         display_bloc_uart();
    
    
    
    
    
    
    
    
    }
    }
    }

Discussions similaires

  1. Communication via Ethernet (TCP/IP) sous Labview
    Par Mouak dans le forum Programmation et langages, Algorithmique
    Réponses: 0
    Dernier message: 18/06/2015, 13h33
  2. communication entre labview 2012 et MPLABX
    Par puzzlou dans le forum Électronique
    Réponses: 2
    Dernier message: 18/03/2014, 22h14
  3. Communication dans LabVIEW via un port série
    Par invitec0090f33 dans le forum Électronique
    Réponses: 0
    Dernier message: 01/06/2012, 11h11
  4. proteus et labview
    Par invite78b3ecc4 dans le forum Électronique
    Réponses: 0
    Dernier message: 28/08/2010, 19h12
  5. convertisseur fréquence/tension et communication labview
    Par invite30488bd9 dans le forum Électronique
    Réponses: 5
    Dernier message: 09/03/2008, 20h53
Dans la rubrique Tech de Futura, découvrez nos comparatifs produits sur l'informatique et les technologies : imprimantes laser couleur, casques audio, chaises gamer...