UART on my Imp

hi ! i have a problem whit my device code,
first i want to communicate my IMP whit a microcontroller, PIC16f877A, using the uart module in both devices,
before i do comnunication from the pic to the IMP, and works fine, but now try to make to inverse and don´t see the information o.o could explain me how works the instrucction UART.write, and how sends the information…

function powerHandler(state) {
// log something
local a=state;
local mandar=a.tointeger();
// mandar información por RS232
pic.write(mandar);
server.log(mandar);
}
// whenever we get a “power” message, run the powerHandler function
pic <- hardware.uart57;
pic.configure(9600, 8, PARITY_NONE, 1, NO_CTSRTS);
agent.on(“power”, powerHandler);

this is my code on the microcontroller…
#include <16f877a.h>
#include <tsl2561.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP,NOBROWNOUT
#use delay (clock=4M)
#use I2C(MASTER, SCL=PIN_C3,SLOW,SDA=PIN_C4)
#define LCD_ENABLE_PIN PIN_D2
#define LCD_RS_PIN PIN_D0
#define LCD_RW_PIN PIN_D1
#define LCD_DATA4 PIN_D4
#define LCD_DATA5 PIN_D5
#define LCD_DATA6 PIN_D6
#define LCD_DATA7 PIN_D7
#include <lcd.c>
#use rs232(BAUD=9600,XMIT=PIN_C6,RCV=PIN_C7,PARITY=N,BITS=8)
#BYTE TRISA=0X85
#BYTE PORTA=0X05

char valuers232;
#int_RDA
RDA_isr()
{
valuers232=getc();
return valuers232;
}

void main ()
{
int pr,pr2,pr3,pr4;
bit_clear (TRISA,0);
lcd_init();
enable_interrupts(GLOBAL);
enable_interrupts(INT_RDA);
while(true){
lcd_putc("\f");
lcd_gotoxy(1,2);
printf(lcd_putc,“dato: %c”,valuers232);
}

}

Hi crismor, my PIC C is a bit rusty, but I don’t remember interrupt handlers being capable of returning values, thus “return valuers232;” probably won’t do anything.
Also, you only want to call printf when you have received a character. Why not try:

`char received=0;
char valuers232;
#int_RDA
RDA_isr() {
  valuers232=getc();
  received=1;
}`

and replace your while loop with:

`while(true) {
  if (received==1) {
    lcd_putc("\\f"); 
    lcd_gotoxy(1,2); 
    printf(lcd_putc,"dato: %c",valuers232);
    received=0;
  }
}`