Keil Logo Arm Logo

Send Periodic Messages

With signal functions it is possible to send periodically messages to the user applications. Signal functions are created within the µVision3 debugger. Refer to µVision3 Debug Functions for more information on this topic. The following signal function sends a message with two bytes 10 times per second. The signal function receives an info value that is transmitted to the application program. This info value is constantly incremented:

SIGNAL void sendCAN (unsigned int info)  {
 while (1)  {
    CAN0ID = 0x4510;          // CAN message ID
    CAN0L  = 2;               // message length 2 bytes
    CAN0B0 = (info & 0xFF);   // message data byte 0
    CAN0B1 = (info >> 8);     // message data byte 1
    CAN0IN = 2;               // send CAN message with 29-bit ID
    twatch (CLOCK / 10);      // send message 10 times per second
    info++;                   // increment info value

>sendCAN (500);    // invoke sendCAN function

Keil logo

Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings