Follow along with the video below to see how to install our site as a web app on your home screen.
Nota: This feature currently requires accessing the site using the built-in Safari browser.
if (variable de tipo int8 [B]==[/B] 0)
... a una variable int8 y una variable de tipo entero ...
#int_ext
void interrup_RA2()
{
switch (flag1){
case 0: flag1=1; ext_int_edge(L_TO_H);break;
case 1: flag1=0; ext_int_edge(H_TO_L);break;
}
salida2_off;
delay_us(/*intensidad*/DELAYCOM);
salida2_on;
}
void main()
{
setup_comparator(NC_NC_NC_NC);
enable_interrupts(global);
enable_interrupts(int_rda);
set_tris_D(0x00);
enable_interrupts(int_ext);
ext_int_edge(H_TO_L);
setup_adc_ports (NO_ANALOGS);
while (TRUE)
{
valor_B=getc();
DELAYCOM = valor_B;
}
Lo que debes hacer es declarar la variable fuera de las funciones
Es decir abajo de las librerias ejemplo
#include<algo.h>
Int variable;
Void suma()
{
Variable++;
}
Void main()
{
Printf(variable);
}
Void suma()
{
Printf(variable); //esta linea
}
Void main()
{
Variable++; // por esta linea
}
salida2_off;
delay_us(/*intensidad*/DELAYCOM);
salida2_on;
MF=0;
output_high(PIN_C2); // RW TRUE
spi_write(nu); PM();//numero total-de-informes int8
if(DT){//comunicaion detallada + Lenta (int8 + int16)
for(co=0;nu>co;co++){//for(co)//MANDAR--->
p0=psz[co];
spi_write(p0); PM();///posicion int8
d0=dis[p0];
v8=make8(d0,0);///distancia INT16
spi_write(v8); PM();
v8=make8(d0,1);
spi_write(v8); PM();
}//for(co) RW detallada
//output_low(PIN_C2);//RW FALSE
}
else {//DT=0//comunicaion Simple + rapida (int8 + int8)
for(co=0;nu>co;co++){//for(co)//MANDAR--->
p0=psz[co];
spi_write(p0); PM();///posicion int8
d0=dis[p0];//distancia es improbable que pueda llegar a + de 1000/10-->int8 100
//int16/10 555/10=55 recivira 55*10=550
if(d0>240){ d0=d0/10; }//NO COORDINA Si int16 es inferior a 240 Quiero que se la pase entera a int8
v8=make8(d0,0);
spi_write(v8); PM();
}//for(co) RW Simple
}//end if(DTalle)
void PM() {/// protocolo de envio vajo SPI MAESTRO
for(t=0;450>t;t++){
if(Input(PIN_C0)){ delay_ms(5);
lcd_gotoxy(37,2); printf(lcd_putc,"%lu",t); break;///////
}//recivido
}//for(t)
if(t>447){ delay_ms(5);
MF++; lcd_gotoxy(36,1); printf(lcd_putc,"MF %d ",MF); }///Este printf No debe aparecer MF supone numero de fallos en //comunicacion
}
nu=spi_read(); PS();
if(DT){//int8 + int16 (detalle alto)
for(co=0;nu>co;co++){//for(co)
k8=spi_read(); PS();///posicion int8
psz[co]=k8;//iden
v8=spi_read(); PS();//distancia INT16
v16=spi_read(); PS();
dis[k8]=v16*256+v8;//distancia int16
}//for(co) rs completa
} else {//int8 + int8 (detalle vajo)
for(co=0;nu>co;co++){//for(co)
k8=spi_read(); PS();///posicion int8
psz[co]=k8;//iden
v8=spi_read(); //PS();//distancia INT16/10 1555/10 serian INT8 155 ....259 serian 25
k16=v8;//155 ---> 1550 (se pierde detalle deberia ser 1555 pero micro-master sabe siempre el verdadero valor a la hora de //operarlo)
//k16*10;
if(k16>24){ dis[k8]=k16*10; }//micro-master if(distancia>240) { RW int16/10 } else { RW int16 entera cabe en int8 }
else { dis[k8]=k16; }//la int16 pasada era inferior a 240 (+ rapido y no se pierde detalle)
PS();
}//for(co) RS Simple
}//end if(DTalle)
void PS(){///protocolo de recivo vajo SPI pic2SLAVE
output_high(PIN_a0);//S.recivido=true -----> pin_c0_MASTER/E.recivido
delay_us(4950);//delay_ms(4);
output_low(PIN_a0);
delay_us(50);
}
La ayuda de PIC C Compiler dijo:Note: All types, except float char , by default are un-signed; however, may be preceded by unsigned or signed (Except int64 may only be signed) . Short and long may have the keyword INT following them with no effect. Also see #TYPE to change the default size.
SHORT INT1 is a special type used to generate very efficient code for bit operations and I/O. Arrays of bits (INT1 or SHORT ) in RAM are now supported. Pointers to bits are not permitted. The device header files contain defines for BYTE as an int8 and BOOLEAN as an int1.
Integers are stored in little endian format. The LSB is in the lowest address. Float formats are described in common questions.