LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

labview error could not perform operation because of i/o error visa read

hola a todos estoy tratando de comunicar labview con pic 16f877a a traves de rs232. mi problema es que al presionar el boton automatico (ver programa) la transmision y recepcion de datos corre bien, pero al presionar horario me da un error subrayando visa read y obligandome a cerrar la aplicacion adjunto imagen de error, programa labview y progrma pic lo dejare aca abajo

 

'DEFINE OSC 4
@ DEVICE PIC16F877A
@ DEVICE PROTECT_OFF,CPD_OFF,WDT_OFF,PWRT_ON,BOD_OFF,LVP_OFF

INCLUDE "modedefs.bas" ;incluyen los modos de comunicación


TRISA = $FF
TRISB = $F1
TRISC = $BF
TRISD = $F3

serial VAR BYTE ;variable de almacenamiento de 255

releF VAR portd.2 ;nombres para los pines

led var portd.4
x var byte

entra var portb.0
salida var portb.1
SYMBOL TxD = PORTC.6
SYMBOL RxD = PORTC.7

inicio:
; Inicializar los puertos
    PORTB=$00
    PORTC=TRISC
    PORTD=TRISD
;3 parpadeos del led que indica funciona
    FOR x =1 TO 3
    HIGH led
    PAUSE 200
    LOW led
    PAUSE 200
    NEXT
     PAUSE 500
recibir:
pause 1000
    SERIN RxD,T9600,serial ; comparar con pruebaredes
    SELECT CASE serial
        CASE "A"    ; A
            GOTO automatico
        CASE "B"    ; B
            GOTO horarioapa
        CASE "C"    ; C
            GOTO horarioenc
             
       CASE ELSE
            SEROUT TxD,T9600,["comando   invalido.",13,10]
    END SELECT
    PAUSE 500   ; Retardo para estabilizar el puerto
    goto recibir

automatico:
  pause 1000
     SEROUT TxD,T9600,["control automatico.",13,10]
    if entra=1 then
     high salida
     SEROUT TxD,T9600,["luminaria encendida",13,10]
      PAUSE 1000
     goto recibir
      else
      low salida
       SEROUT TxD,T9600,["luminaria  apagada.",13,10]
        PAUSE 1000
    goto recibir
     endif
     
horarioapa:
    low salida
     SEROUT TxD,T9600,["control    horario.",13,10]
     low salida
      PAUSE 1000
        SEROUT TxD,T9600,["luminaria  apagada.",13,10]
         PAUSE 1000
    goto recibir

horarioenc:
       SEROUT TxD,T9600,["control    horario.",13,10]
        PAUSE 1000
       high salida
        PAUSE 1000
     SEROUT TxD,T9600,["luminaria encendida",13,10]

Download All
0 Kudos
Message 1 of 5
(2,646 Views)

Buenos días,

 

Cuándo “Control Horario” es activado cual es el estado de “Automático”? O sea, lo que estoy tratando de entender es si estás tratando de realizar 2 escrituras a la vez.

 

En general me gustaría recomendarte que trates de usar los cables de error para definir el flujo de datos. Igualmente te beneficiarias al mejorar el manejo de errores. El patrón de diseño de máquina de estados es usualmente utilizado para este tipo de tareas.

 

Podrás encontrar mas información de las posibles causas del error -1073807298 en los siguientes enlaces:

http://digital.ni.com/public.nsf/allkb/60DDFED7EFEFE7188625705700750821

http://digital.ni.com/public.nsf/allkb/B99D923DFC18555786256F15004B87B0

 

Saludos,

 

MCOTO

0 Kudos
Message 2 of 5
(2,593 Views)

Mostly this happens only because of two reason, 1. Serial port  connection after initializion 2. connection is already in use.

 

In your application, you are writing and reading but where output of VISA WRITE and VISA READ goes. This output must be connected. 

 

what about VISA close. From where it is getting input?

 

 

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 3 of 5
(2,572 Views)

@Ranjeet_Singh wrote:

Mostly this happens only because of two reason, 1. Serial port  connection after initializion 2. connection is already in use.

 

In your application, you are writing and reading but where output of VISA WRITE and VISA READ goes. This output must be connected. 

 

what about VISA close. From where it is getting input?

 

 


I'm leaning towards reason #2.  It's never a good idea to have parallel I/O to the same instrument.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 5
(2,556 Views)

I agree that one VISA should or cant be used in parallel, we need to ensure this is done in sequential 

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 5 of 5
(2,546 Views)