Dudas con Labview y puerto serial RS-232

@panchoreyes, te comento que aun no puedo ver tu programa en labview.
error_de_carga_labview.PNG
pero no hay lio me inventare algo en base al programa que tienes hecho.
 
panchoreyes, gran parte de lo que tenias hecho estaba bien, solo eran unos pequeñísimos detalles como:
tamaños de cadenas de texto y formato de envío de caracteres PIC->Labview...
También una particularidad en la configuración de puerto serie por parte de Labview.
Código:
#include <16F877A.h>

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES PUT                      //Power Up Timer
#FUSES BROWNOUT                 //Reset when brownout detected
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD                    //No EE protection
#FUSES NOWRT                    //Program memory not write protected
#FUSES NOPROTECT                //Code not protected from reading

#use delay(crystal=4000000)
#use rs232(baud=9600,parity=N,xmit=PIN_c6,rcv=PIN_c7,bits=8)

char buffer_rx[2];

unsigned int8  banderas;
#bit  buffer_rx_listo=banderas.0
#INT_RDA
void  RDA_isr(void) 
{
   static unsigned int8 n_bytes;
   
   buffer_rx[n_bytes++]=getc();
   if(n_bytes==2)
   {  
      n_bytes=0;
      buffer_rx_listo=1;
   }
}
void main()
{ 
   output_b(0);
   enable_interrupts(INT_RDA);
   enable_interrupts(GLOBAL);
   while(TRUE)
   {
      while(!buffer_rx_listo);
      buffer_rx_listo=0;
      switch(buffer_rx)
      {
         case "A":
         {
            if (input(pin_b0))
            {
               output_high(pin_b1);
               printf("Control automatico\r\nLuminaria encendida");
            }
            else
            {
               output_low(pin_b1);
               printf("Control automatico\r\nLuminaria apagada  ");
            }
            break;
         }
         case "B":
         {
            output_high(pin_b1);
            printf("Control    horario\r\nLuminaria encendida"); 
            break;
         }
         case "C":
         {
            output_low(pin_b1);
            printf("Control    horario\r\nLuminaria   apagada");
         }
      }
   }
}

Dibujo0.PNGDibujo1.PNGDibujo2.PNGDibujo3.PNGDibujo4.PNGDibujo5.PNG

PD. Los puertos usados son: comm3->Proteus comm4->Labview
 

Adjuntos

  • labview.rar
    519.6 KB · Visitas: 25
Atrás
Arriba