Hi All,

I'm developing my first application.
First I receive data from serial and store in a buffer, after four
packages I send to PC through serial.
But my code does not do it, it send data through serial port all time
and repeat data.
Below, you can see my code:

event message_t *UartReceive.receive[am_id_t id](message_t *msg,
                                                                                
        void *payload,
                                                                                
        uint8_t len) {
        memcpy(&buf_msgs[idx_tag * MSG], payload, MSG);
        if (++idx_tag == MSG) {
                idx_tag = 0;                                            
                                
                local.count++;
                memcpy(&sendbuf.data[0], &buf_msgs[0], MSGREADING);

                post uartSendTask();
        }
        
        return msg;
}

task void uartSendTask() {
        uint16_t id;

        id = call UartAMPacket.type(&sendbuf);
        call UartSend.send[id](AM_BROADCAST_ADDR, &sendbuf, sizeof local);

}

I have validated this code in a C program, and it works fine.
Why does not it work in nesC/tinyos?

Thanks all,
Daniel Patrick
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to