Redirect Zigbee verbose to Usart

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

Redirect Zigbee verbose to Usart

Postby Ondra » Fri Jan 06, 2012 2:25 pm

Good day all.
I have a zigbee project that does not employ an LCD screen. On selecting verbose, the AT commands that initialize the module are sent to the LCD if connected.
I would like to know if someone would be kind enough to give detailed outline on redirecting the AT commands to a second software and or hardware USART port.
I'm working 18LF46k80 which has 2 USART ports.

Thanks in advance
Ondra Simons

User avatar
Benj
Matrix Staff
Posts: 14370
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4447 times
Been thanked: 4145 times
Contact:

Re: Redirect Zigbee verbose to Usart

Postby Benj » Fri Jan 06, 2012 6:22 pm

Hello Ondra,

If you include a RS232 component in your program, configue the properties as you would like them and then include a random RS232 receive comp macro at the start of your program to ensure the component code is included into the code. Then compile to C and have a look at the generated C file and find the RS232 send function headers.

They should look something like this.
void FCD_RS2320_SendRS232Char(short nChar);
void FCD_RS2320_SendRS232String(char* String, char MSZ_String);

Maybe also physically test your RS232 here before continuing so you know bytes can be sent to the PC correctly using your settings.

Once you have done this right click the Zigbee component on the panel and select custom code.

Modify the following command.
Send_AT_Command

Look for this section of code.

Code: Select all

   if (LCD_VERB_ZIG == 1)
   {
      #if MX_ZIG_LCD == 1
         #ifdef MX_GFXLCD_PORT
            FCD_gLCD0_Clear();
            FCD_gLCD0_Print(String, 10, 2, 2, 2, 0);
         #else
            FCD_LCDDisplay0_Clear();
            FCD_LCDDisplay0_PrintString(String, 10);
         #endif
      #endif
   }


and change to the following where the function call matches your function header.

Code: Select all

   if (LCD_VERB_ZIG == 1)
   {
      FCD_RS2320_SendRS232String(String, 10);
   }


Then modify the following command.
Get_AT_Response

Look for this section of code. It is in this function twice.

Code: Select all

   if (LCD_VERB_ZIG == 1)
   {
      #if MX_ZIG_LCD == 1
         #ifdef MX_GFXLCD_PORT
            FCD_gLCD0_Print(String, 10, 2+(idx * 12), 20, 2, 0);
         #else
             #ifdef MX_MIAC
            FCD_MIAC0_PrintASCII(temp);
           #else
            FCD_LCDDisplay0_PrintASCII(temp);         //Output to LCD
           #endif
         #endif
      #endif
   }


and change to the following where the function call matches your function header.

Code: Select all

   if (LCD_VERB_ZIG == 1)
   {
      FCD_RS2320_SendRS232Char(temp);
   }


Then the verbose information should be streamed through to the RS232 connection.