Documente Academic
Documente Profesional
Documente Cultură
Operadores
• Item – una constante, variable, expresión, modificador, o lista de
caracteres.
No hay operadores como tal, sino modificadores. Por ejemplo, si precede el
símbolo @ a un ítem, se enviará la representación ASCII de cada digito a la
LCD. La siguiente lista muestra los modificadores existentes:
Operation
Modifier Position the cursor on a serial LCD
AT ypos,xpos Clear a serial LCD (also creates a 30ms delay)
CLS Send binary digits
BIN{1..32} Send decimal digits
DEC{1..10} Send hexadecimal digits
HEX{1..8} Send signed binary digits
SBIN{1..32} Send signed decimal digits
SDEC{1..10} Send signed hexadecimal digits
SHEX{1..8} Send binary digits with a preceding '%' identifier
IBIN{1..32} Send decimal digits with a preceding '#' identifier
IDEC{1..10} Send hexadecimal digits with a preceding '$' identifier
IHEX{1..8} Send signed binary digits with a preceding '%' identifier
ISBIN{1..32} Send signed decimal digits with a preceding '#'
ISDEC{1..10} identifier
Send signed hexadecimal digits with a preceding '$'
ISHEX{1..8} identifier
REP c\n Send character c repeated n times
STR array\n Send all or part of an array
CSTR cdata Send string data defined in a CData statement
PRINT "Hello World" ' Muestra el texto "Hello World"
PRINT "VAR1= " , DEC VAR1 ' Muestra el valor decimal de VAR1
PRINT "VAR1= " , HEX VAR1 ' Muestra el valor hexa de VAR1
PRINT "VAR1= " , BIN VAR1 ' Muestra el valor binario de VAR1
Command Operation
$FE, 1 Clear display
$FE, 2 Return home (beginning of first line)
$FE, $0C Cursor off
$FE, $0E Underline cursor on
$FE, $0F Blinking cursor on
$FE, $10 Move cursor left one position
$FE, $14 Move cursor right one position
$FE, $C0 Move cursor to beginning of second line
$FE, $94 Move cursor to beginning of third line
$FE, $D4 Move cursor to beginning of fourth line
PRINT $FE , 2
PRINT $FE , 1
DELAYMS 30
Se le puede indicar a la pantalla la posición en la
que se desea observar la información:
SYMBOL pi = 3.14
Número de bits
ADC
ADRESL:
Parte baja del resultado de la conversión·
ADCON0:
Registro de Control 0 ;control del funcionamiento del conversor ·
ADCON1:
Registro de Control 1; configuración de los pines del puerto
ADCON0
ADCON1
ADRESH Y ADRESL
Config de canales
PROTÓN
Ejemplo:
Voltaje (V)
Vref+
Voltaje= ((Vref+) – (Vref-))* (N) /2^n-1
Vref-
2^n N (Valor digital)
Si Vref+=5V ,
Vref-=0,
n= 10 bits,
El voltaje será
Voltaje= 5*N/1023
Voltaje (V)
Vref+
Vref-
2^n N (Valor digital)
.
.
.
.
' Conversión ADC
Declare ADIN_RES 10 '10 bits
Declare ADIN_TAD 3 'Fosc/32
Declare ADIN_STIME 100 '100us Samplig Time
Dim N as Word
Dim Volt as float
Symbol CanalA = 0 ' define etiqueta canalA como canal 0
TRISa.0 = 1 ' Canal AN0 (Ra0) entrada
ADCON1 = %10001110 ' Justif. Derecha, An0 como analógico' Vref Internos
Inicio: ' leer canal A
N = Adin CanalA ' imprimir voltaje valor digital
Voltaje= 5=N/1024
Print at 1,1,“Valor digit =", dec N
Print at 2,1,“Voltaj(V) =", dec2 Volt
' tiempo de muestreo
Delayms 500
Goto Inicio