uControl
Septiembre 08, 2010, 07:58:43 *
Bienvenido(a), Visitante. Por favor, ingresa o regístrate.

Ingresar con nombre de usuario, contraseña y duración de la sesión
 
   Inicio   Ayuda Buscar Ingresar Registrarse  
Páginas: « 1 2 3 4 5 6 7 8 9   Ir Abajo
  Imprimir  
Autor Tema: Proyecto USB CDC PIC18f4550 en visual basic  (Leído 21307 veces)
0 Usuarios y 1 Visitante están viendo este tema.
Waldillo
Moderator
PIC16F
*****
Desconectado Desconectado

Sexo: Masculino
Mensajes: 508


Casado con PIC infiel con ARM


WWW
« Respuesta #120 : Julio 02, 2010, 09:47:50 »

Ale todos a aprender c18, que está sencillo, sencillo.
http://www.ucontrol.com.ar/forosmf/tutoriales-guias-y-cursos-en-ucontrol/tutorial-mplab-c18-desde-0-comentarios-dudas-yu-opiniones/

« Última modificación: Julio 29, 2010, 04:22:21 por Waldillo » En línea

Nesby Bone
PIC10F
*
Desconectado Desconectado

Mensajes: 1


« Respuesta #121 : Julio 28, 2010, 03:10:33 »

Hola Waldillo!!!

En tu esquemático, bueno en todos usas un oscilador de 48MHz alimentado. Porque usas de este tipo? Cuales son las Ventajas? Ya que comparado con los tradicionales es muy grande.

Otra consulta! Ya cuando la tarjeta ha sido reconocida por el SO e instalado el driver siempre quedan parpadeando uno a la vez los LED1 y 2? Con que objetivo lo hiciste así esto?

Y la consulta mas importante... Según tu memoria para lograr la comunicación del soft de control con el hard basta con identificar bien el VID&PID en archivo usbdsc.c y editar los ID al que corresponde el driver del soft control a utilizar. Esto lo hice con el soft de control USBCNC y el SO identifico el hard como el que usa el sof de control USBCNC. Todo bien hasta ahí. Pero! Hasta ahí, es decir, el SO lo reconoce pero realmente con el soft USBCNC no se comunica ya que intente capturar la comunicación y solo me capturaba algunas lineas y solo cuando iniciaba el soft de control, después perdía la comunicación. Con tu proyecto USBdemo board no tuve problemas para capturar la comunicación, todos las palabras L_ON, L_OFF, VERS y DATA los capturaba.

Driver usbcnc_cdc.inf del programa USBCNC:

Código:

[size=10pt]; cdcacmpo.inf
;
; Installation file (.inf) for the USB Serial device driver.
;
; Copyright © 2005-2009 EdingCNC
;
; This file supports:
;     Windows XP
;     Windows Server 2003
;     Windows Vista
;     Windows 7


[Version]
Signature="$Windows NT$"
Provider=%S_Provider%
ClassGUID={4d36e978-e325-11ce-bfc1-08002be10318}
Class=Ports
CatalogFile=usbcnc_cdc.cat
DriverVer=10/08/2009,1.83.0.0

;
; Driver information
;

[Manufacturer]
%S_Mfg%=_Devices

[_Devices]
; enter your VID (VVVV) and PID (PPPP) here
%S_DeviceDesc1%=Install,USB\VID_16C0&PID_0564      ;EL PROGRAMA USBCNC USA ESTOS ID EL CUAL PUSE EN EL ARCHIVO usbdsc.c!!!
; if a multi interface driver is installed enter also the interface number (II)
; %S_DeviceDesc1%=Install,USB\VID_VVVV&PID_PPPP&MI_II
; for more information have a look at the documentation

;
; General installation section
;

[Install.ntx86]
CopyFiles=_CopyFiles_sys
AddReg=Common_AddReg

[Install.ntx86.HW]
AddReg=_AddReg_Param

;
; Service Installation
;

[Install.ntx86.Services]
AddService = %S_ServiceName%, 0x00000002 , Install_Service_Inst, Install_EventLog_Inst
AddReg = _AddRegService

[Install_Service_Inst]
ServiceType    = 1                  ; SERVICE_KERNEL_DRIVER
StartType      = 3                  ; SERVICE_DEMAND_START
ErrorControl   = 1                  ; SERVICE_ERROR_NORMAL
ServiceBinary  = %12%\%S_DriverName%.sys


[Install_EventLog_Inst]
AddReg = Install_EventLog_AddReg

[Install_EventLog_AddReg]
HKR,,EventMessageFile,0x00020000,"%SystemRoot%\System32\IoLogMsg.dll;%SystemRoot%\System32\drivers\%S_DriverName%.sys"
HKR,,TypesSupported,0x00010001,7


[_AddRegService]
HKR,,Parameters,,,


[_AddReg_Param]
; *********************************************************************
; *** the read buffer size grater than the FIFO size requires short ***
; *** packets from the device, see documentation for details!       ***
; *********************************************************************
HKR,,ReadBufferSize,  %REG_DWORD%, 1024
HKR,,WriteBufferSize, %REG_DWORD%, 1024
HKR,,UseLogicBuffer,  %REG_DWORD%, 0
HKR,,ReadBufferCount, %REG_DWORD%, 1
HKR,,WriteBufferCount,%REG_DWORD%, 1
HKR,,SendLineCoding,  %REG_DWORD%, 1
HKR,,SendLineState,   %REG_DWORD%, 1
HKR,,SendBreak,       %REG_DWORD%, 1

; 0 - CDCACM, 1 - Bulk Only, 2 - Bulk special, 3 - automatic
HKR,,OperationMode,%REG_DWORD%, 3

; set this to 0 to suppress the Clear Feature Endpoint Halt during Open and Wakeup
; this does not work on Windows 2000!
HKR,,ClearFeatureOnStart,%REG_DWORD%, 0
HKR,,VendorPipeReset,%REG_DWORD%, 0

; default serial line states reported in bulk only mode or
; if the device never updates the status values
; use a or'ed value of: CTS=0x10, DSR=0x20, RI=0x40, DCD=0x80
HKR,,DefaultLineState,%REG_DWORD%, 0x10

; the next line enables the private interface, comment it, if it is not required
; create a new GUID and use the new GUID instead of this
; use the new GUID as an argument to CPortInfo::EnumeratePorts();
HKR,,DriverUserInterfaceGuid,%REG_SZ%,"{0445522E-ABE5-4c52-8882-CA3272D2B3AE}"



HKR,,StaticDeviceObject,%REG_DWORD%,0
HKR,,ClearRtsDtrOnClose,%REG_DWORD%,0

; the default prefix for the device object
HKR,,DeviceObjectName,%REG_SZ%,"thcdcacm"


[Common_AddReg]
; is a serial port
HKR,,PortSubClass,1,01
; property page, system default
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"

[DestinationDirs]
DefaultDestDir   = 12
_CopyFiles_sys = 12

;
; Source file information
;

[SourceDisksNames.x86]
1 = %S_DiskName%,,,""

[SourceDisksFiles.x86]
usbcnc_cdc.sys = 1,,

[_CopyFiles_sys]
usbcnc_cdc.sys,,,0x00000004

[Strings]

;
; Non-Localizable Strings
;

REG_SZ         = 0x00000000
REG_MULTI_SZ   = 0x00010000
REG_EXPAND_SZ  = 0x00020000
REG_BINARY     = 0x00000001
REG_DWORD      = 0x00010001
SERVICEROOT    = "System\CurrentControlSet\Services"

;
; Localizable Strings
;
S_Provider="EdingCNC"
S_Mfg="EdingCNC"
S_DeviceDesc1="USBCNC COM Port"
S_DiskName="USB CDC/ACM Class Driver for Windows disk"
S_DriverName="usbcnc_cdc"
S_ServiceName="usbcnc_cdc"[/size]


Gracias por el apoyo Waldillo!

Saludos
« Última modificación: Julio 29, 2010, 04:49:47 por Waldillo » En línea
Waldillo
Moderator
PIC16F
*****
Desconectado Desconectado

Sexo: Masculino
Mensajes: 508


Casado con PIC infiel con ARM


WWW
« Respuesta #122 : Julio 29, 2010, 04:23:26 »

Citar
1.-En tu esquemático, bueno en todos usas un oscilador de 48MHz alimentado. Porque usas de este tipo? Cuales son las Ventajas? Ya que comparado con los tradicionales es muy grande.

El Modulo USB del PIC 18F4550 necesita trabajar a una frecuencia de reloj de 48MHz, para sincronizarse. Simplemente es esta la cuestión. Obviamente puedes elegir otro cristal y hacer PLL. Los resultados son los mismos, USB sincronizado  Grin.
La razón por la que utilicé este cristal es que en la universidad disponia de ellos y obviamente son mas precisos, pero tb mas caros.

Citar
2.-Ya cuando la tarjeta ha sido reconocida por el SO e instalado el driver siempre quedan parpadeando uno a la vez los LED1 y 2? Con que objetivo lo hiciste así esto?

Sirve en la fase de depuración para saber en que proceso de la enumeración está dispositivo USB. Viene bien en los procesos iniciales del desarrollo del firmware. Luego se quedaron ahi. Esos leds se encienden con la funcion creo recordar. USBledStatus o algo asi jejeje. Mi memoria falla.

ARCHIVO .INF

Citar
3.- TEMA VID&PID

Código:
;
; Windows USB CDC Driver Setup File for Microchip USB enabled PIC18F2450,2455,2550
; Provided by ObdDiag.net
;
; Proyecto de fin de carrera 2008 - Universidad de Navarra Tecnun
;
; Gerardo Diez del Campo a901963

[Version]
Signature="$Windows NT$"
Class=Ports
ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
Provider=%OBDDIAGN%
LayoutFile=layout.inf
DriverVer=03/15/2008,1.0.2008

[Manufacturer]
%MFGNAME%=VirComDevice,NT,NTamd64

[DestinationDirs]
DefaultDestDir = 12

[VirComDevice.NT]
%DESCRIPTION%=DriverInstall,USB\VID_04D8&PID_1000

[VirComDevice.NTamd64]
%DESCRIPTION%=DriverInstall,USB\VID_04D8&PID_1000

[DriverInstall.NT]
Include=mdmcpq.inf
CopyFiles=FakeModemCopyFileSection
AddReg=DriverInstall.NT.AddReg

[DriverInstall.NT.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,usbser.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"

[DriverInstall.NT.Services]
AddService=usbser, 0x00000002, DriverServiceInst

[DriverServiceInst]
DisplayName=%SERVICE%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\usbser.sys
;------------------------------------------------------------------------------
;  String Definitions
;------------------------------------------------------------------------------

[Strings]
OBDDIAGN    = "Gerardo Diez del Campo"
MFGNAME     = "Gerardo Diez del Campo"
DESCRIPTION = "HERMES USB DemoBoard"
SERVICE     = "Hermes USB RS-232 Emulation Driver"

Hemos puesto VID_04D8&PID_1000 por que si mal no recuerdo para los dispositivos genéricos Microchip otorga la direccion de Vendor VID 04D8 y puedes poner un Product PID [0000~9999].

ARCHIVO USBDSC.C

Código:
rom USB_DEV_DSC device_dsc=
{    
    sizeof(USB_DEV_DSC),    // Size of this descriptor in bytes
    DSC_DEV,                // DEVICE descriptor type
    0x0200,                 // USB Spec Release Number in BCD format
    CDC_DEVICE,             // Class Code
    0x00,                   // Subclass code
    0x00,                   // Protocol code
    EP0_BUFF_SIZE,          // Max packet size for EP0, see usbcfg.h
  
0x04D8, // VENDOR ID
0x1000, // PRODUCT ID
    0x0000,                 // Device release number in BCD format
    0x01,                   // Manufacturer string index
    0x02,                   // Product string index
    0x00,                   // Device serial number string index
    0x01                    // Number of possible configurations
};

Citar
4.- COMUNICACION

Mi software habla con la tarjeta por que sabe su idioma. Su idioma es reducido y sabe solo unas pocas palabras. Es un niño pequeño jajaja. Solo sabe responder a L_ON, L_OFF, VERS y DATA. Lo demas lo ignora

El software del CNC que dices no se que idioma habla y no se que palabras dice, asi que un poco dificil que mi firmware sepa interpretar lo que dice.
« Última modificación: Julio 30, 2010, 03:17:56 por Waldillo » En línea

Páginas: « 1 2 3 4 5 6 7 8 9   Ir Arriba
  Imprimir  
 
Ir a:  

Impulsado por MySQL Impulsado por PHP Powered by SMF 1.1.9 | SMF © 2006-2009, Simple Machines LLC XHTML 1.0 válido! CSS válido!

Página creada en 0.334 segundos con 23 consultas. (Pretty URLs adds 0.014s, 2q)