Autor Tema: MAQUETA DE ENTRENAMIENTO CON 5 PROTOCOLOS  (Leído 8220 veces)

0 Usuarios y 2 Visitantes están viendo este tema.

Desconectado ARMABLANCA

  • PIC10
  • *
  • Mensajes: 18
MAQUETA DE ENTRENAMIENTO CON 5 PROTOCOLOS
« en: 23 de Marzo de 2007, 00:31:12 »
BUENAS A TODOS SOY NUEVO EL FORO Y ES LA PRIMERA VEZ QUE LO VISITO, PERO EN COMPARACION A LOS OTRO QUE HE VISITADO ESTE ME PARESE COMPLETISIMO 100% CON LO QUE YO NESECITO.


ME HE REGISTRADO PRIMERO POR QUE COMO JOBBY ME GUSTA CREAR APLICACIONES CON LOS MICROCONTROLADORES, PERO ADEMAS DE ESTO NESECITO INFORMACION ACERCA DE ESTOS TEMAS:

- USB PARA PIC.
- COMO BAJAR AL ISIS PROTEUS 6.9 EL PIC 18F4455.


YO TRABAJO EN LA UNIVERSIDAD CON EL COMPILADOR DE C PIC C DEVIDO A QUE CON ESTE PUEDO GENERAR MAS FACILMENTE Y RAPIDO LAS APLICACIONES PROPUESTAS EN LAS EVALUACIONES. ADEMAS DESEARIA SAVER QUE FUNCIONES UTILIZAR PARA LA CONFIGURACION Y LA RECEPCION Y TRANSMICION DE INFORMACION DEL PUERTO USB.

TAMBIEN TRABAJAMOS CON EL PROTEUS 6.9 DEVIDO A QUE NOS BRINDA EL DIAGRAMA DEL CIRCUITO YA FUNCIONAL POR QUE COMO SABRAN EN EL MISMO PROGRAMA PODEMOS PROBAR EL PROGRAMA QUE VA A SER IMPLEMENTADO EN EL HARDWARE. MI PROBLEMA CON ESTE SOFTWARE ES QUE NO TRAE INCORPORADO EL PIC QUE UTILIZARE  QUE ES EL 18F4455. DESEARIA SAVER SI HAN LOGRADO AGREGARLO EN EL MISMO Y SI LES HA FUNCIONADO BIEN.

POR OTRA PARTE LES DOY UNA BUENA NOTICIA: TODA LA INFORMACION QUE GENERE MI PROYECTO DE GRADO SERA PUBLICADA AQUI DEVIDO A QUE ME PIENSO QUEDAR EN EL FORO POR QUE ME PARESE MAS QUE EXELENTE.

A SE ME OLVIDAVA DECIRLE LOS PROTOCOLOS QUE MANEJA LA MAQUETA:

I2C
RS-232
RS-485
ISP
USB

I2C,RS-232,RS485 LOS MANEJO A LA PERFECCION PERO USB NI IDEA DE COMO EMPEZAR A PROGRAMARLO EN PIC C PERO SI SE INFORMACION DL MISMO LO QUE ME FRENA ES COMO HACER LO EN MI COMPILADOR.

ISP POR LO QUE HE LEIDO ES UNA VERCION COMO ANTERIOR DEL I2C QUE POR CIERTO ES MI PROTOCOLO DE COMUNICACION FAVORITO JEJE CON EL HE DESECHO MI PROTOBOARD JEJE PRACTICAMENTE.

COMO ESTUDIANTE DESEO FINALIZAR EL PROYECTO Y COMO ELECTRONICO (CASI) DESEARIA COMPARTIR TODA LA INFORMACION QUE GENERE MI PROYECTO ADEMAS DE SAVER LA OPINION CONSTRUCTIVA DEL MISMO

SIN MAS QUE DECIR QUEDO DE MANOS DE USTEDES NOS VEMOS LUEGO.

Desconectado maunix

  • Moderadores
  • DsPIC33
  • *****
  • Mensajes: 4751
    • Mi Sitio Web Personal
Re: MAQUETA DE ENTRENAMIENTO CON 5 PROTOCOLOS
« Respuesta #1 en: 23 de Marzo de 2007, 12:24:32 »
Bien Armablanca, me alegro de que quieras subir algo para colaborar sobre todo con los que recién comienzan :)

A propósito , ¿que sería el ISP?  veo que lo escribiste varias veces así que supongo no hablas del ICSP.
- La soberbia de un Einstein es entendible.. la de un salame es intolerable (A.Dolina)
- En teoría no hay diferencia entre la teoría y la práctica. En la práctica... si la hay.
- Lee, Lee, Lee y luego pregunta.(maunix)
- Las que conducen y arrastran al mundo no son las máquinas, sino las ideas (V. Hugo)
- Todos los hombres se parecen por sus palabras; solamente las obras evidencian que no son iguales.(Moliere)
- Todo debería ser hecho tan simple como sea posible pero no mas simple que eso.(A.Einstein)

Desconectado elreypic2

  • Colaborador
  • PIC24H
  • *****
  • Mensajes: 1297
Re: MAQUETA DE ENTRENAMIENTO CON 5 PROTOCOLOS
« Respuesta #2 en: 23 de Marzo de 2007, 13:40:28 »
Que tal amigos:

Supongo que arma blanca quiso decir SPI y no ISP???

Bueno de cualquier manera aqui estamos para ayudarte. Para la lo USB el amigo PIC Mouse esta desarrolando un proyecto bastante interesante el cual pudieras tomar como referencia para lo de USB.

Saludos.

Elreypic.

Desconectado ARMABLANCA

  • PIC10
  • *
  • Mensajes: 18
Re: MAQUETA DE ENTRENAMIENTO CON 5 PROTOCOLOS
« Respuesta #3 en: 24 de Marzo de 2007, 02:44:01 »
ES CORRECTO NO HABLO DEL ICSP (IN CIRCUIT SERIAL PROGRAM).


SI HABLO DE SPI, QUE POR LO QUE TENGO ENTENDIDO ES EL PROTOCOLO DE DONDE SALIO EL I2C.


ADEMAS SI TIENEN INFORMACION ACERCA DE LA LIBRERIA DEL PROTEUS 6.9 PARA EL PIC 18F4455 DESEARIAQUE ME AYUDARAN A CONSEGIRLA YA QUE CON ESTO EL TRABAJO A REALIZAR SERIA MUCHO MAS FASIL DE TERMINAR.


GRACIAS POR LA AYUDA. QUEDO DE USTEDES.



Desconectado ARMABLANCA

  • PIC10
  • *
  • Mensajes: 18
Re: MAQUETA DE ENTRENAMIENTO CON 5 PROTOCOLOS
« Respuesta #4 en: 27 de Marzo de 2007, 00:03:12 »
hermanos desearia que me ayudaran mas veo que nadie postea aqui devido a nose que.

la maqueta es educativa es mi proyecto de grado ademas la misma manejara muchas inplementaciones de electronica y tambien esta siendo diseñada para la instrumentacion y control.

deseo obtener ayuda porfaaaaaaaaaaa.

diganme si la libreria de proteus existe y ademas las funciones de picc para usb utilizar.

Desconectado PHLAKO

  • PIC10
  • *
  • Mensajes: 49
Re: MAQUETA DE ENTRENAMIENTO CON 5 PROTOCOLOS
« Respuesta #5 en: 27 de Marzo de 2007, 10:41:06 »
compadre, el I2C no sale del SPI, como ya lo sabras I2C es de la PHILIPS y la comunicacion es a traves de 2 hilos, uno con el clock y el otro hilo es de data bidireccional. El SPI igual tiene reloj de sincronizacion, pero tiene 2 hilos mas para enviar data y recibir data, por separado :)
lamento no poder ayudarte ya que mi lenguaje es el ASM :)

surte :)

chaos :)
SIEMPRE TE RECORDARE AMADO Y FIEL COMPAÑERO "LOBO"

Desconectado elreypic2

  • Colaborador
  • PIC24H
  • *****
  • Mensajes: 1297
Re: MAQUETA DE ENTRENAMIENTO CON 5 PROTOCOLOS
« Respuesta #6 en: 27 de Marzo de 2007, 12:02:42 »
Que tal Arma Blanca (pero no es un frasco de leche verdad?  :D):

Volviendo a lo que interesa. SPI es un protcolo serial sincrono diseniado por motorola como competencia al I2C de Philips. La ventaja que presenta el SPI es que se pueden alcanzar velocidades de hasta 20 MHz o mas. Pero una pequenia desventaja es la cantidad de pines que se ocupan, que son 4. SDO,SDI, SCK y CS.

En cuanto al USB te recomiento ver las notas de aplicacion de microchip sobre todo la que esta usando PIC Mouse. Esa es la mejor fuente de info que hay en cuanto a USB se refiere.

Saludos.

Elreypic.

Desconectado ARMABLANCA

  • PIC10
  • *
  • Mensajes: 18
Re: MAQUETA DE ENTRENAMIENTO CON 5 PROTOCOLOS
« Respuesta #7 en: 28 de Marzo de 2007, 01:20:59 »
GRACIAS POR LA ACLARACION QUE ME HICISTES PHLAKO ESTABA EQUIVOCADO PERO LO QUE HABIA LEIDO DE SPI SE ME ASEMEJO AL I2C AORA SI ME VOY A TODAS POR LA INTERFAS SPI PERO COMO ES UNA MAQUETA DE ENTRENAMIENTO DEVERE UTILIZAR I2C PARA QUE LOS ESTUDIANTES QUE UTILISEN LA MISMA APRENDAN LAS VONDADES DE LOS DOS PROTOCOLOS.

EN CUANTO AL PROGRESO DE LA MAQUETA MAÑANA TRATARE DE REALIZAR EL RECONOCIMIENTO DEL PIC POR LA PC YA QUE HE ENCONTRADO INFORMACION DE DISTINTAS FUNCIONES EN PICC PARA REALIZAR LA INTERFAZ.

BUENO MAÑANA LES CONTARE LO QUE PASO.

Desconectado ARMABLANCA

  • PIC10
  • *
  • Mensajes: 18
Re: MAQUETA DE ENTRENAMIENTO CON 5 PROTOCOLOS
« Respuesta #8 en: 30 de Marzo de 2007, 01:03:21 »
bueno disculpen hoy fue que vine a leer las regals del foro les pido mil disculpas por todas la mallusculas en los anteriores post:


bueno segun lo que practique hoy trate de programar al micro con el programador jdm y el software winpic. de momento no el winpic no reconocio el mismo nose por que tengo esa duda. asi que decidi probar con el programador del instituto que es el picstart de la microchip tratando de programarlo desde mplab7.10 sin poder obtener resultados el mismo arrojo errores en la memoria lo cual produjo no poder quemar el pic.

para mañana mi tutor se reunira conmigo y mi compañero a solucionar los distintos problemas que se nos han presentado. mas que solucionar sera a aportar ideas para ver que camino elegimos para resolver dichos inconveninentes.

mil disculpa por no haber leido antes las reglas del foro........ :(

Desconectado Sir Viciony

  • PIC10
  • *
  • Mensajes: 14
Re: MAQUETA DE ENTRENAMIENTO CON 5 PROTOCOLOS
« Respuesta #9 en: 05 de Abril de 2007, 20:22:26 »
Hola ARMABLANCA, yo podria ayudarte con la comunicacion USB, utilizo lenguaje C de CCS (para el micro) y Visual Baisc 6.0 (para el software).

Una pregunta ¿Ocupas todos los protocolos en un mismo micro?


P.D. alguien me puede explicar las diferencia entre los protocolos RS-232 y RS-485 se los agradeceria mucho

Desconectado todopic

  • Administrador
  • DsPIC30
  • *******
  • Mensajes: 3495
    • http://www.todopicelectronica.com.ar
Re: MAQUETA DE ENTRENAMIENTO CON 5 PROTOCOLOS
« Respuesta #10 en: 06 de Abril de 2007, 20:33:25 »
Hola Viciony, hay que diferenciar lo que es NORMA de lo que es PROTOCOLO, ya que se presta a confusión
para no complicarte la cosa, digamos que un pic que tienes programado un pic para comunicar por RS232 empleas un integrado que transforma tus unos y ceros de nivel TTL a -15 y + 15 voltios, si en lugar de el max colocas un SN75176, tendras dos salidas opuestas llamadas A y B con tensiones de 0 a 5 voltios..

coloca en el buscador RS485 y encontraras esto
http://www.todopic.com.ar/foros/index.php?action=search2

suerte!  :mrgreen:

Norberto
Firmat - Santa Fe - Argentina

www.TodoPic.net

Solo se tiran piedras, al arbol que tiene frutos...

Desconectado Sir Viciony

  • PIC10
  • *
  • Mensajes: 14
Re: MAQUETA DE ENTRENAMIENTO CON 5 PROTOCOLOS
« Respuesta #11 en: 06 de Abril de 2007, 23:00:33 »
Gracias Norberto  :), creo ke yo si estaba confundido  :?

Desconectado ARMABLANCA

  • PIC10
  • *
  • Mensajes: 18
Re: MAQUETA DE ENTRENAMIENTO CON 5 PROTOCOLOS
« Respuesta #12 en: 09 de Abril de 2007, 01:27:09 »
hola sir viciony respondiando tarde pero seguro no havia podido tener tiempo para meterme en el foro.

respondiendo a tu pregunta si ocupo todos los protocolos con el mismo micro es cierto los 5 protocolos que en relidad son 4 mas rs-485. son todos im0plementados al mismo tiempo en el micro y la maqueta pero no te confundas todos no son utilizados al mismo tiempo cada uno sera implementado por separado para el entrenami8ento de los estudiantes.


bueno con respecto a la diferencia entre los protocolos RS-232 y RS-485 son grandes devido a que el protocolo de pic RS-232 es de tipo TTL y es convertido por como bien se sabe por un MAX232 o areglo de transistores a las tenciones originales del protocolo que van desde 12V a -12V ademas de esto la informacion es decir los unos y ceros en dicho protocolo estan referenciadas a tierra o GND en cambio en el protocolo RS-485 la informacion se envia y recive enla forma de tenciones diferenciales entre el par de hilos que utiliza el mismo protocolo (en el caso que no utilises señales de control).

con el protocolo RS-232 se alcansan distencias de 15 metros y con el RS-485 las distancias aumentan elo doble me imagino yo que es devido por la forma de envio de datos que  es por tenciones diferenciales.


en cuanto a los niveles de voltaje en el RS-485 no estoy al tanto de esto seguro te lo averigua para ofrecerte la informacion completa ademas de esto tambien deves tener un integrado que te aga la traduccion de RS-232 a RS-485 el cual es el MAX487 o puedes encontrar otro que se adapte mas a la palicacio que estas realizando.

aqui esta el data sheet para que lo veas http://www.datasheetcatalog.com/datasheets_pdf/M/A/X/4/MAX487.shtml


bueno ya que me afrecistes ayuda acerca del desarrollo con el puerto usb te muestro lo que tengo para la inplementacion:;


empecemos con lo de visual:

tengo dos modulos para el manejo del protocolo los consegui ase poco no se como funcionan te los muestro para ver que piensas acerca de ellos

uno es el HIDinterface:
*********************************************************************************************************
'   This module is common to all of the Example programs
'   It declares the {Open, Read, Write, Close} calls for the USB device
'       These user-calls are translated into OS system calls
'   This module also contains several support routines used by all of the examples
'
'   Declare module-wide variables
Private HidHandle As Long
Public Function OpenUSBdevice(NameOfDevice$) As Boolean
' This function searches the system HID tables for NameOfDevice$
' If found then it opens the device and returns TRUE, else it returns FALSE
Dim HidGuid As Guid: Dim Success As Boolean: Dim Openned As Boolean: Dim Buffer(256) As Byte
Dim DeviceInterfaceData As Device_Interface_Data
Dim FunctionClassDeviceData As Device_Interface_Detail
'
'   First, get the HID class identifier
Call HidD_GetHidGuid(HidGuid.Data(0))
'   Get a handle for the Plug and Play node, request currently active HID devices
PnPHandle& = SetupDiGetClassDevs(HidGuid.Data(0), 0, 0, &H12)
If (PnPHandle& = -1) Then ErrorExit ("Could not attach to PnP node")
'
HidEntry& = 0: Openned = False
DeviceInterfaceData.cbsize = 28 'Length of data structure in bytes
'   Look through the table of HID devices
Do While SetupDiEnumDeviceInterfaces(PnPHandle&, 0, HidGuid.Data(0), HidEntry&, DeviceInterfaceData.cbsize)
'   There is a device here, get it's name
    FunctionClassDeviceData.cbsize = 5
    Success = SetupDiGetDeviceInterfaceDetail(PnPHandle&, DeviceInterfaceData.cbsize, _
            FunctionClassDeviceData.cbsize, UBound(FunctionClassDeviceData.DataPath), BytesReturned&, 0)
    If (Success = 0) Then ErrorExit ("Could not get the name of this HID device")
' Convert returned C string to Visual Basic String
    hidname$ = "": i& = 0
    Do While FunctionClassDeviceData.DataPath(i&) <> 0
        hidname$ = hidname$ & Chr$(FunctionClassDeviceData.DataPath(i&)): i& = i& + 1: Loop
' Can now open this HID device
    Dim SA As Security_Attributes
    HidHandle& = CreateFile(hidname$, &HC0000000, 3, SA, 3, 0, 0)
    If (HidHandle = -1) Then ErrorExit ("Could not open HID device")
' Is it OUR HID device?
    If HidD_GetProductString(HidHandle&, AddressFor(Buffer(0)), UBound(Buffer)) Then
        DeviceName$ = "": i& = 0
        Do While Buffer(i&) <> 0: DeviceName$ = DeviceName$ & Chr$(Buffer(i&)): i& = i& + 2: Loop
        If (StrComp(DeviceName$, NameOfDevice$) = 0) Then
            Openned = True: Exit Do: End If
        End If 'HidD_GetProductString
    Call CloseHandle(HidHandle&) ' Was not OUR HID device
    HidEntry& = HidEntry& + 1 ' Check next entry
    Loop 'SetupDiEnumDeviceInterfaces returns FALSE when there are no more entries
SetupDiDestroyDeviceInfoList (PnPHandle&)
OpenUSBdevice = Openned
End Function
Public Sub ReadUSBdevice(BufferPtr&, ByteCount&)
' This subroutine "reads" from an openned USB device
' This routine gets an Input Report from the USB device and returns the data
' NOTE that ReadFile is a BLOCKING system call, ie it will wait for the USB device to respond
' Do not configure the USB device to "Generate report only on change" since the program
' will appear to 'hang'
' Use a local buffer so that the ReportID (=0) at ReportBuffer(0) may be removed
Dim ReportBuffer(256) As Byte
If ByteCount& > 254 Then ErrorExit ("Maximum ByteCount for ReadUSBdevice is 254")
If ByteCount& < 1 Then ErrorExit ("Minimum ByteCount for ReadUSBdevice is 1")
Success = ReadFile(HidHandle&, AddressFor(ReportBuffer(0)), ByteCount& + 1, BytesReturned&, 0)
If (Success = 0) Then ErrorExit ("Could not get an Input Report")
Call CopyBuffer(AddressFor(ReportBuffer(1)), BufferPtr&, BytesReturned& - 1)
End Sub
Public Sub WriteUSBdevice(BufferPtr&, ByteCount&)
' This subroutine "writes" to an openned USB device
' Copy the user buffer into a local buffer so that a ReportID (=0) may be prepended
' The first byte will contain the ReportID (=0)
Dim ReportBuffer(256) As Byte
If ByteCount& > 254 Then ErrorExit ("Maximum ByteCount for WriteUSBdevice is 254")
Call CopyBuffer(BufferPtr&, AddressFor(ReportBuffer(1)), ByteCount&)
ReportBuffer(0) = 0 ' ReportID
Success = WriteFile(HidHandle&, AddressFor(ReportBuffer(0)), ByteCount& + 1, BytesWritten&, 0)
If (Success = 0) Then ErrorExit ("Could not write an Output Report")
End Sub
Public Sub CloseUSBdevice()
' This subroutine closes the USB device that we have been using
Call CloseHandle(HidHandle&)
End Sub
Public Function ReturnHexByte(Text$) As Byte
' Converts the first two characters of text$ into a byte
Dim Value As Byte
Utext$ = UCase(Text$) ' Convert to uppercase for search
HexString$ = "0123456789ABCDEF" ' Non-Hex characters = 0
Value = 0
For i& = 0 To 15
    If Mid(Utext$, 1, 1) = Mid(HexString$, i& + 1, 1) Then Value = Value + (16 * i&)
    If Mid(Utext$, 2, 1) = Mid(HexString$, i& + 1, 1) Then Value = Value + i&
    Next i&
ReturnHexByte = Value
End Function
Public Function TwoHexCharacters$(Value As Byte)
HexString$ = "0123456789ABCDEF"
TwoHexCharacters$ = Mid(HexString$, Int(Value / 16) + 1, 1) & Mid(HexString$, Int(Value And &HF) + 1, 1)
End Function
Public Function TwoDecimalCharacters$(Value As Byte)
DecimalString$ = "0123456789"
Tens& = Int(Value / 10): Units& = Value - (10 * Tens&)
TwoDecimalCharacters$ = Mid(DecimalString$, Tens& + 1, 1) & Mid(DecimalString$, Units& + 1, 1)
End Function
Public Function ThreeDecimalCharacters$(Value As Byte)
h& = Int(Value / 100): t& = Int((Value - (100 * h&)) / 10): u& = Value - (100 * h&) - (10 * t&)
ThreeDecimalCharacters$ = h& & t& & u&
End Function
Public Sub ErrorExit(Reason$)
ErrorCode = GetLastError()
Call MsgBox(Reason$, vbCritical)
If ErrorCode <> 0 Then
    Stop
    End If
End Sub
*********************************************************************************************************


y el otro es el USBinterface

*********************************************************************************************************

'
'   Declare all of the USB Data Structures
'
'   Note that most of these Data Structures MUST be defined a BYTES.
'   This prevents Visual Basic "helpfully" aligning variables on their natural byte boundaries.
'   Little Endian is assumed. ie If Byte(3)= Long,  Then byte(0) = LSB
'
Public Type UNameType: Length As Long: UnicodeName(256) As Byte: End Type
Public Type UNodeType: ConnectionIndex As Long: Length As Long: UnicodeName(256) As Byte: End Type

Public Type SetupPacket
    RequestType As Byte: Request As Byte: wValueLo As Byte: wValueHi As Byte: wIndex As Integer: wLength As Integer: End Type

Public Type DescriptorRequest
    ConnectionIndex As Long: PacketData As SetupPacket: ConfigurationDescriptor(2000) As Byte: End Type
   
Public Type DeviceDescriptor
     Contents(17) As Byte: End Type
' Defined as a Byte Array to make later data movement simpler
'    Length As Byte:    DescriptorType As Byte:    USBSpec(1) As Byte:    Class As Byte
'    SubClass As Byte:  Protocol As Byte:          MaxEP0Size As Byte:    VendorID(1) As Byte
'    ProductID(1) As Byte:       DeviceRevision(1) As Byte:       ManufacturerStringIndex As Byte
'    ProductStringIndex As Byte: SerialNumberStringIndex As Byte: ConfigurationCount As Byte: End Type

Public Type HubDescriptor
    Length As Byte:       HubType As Byte:    PortCount As Byte:     Characteristics(1) As Byte
    PowerOn2Good As Byte: MaxCurrent As Byte: PowerMask(63) As Byte: End Type

Public Type EndPointDescriptor
    Length As Byte:     DescriptorType As Byte:   EndpointAddress As Byte
    Attributes As Byte: MaxPacketSize(1) As Byte: PollingInterval As Byte: End Type

Public Type NodeInformation
    NodeType As Long: NodeDescriptor As HubDescriptor: HubIsBusPowered As Byte: End Type

Public Type NodeConnectionInformation
    ConnectionIndex As Long: ThisDevice As DeviceDescriptor: CurrentConfiguration As Byte
    LowSpeed As Byte: DeviceIsHub As Byte: DeviceAddress(1) As Byte: NumberOfOpenEndPoints(3) As Byte
    ThisConnectionStatus(3) As Byte: MyEndPoints(29) As EndPointDescriptor: End Type

'   I keep all of the IO Device information I collect in a big table
'   Most USB installations will only fill part of this table
Public Type CollectedDeviceData
    DeviceType As Long: DeviceHandle As Long: ConnectionData As NodeConnectionInformation
    NodeData As NodeInformation: End Type
Public DeviceData(200) As CollectedDeviceData
'
'   All Descriptors are concatenated here once a device is selected
Public DescriptorData(2000) As Byte
'
'   I need to send Requests to USB devices
Public PCHostRequest As DescriptorRequest
'
Public ConnectionStatus(6) As String
'
'   Declare my support sub-routines
Public Function DataIndex()
' All writes to the DeviceData table are done to entry DataIndex
' Need to keep DeviceData and IODevice_Display in sync
DataIndex = Collect_Data.Device_Display.ListCount
End Function
Public Function OpenConnection(Name$)
Dim SA As Security_Attributes
Handle& = CreateFile("\\.\" & Name$, &HC0000000, 3, SA, 3, 0, 0)
If Handle& = 0 Then ErrorExit ("Could not open a connection to " & Name$)
OpenConnection = Handle&
End Function
Public Sub GetNodeInformation(Handle&)
'   Get the node information
Dim BytesReturned&, Status&
Status& = DeviceIoControl(Handle&, &H220408, DeviceData(DataIndex).NodeData.NodeType, 256, DeviceData(DataIndex).NodeData.NodeType, 256, BytesReturned&, 0)
If Status& = 0 Then ErrorExit ("Could not get node information")
If BytesReturned& > 256 Then ErrorExit ("DeviceIOControl returned >256 bytes of data")
End Sub
Public Sub GetNodeConnectionData(Handle&, PortIndex&)
Dim BytesReturned&, Status&
DeviceData(DataIndex).ConnectionData.ConnectionIndex = PortIndex&
Status& = DeviceIoControl(Handle&, &H22040C, DeviceData(DataIndex).ConnectionData.ConnectionIndex, 256, DeviceData(DataIndex).ConnectionData.ConnectionIndex, 256, BytesReturned&, 0)
If Status& = 0 Then ErrorExit ("Could not get Node Connection Data")
If BytesReturned& > 256 Then ErrorExit ("DeviceIOControl returned >256 bytes of data")
End Sub
Function GetNameOf$(DeviceName$, DeviceHandle&, API_ID&)
Dim NameBuffer As UNameType
'
'   First need to get the length of the name string
Status& = DeviceIoControl(DeviceHandle&, API_ID&, 0, 0, NameBuffer.Length, 260, BytesReturned&, 0)
If Status& = 0 Then ErrorExit ("Could not get LENGTH of " & DeviceName$ & " Name")
If NameBuffer.Length > 256 Then ErrorExit (Name$ & " Name > 256 Characters")
'
'   . . . and then the string. It will be returned in UNICODE format
Status& = DeviceIoControl(DeviceHandle&, API_ID&, NameBuffer.Length, NameBuffer.Length, NameBuffer.Length, NameBuffer.Length, BytesReturned&, 0)
If Status& = 0 Then ErrorExit ("Could not get TEXT of " & DeviceName$ & " Name")
temp$ = "": i = 0   'A simple unicode to basic string conversion
Do While NameBuffer.UnicodeName(i) <> 0: temp$ = temp$ & Chr(NameBuffer.UnicodeName(i)): i = i + 2: Loop
GetNameOf$ = temp$ 'StrConv(NameBuffer.Length, vbFromUnicode)
End Function
Function GetExternalHubName$(ConnectionIndex&, DeviceHandle&)
Dim NameBuffer As UNodeType
'
'   First need to get the length of the name string
NameBuffer.ConnectionIndex = ConnectionIndex
Status& = DeviceIoControl(DeviceHandle&, &H220414, NameBuffer.ConnectionIndex, 260, NameBuffer.ConnectionIndex, 260, BytesReturned&, CNull)
If Status& = 0 Then ErrorExit ("Could not get LENGTH of External Hub Name")
If NameBuffer.Length > 256 Then ErrorExit ("External Hub Name > 256 Characters")
'
'   . . . and then the string. It will be returned in UNICODE format
NameBuffer.ConnectionIndex = ConnectionIndex
Status& = DeviceIoControl(DeviceHandle&, &H220414, NameBuffer.ConnectionIndex, NameBuffer.Length, NameBuffer.ConnectionIndex, NameBuffer.Length, BytesReturned&, 0)
If Status& = 0 Then ErrorExit ("Could not get TEXT of External Hub Name")
temp$ = "": i = 0
Do While NameBuffer.UnicodeName(i) <> 0: temp$ = temp$ & Chr(NameBuffer.UnicodeName(i)): i = i + 2: Loop
GetExternalHubName$ = temp$
End Function

*********************************************************************************************************


estos son los modulos que tengo para la coneccion quisiera saver si con esto puedo empezar a programar y si nesecito otro o tienes algo mejor que los que tengo para estableser la interfas.


****************____________________________________________________________*****************************



bueno con recpecto a la programacion en el pic cuento con la librerias que me trajo el conpilador y ademas de esto unos cuantos programas que encontre en internet de red_raven en su pagina en dos de el utiliza librerias tanvien para establecer la interfas ademas de esto quisiera saber que tienes tu que me pueda ayudar en esta parte por que es aqui donde la informacion en escasa.


muchas gracias y disculpa la tardansa en responderte....


Desconectado Sir Viciony

  • PIC10
  • *
  • Mensajes: 14
Re: MAQUETA DE ENTRENAMIENTO CON 5 PROTOCOLOS
« Respuesta #13 en: 09 de Abril de 2007, 20:02:50 »
Al parecer tu primer modulo es Hid y el segundo la verdad no se en que modo opere, pero bueno, yo uso el modo Bulk Transfers, el cual me he basado de la pagina de RedPic y de J1M (que son unas excelentes paginas de pic's); para el programa de Visual Basic he usado el proyecto que elaboro Ernesto Mozota que subió J1M en su pagina, las primeras pruebas que hice son:

1.- Tomar el valor del ADC de AN0
2.- Tomar el valor del PuertoB (Entrada)
3.- Mostar el valor enviado en el PuertoD (Salida)

ya con eso esta facil de comprender lo la comunicacion usb :)

por cierto, para la comunicacion I2C y SPI piensas usar expansores de puertos (ejem. MCP23XXX y MCP23SXXX) para probar la comunicacion?



Desconectado ARMABLANCA

  • PIC10
  • *
  • Mensajes: 18
Re: MAQUETA DE ENTRENAMIENTO CON 5 PROTOCOLOS
« Respuesta #14 en: 10 de Abril de 2007, 00:08:20 »
hasta aora por lo que veo el instituto no ha podido encontrar los conponentes para trabajar con spi pero con i2c si tenemos una experiencia como para decir que este protocolo lo menejamos bien, esos conponentes que pones en el post no se que hacen averiguare y vere su posible implementacion en la maqueta.

bueno aparte de eso quiesiera saber si me puedes decir donde puedo bajar algun modulo para la tranmicion y recepcion en visual por el tipo bulk. yo estare por mi cuenta tratando de buscarlo para ver que consigo gracias de verdad espero sigas en contacto, ademas no elvides que publicare todo lo realizado hasta donde llegue en el proyecto de grado asi habra mas informacion para los cuales quieran empesar con este mundo  :D :D :D :D :D del usb. gracias.


 

anything