Hola Muchachos:
Miren aca hice una programacion y me detecta que recibe lo que mando pero aparece otra cosa , como ser yo mando la letra A ..como hexa de cimal 0x41 , o como caracter y recibo algo que nada que ver con la letra .
aca les publico el codigo.
Alguna sugerencia
#include "C:\Documents and Settings\Leo\Mis documentos\CAN\CAN_Mod_A\CAN_Mod_A.h"
#define CAN_USE_EXTENDED_ID TRUE
#include "flex_lcd1.c"
#define Set_125K_Baud TRUE
#include "can-18xxx8.c"
char out_data[8];
int32 tx_id=24;
int1 tx_rtr=1;
int1 tx_ext=1;
int tx_len=8;
int tx_pri=3;
char b0 = 0x30;
char b1 = 0x41;
int i, j;
#int_canrx0
void canrx0_int ( )
{
lcd_putc("\fRX0");
delay_ms(500);
}
#int_canrx1
void canrx1_int ( )
{
lcd_putc("\fRX1");
delay_ms(500);
}
#int_cantx0
void cantx0_int ( )
{
if (i != 0xFF)
{
lcd_putc("\fEnvio OK");
delay_ms(300);
lcd_putc("\f");
for (j=0;j<tx_len;j++)
printf(lcd_putc,"%c",out_data[j]);
delay_ms(2000);
}
else
{
lcd_putc("\fEnvio Fallo");
delay_ms(1000);
}
}
#int_cantx1
void cantx1_int ( )
{
if (i != 0xFF)
{
lcd_putc("\fEnvio OK");
delay_ms(300);
lcd_putc("\f");
for (j=0;j<tx_len;j++)
printf(lcd_putc,"%c",out_data[j]);
delay_ms(2000);
}
else
{
lcd_putc("\fEnvio Fallo");
delay_ms(1000);
}
}
#int_cantx2
void cantx2_int ( )
{
if (i != 0xFF)
{
lcd_putc("\fEnvio OK");
delay_ms(300);
lcd_putc("\f");
for (j=0;j<tx_len;j++)
printf(lcd_putc,"%c",out_data[j]);
delay_ms(2000);
}
else
{
lcd_putc("\fEnvio Fallo");
delay_ms(1000);
}
}
void main()
{
//int8 Buf_Env = 0;
lcd_init();
can_init();
enable_interrupts(int_canrx0);
enable_interrupts(int_canrx1);
enable_interrupts(int_cantx0);
enable_interrupts(int_cantx1);
enable_interrupts(int_cantx2);
port_b_pullups(TRUE);
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_spi(SPI_SS_DISABLED);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
enable_interrupts(GLOBAL);
setup_low_volt_detect(FALSE);
for(;
{
if(!input(PIN_B0))
{
lcd_putc("\fB0 PRES");
delay_ms(1000);
b0 = 0x30;
for (j=0;j<tx_len;j++)
{
out_data[j]=b0;
b0++;
}
i=can_putd(tx_id, out_data, tx_len, tx_pri, tx_ext, tx_rtr);
}
if(!input(PIN_B1))
{
lcd_putc("\fB1 PRES");
delay_ms(1000);
b1 = 0x41;
for (j=0;j<tx_len;j++)
{
out_data[j]=b1;
b1++;
}
i=can_putd(tx_id, out_data, tx_len, tx_pri, tx_ext, tx_rtr);
}
if(!input(PIN_B4))
{
lcd_putc("\fB4 PRES");
delay_ms(1000);
out_data[0] = 0x41;
out_data[1] = 0x56;
out_data[2] = 0x41;
out_data[3] = 0x73;
out_data[4] = 0x79;
out_data[5] = 0x73;
out_data[6] = 0x20;
out_data[7] = 0x4C;
i=can_putd(tx_id, out_data, tx_len, tx_pri, tx_ext, tx_rtr);
}
lcd_putc("\fMain A");
delay_ms(100);
}
}