• Martes 30 de Abril de 2024, 00:10

Autor Tema:  Captar Datos De Un Puerto Paralelo  (Leído 5382 veces)

laux

  • Miembro activo
  • **
  • Mensajes: 29
    • Ver Perfil
Captar Datos De Un Puerto Paralelo
« en: Lunes 7 de Marzo de 2005, 14:42 »
0
Buenas, quiero saber si este cód. me devuelve lo q esta entrando al puerto paralelo, me dirian uds. q les parece ?

en un modulo:
Public Declare Function Inp Lib "inpout32.dll" _
Alias "Inp32" (ByVal PortAddress As Integer) As Integer
Public Declare Sub Out Lib "inpout32.dll" _
Alias "Out32" (ByVal PortAddress As Integer, ByVal Value As Integer)

en el form:
Private Sub Form_Load()
'me da 255  :alien:
Text1.Text = Str(Inp(Val(&H378)))
End Sub

Gracias,
Lau  :kicking:

© Jonathan ©

  • Moderador
  • ******
  • Mensajes: 1671
  • Nacionalidad: ar
    • Ver Perfil
    • http://www.einstec.com.ar
Re: Captar Datos De Un Puerto Paralelo
« Respuesta #1 en: Martes 8 de Marzo de 2005, 01:29 »
0
Pareceria que funciona, no tengo experiencia en VB, lo ideal seria que coloques el post en el foro de VB y te sabran responder la duda. Cuando luches con el Hard nos comentas en este subforo ;). Saludos :)
EINSTEC Tecnología «La única fuente del conocimiento es la experiencia.»

«Lo importante es no dejar de hacerse preguntas.»

hecktor00

  • Miembro activo
  • **
  • Mensajes: 85
    • Ver Perfil
Re: Captar Datos De Un Puerto Paralelo
« Respuesta #2 en: Martes 8 de Marzo de 2005, 01:58 »
0
en un modulo:
Public Declare Function Inp Lib "inpout32.dll" _
Alias "Inp32" (ByVal PortAddress As Integer) As Integer
Public Declare Sub Out Lib "inpout32.dll" _
Alias "Out32" (ByVal PortAddress As Integer, ByVal Value As Integer)

en el form:
Private Sub Form_Load()
'me da 255  
Text1.Text = Str(Inp(Val(&H378)))
End Sub

asi es t devuelve el valor q se encuentra en puerto paralelo.

solo tienes q chekar las direcciones del puerto &H378, saber cual es para leer y cual para escribir
.......::::::......:.::::::::::Norte Veracruz Mexico....

© Jonathan ©

  • Moderador
  • ******
  • Mensajes: 1671
  • Nacionalidad: ar
    • Ver Perfil
    • http://www.einstec.com.ar
Re: Captar Datos De Un Puerto Paralelo
« Respuesta #3 en: Martes 8 de Marzo de 2005, 03:41 »
0
laux, esto te sera muy util :), es un tutorial para el puerto paralelo y tiene algo de VB. Un abrazo! :)

http://www.modelo.edu.mx/univ/virtech/circuito/dllvb.htm
EINSTEC Tecnología «La única fuente del conocimiento es la experiencia.»

«Lo importante es no dejar de hacerse preguntas.»

laux

  • Miembro activo
  • **
  • Mensajes: 29
    • Ver Perfil
Re: Captar Datos De Un Puerto Paralelo
« Respuesta #4 en: Martes 8 de Marzo de 2005, 12:29 »
0
Gracias, me han ayudado mucho sus informaciones-
A las ordenes,


Laux :kicking:

sejis

  • Nuevo Miembro
  • *
  • Mensajes: 5
    • Ver Perfil
Re: Captar Datos De Un Puerto Paralelo
« Respuesta #5 en: Miércoles 6 de Abril de 2005, 18:33 »
0
Como ya debes saber el purto paralelo es compatible con TTL, por lo tanto si las entradas del puerto estan al aire o no conectadas el resultado de la lectura sera como si todas fuesen uno.

Para trabajar el puerto coo entrada debes configurarlo en el setup del pc en el modo ssp o normal lo que  habilita el modo bidireccional del puerto.

Tambien sabes que el puerto se compone de 3 registros cada uno de ocho bits
, debes mandar un uno al bit 5 del  puerto 379 o al 37A, es uno de los dos pero no recurdo cual con exactitud. Si colocas 1 la direccion 378 funciona como entrada y si colocas 0 sera salida.

Espero haberte ayudado.

DrakerDG

  • Miembro activo
  • **
  • Mensajes: 72
    • Ver Perfil
    • http://drakerdg.xbot.es/wordpress/
Re: Captar Datos De Un Puerto Paralelo
« Respuesta #6 en: Jueves 1 de Septiembre de 2005, 15:11 »
0
:comp: Aquí tienen más información del puerto paralelo y sus registros.

Tambien incluyo una libreria (IO.dll) por medio de la cual se pueden accesar a estos registros desdede Windows 95 a Windows XP.

Las declaraciones en Visual Basic son las siguientes:

Código: Text
  1.  
  2. Public Const LPT1x = &H378
  3.  
  4. Public Declare Sub PortOut Lib "IO.DLL" (ByVal Port As Integer, ByVal Data As Byte)
  5. Public Declare Sub PortWordOut Lib "IO.DLL" (ByVal Port As Integer, ByVal Data As Integer)
  6. Public Declare Sub PortDWordOut Lib "IO.DLL" (ByVal Port As Integer, ByVal Data As Long)
  7. Public Declare Function PortIn Lib "IO.DLL" (ByVal Port As Integer) As Byte
  8. Public Declare Function PortDWordIn Lib "IO.DLL" (ByVal Port As Integer) As Long
  9. Public Declare Sub SetPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit As Byte)
  10. Public Declare Sub ClrPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit As Byte)
  11. Public Declare Sub NotPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit As Byte)
  12. Public Declare Function GetPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit As Byte) As Boolean
  13. Public Declare Function RightPortShift Lib "IO.DLL" (ByVal Port As Integer, ByVal Val As Boolean) As Boolean
  14. Public Declare Function LeftPortShift Lib "IO.DLL" (ByVal Port As Integer, ByVal Val As Boolean) As Boolean
  15. Public Declare Function IsDriverInstalled Lib "IO.DLL" () As Boolean
  16.  
  17.  
  18. '********************************************************
  19. '*********    Function Descriptions   *******************
  20. '********************************************************
  21.  
  22. 'PortOut - Outputs a byte to the specified port.
  23.    
  24. 'PortWordOut - Outputs a word (16-bits) to the specified port.
  25.    
  26. 'PortDWordOut - Outputs a double word (32-bits) to the specified port.
  27.    
  28. 'PortIn - Reads a byte from the specified port.
  29.    
  30. 'PortWordIn - Reads a word (16-bits) from the specified port.
  31.    
  32. 'PortDWordIn - Reads a double word (32-bits) from the specified port.
  33.    
  34. 'SetPortBit - Sets the bit of the specified port.
  35.    
  36. 'ClrPortBit - Clears the bit of the specified port.
  37.    
  38. 'NotPortBit - Nots (inverts) the bit of the specified port.
  39.    
  40. 'GetPortBit - Returns the state of the specified bit.
  41.    
  42. 'RightPortShift - Shifts the specified port to the right. The LSB is
  43. '                 returned, and the value passed becomes the MSB.
  44.    
  45. 'LeftPortShift - Shifts the specified port to the left. The MSB is
  46. '                returned, and the value passed becomes the LSB.
  47.    
  48. 'IsDriverInstalled - Returns non-zero if io.dll is installed and
  49. '                    functioning. The primary purpose of this function
  50. '                    is to ensure that the kernel mode driver for
  51. '                    NT/2000/XP has been installed and is accessible.
  52.  
  53. 'Funciones personalizadas (ejemplo).  
  54.  
  55. Public Function OutPort1(ByVal Num As Byte) As Byte
  56.     PortOut LPT1x, Num
  57.     OutPort1 = Num
  58. End Function
  59.  
  60. Public Function InPort2() As Byte
  61. Dim XB As Byte
  62.     XB = PortIn(LPT1x + 1)
  63.     InPort2 = XB
  64. End Function
  65.  
  66. Public Function OutPort3(ByVal Num As Byte) As Byte
  67.     PortOut LPT1x + 2, Num
  68.     OutPort3 = Num
  69. End Function
  70.  
  71. Public Function InPort3() As Byte
  72. Dim XB As Byte
  73.     XB = PortIn(LPT1x + 2)
  74.     InPort3 = XB
  75. End Function
  76.  
  77.  
  78.  

Revisen el archivo adjunto.

 :suerte:
El mensaje contiene 1 archivo adjunto. Debes ingresar o registrarte para poder verlo y descargarlo.
Saludos desde Guatemala, C. A.
Electrobotics