TODOPIC
Microcontroladores PIC => Lenguaje Basic para microcontroladores PIC => Mensaje iniciado por: manex_1987 en 24 de Marzo de 2004, 11:56:00
-
Hola.
Estoy intentando activar y desactivar puertos del PIC 16F84A mediante el ordenador, y no lo consigo de ninguna manera. Aquí os va el programa PicBasic Plus:
DEVICE=16F84A
DIM RECSTRING[3] AS byte
AF:
SERIN PORTA.0 ,396, [DEC RECSTRING]
if recstring="900" then high portb.5
if recstring="800" then low portb.5
GOTO AF
Le envío "900" y un caracter no-numero (para que detecte el numero entero el comando DEC , segun el manual de PBPlus) , y no hay signos de que portb.5 se ponga en estado alto. 
Por favor, necesito vuestra ayuda, pues me es primordial que funcione ese procedimiento.
Saludos, y muchas gracias.
-
no se si me equivoco porque con el Pic basic Plus no he trabajado
pero para mi la intruccion Serin no esta correctamente configurada
***********************************
segun la ayuda
me parece que esta faltando el Baudrate
espero no estar equivocado
SERIN Rpin { Fpin } , Baudmode , { Plabel, } { Timeout , Tlabel, } [ InputData ]
Overview
Receive asynchronous serial data (i.e. RS232 data).
Operators
Rpin is a PORT.BIT constant that specifies the I/O pin through which the serial data will be received. This pin will be set to input mode.
Fpin is an optional PORT.BIT constant that specifies the I/O pin to indicate flow control status on. This pin will be set to output mode.
Baudmode may be a variable, constant, or expression (0 - 65535) that specifies serial timing and configuration.
Plabel is an optional label indicating where the program should jump to in the event of a parity error. This argument should only be provided if Baudmode indicates that parity is required.
Timeout is an optional constant (0 - 65535) that informs SERIN how long to wait for incoming data. If data does not arrive in time, the program will jump to the address specified by Tlable.
Tlabel is an optional label that must be provided along with Timeout, indicating where the program should go in the event that data does not arrive within the period specified by Timeout.
InputData is list of variables and modifiers that informs SERIN what to do with incoming data. SERIN may store data in a variable, array, or an array string using the STR modifier.
-
Hola
No creo que exista ninguna irregularidad en la orden Serin... el 396 representa , segun la correspondiente tabla, a 2400-8N1 no invertido . Y segun he leido en el manual, las variables no son case-sensitive... me como las uñas con este embrollo!

saludos!
-
Buenas:
Luis,par el picbasicplus si estaría bien configurado el puerto, en este basic serin reemplaza aproximadamente al serin2 del picbasic pro.-
Manex,realmente no he mirado bien tu ejemplo pero ,en algún momento yo trate de hacer un serin con una matriz de datos y fracasé, no se la causa,no investigue mucho más y armé un serin con variables independientes y si anduvo.-
Te repito,no he investigado mucho tu problema ,a ver si tenes algun otro error con el tipo de dato que ingresa (ascii) contra el que lo compara, pero veremos si el fin de semana se puede hacer algo.-
saludos
Jorge
-
Hola
lo que yo vi es que en pbplus
la directiva tiene 5 datos a definir
SERIN Rpin { Fpin } , Baudmode , { Plabel, } { Timeout , Tlabel, } [ InputData ]
y en el codigo de manex solo hay 4 difinidos solo eso me llamo la atencion
un abrazo
Luis
-
Si Luis, el dato que falta es el de timeout si no llega nada al puerto,sencillamente si lo ignoras en la instrucción,no saltara a ninguna rutina de timeout.-
Jorge
-
Hola Manex, aki te pongo el programa corregido, espero te sirva cualkier duda hasmela saber...

---------------------------------------------------
DEVICE 16F84
DIM RECSTRING[3] AS byte
AF:
SERIN PORTA.0 ,396, [STR RECSTRING]
IF recstring[0]="9" THEN
IF recstring[1]="0" THEN
IF recstring[2]="0" THEN
HIGH portb.5
ENDIF
ENDIF
ENDIF
IF recstring[0]="8" THEN
IF recstring[1]="0" THEN
IF recstring[2]="0" THEN
LOW portb.5
ENDIF
ENDIF
ENDIF
GOTO AF
END
------------------------------------------------------
Un saludo
Rufo_nuke
-
Muchisimas gracias por la correccion, ahora ya me funciona de ese modo.
saludos!