TODOPIC
Microcontroladores PIC => * PROYECTOS * => Mensaje iniciado por: camolas en 03 de Junio de 2008, 17:26:11
-
Hola,
Necessito ayuda por favor para programar un pic (16f877a em pbp) para se conectar con la VDIP2 (host usb)
http://apple.clickandbuild.com/cnb/shop/ftdichip?productID=79&search=VDIP2&op=catalogue-product_info-null
http://www.vinculum.com/documents/datasheets/DS_VDIP2.pdf
Gostaria de me conectar com um nokia 6230 con el data cable usb por forma de comandos AT .
Dudas - Conexion e codigo??
- Mi conexion pic - vdip
Rx - Tx
Tx - Rx
Prt. - Cts
Prt. - Rts
Prt. - Rs
- Mi Codigo.
define OSC 20
Include "modedefs.bas" ' Include serial mode
DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
DEFINE HSER_SPBRG 129 ' 9600 Baud @ 20MHz, 0.16%
DEFINE HSER_CLROERR 1 ' Clear overflow automatically
'bits 2 & 3 temporarily inputs
TrisC.2=0 'active LOW reset line to VDIP2
TrisC.3=1 'Cts# Flow control to VDIP2
TrisC.4=1 'Rts# Flow controlto from VDIP2
TrisC.5=0 'Led to see if pic and code is ok blink 3 times
TrisC.6=0 'Rx VDIP2
TrisC.7=1 'Tx VDIP2
B0 var byte
High portb.5
Pause 500
Low portb.5
Pause 500
High portb.5
Pause 500
Low portb.5
Pause 500
Start:
High PortC.2 'active LOW so not reset
Low PortC.3 'pull VDIP2 pin CTS low
Input PortC.2 'from VDIP2 pin RTS
High PortC.6 'condition serout pin to mark state
Pause 5
HSEROUT ["AT", 13]
HSEROUT ["ATD=+351xxxxx000;", 13]
STOP
end
Ayudai por favor.
Gracias.
-
Por el programa no se ve nada raro, cuentanos mas sobre los comandos o acerca del datasheet dela Plaquta que usas para saber si estas configurando bien la USART de la placa y otro tip podrias probar con comunicacion serie por software o de plano SPI
-
Hola navismo,
Soy nuevo en esto de pics segun leido:
Setup for simplest UART mode.
a/ The interface defaults to 9600 bps, 8N1 TTL where steady mark/idle is +v and a space bit is zero volts. Use SEROUT 'driven true' mode.
b/ Set the jumpers to be both 1-2 or both 2-3 for UART mode.
c/ You can permanently ground the VDIP1 pin 10 called CTS. This pin must be low before the VDIP1 will work.
d/ You MUST monitor the VDIP1 pin 9, called RTS. Do NOT tie RTS to CTS as shown in the Circuit Cellar article - that only sometimes works. RTS is low when ready to accept data and when RTS goes high you must stop sending data to the VDIP1. If you continue to send data, the VDIP1 will frequently lock up and need a manual reset or power cycling before it comes good. Any active file on the USB stick will be left open and appear empty when viewed with a PC.
e/ RTS going high apparently indicates there are only 32 character positions left in the buffer. RTS ALSO goes high immediately after issuing some commands. Which commands seems to vary with brand of card. The WRF 26 in my code below causes pin 9 RTS to go high with a Rundisk 2 GB memory stick but RTS does NOT go high with a Verbatim 512 MB stick.
f/ Every command must be terminated with a carriage return. No line feed is necessary.
Schematic details.
RTS is monitored by the PIC. Data is only sent while RTS is LOW.
CTS is pulled low by the PIC and left low throughout.
RESET line needs to float normally but every now and then a manual reset is required. This could either be by code or an external pushbutton.
Gracias por todo.
-
Hola,
Programita sample para escrivir en un pen drive (usb) pero en C e necessita SourceBoost C compiler (no entiendo de C)
http://www.vinculum.com/downloads/samples/vpic-hello.zip ( Requires SourceBoost C compiler)
Aqui firmware commands de la plaquita
http://www.vinculum.com/documents/fwspecs/Vinculum%20Firmware%20User%20Manual%20V2.4%20Rev%203.pdf
Gracias.