[solved] UART problem

A forums to allow bugs and problems with Flowcode v6 to be reported and resolved.

Moderator: Benj

User avatar
STibor
Posts: 262
Joined: Fri Dec 16, 2011 3:20 pm
Has thanked: 115 times
Been thanked: 112 times
Contact:

[solved] UART problem

Postby STibor » Tue May 17, 2016 11:28 am

Hello!

I use 1 pc. RS232 hardware macros, and should 9pcs. RS232 software macro. (9 pieces. DFPlayer + RS485 Modbus)
Unfortunately, the program does not compile vain changed the CAL file.
Up to 8 pieces. RS232 component can be used.
What can be wrong?
How many RS232 can be used for many components?
Attachments
PIC_CAL_UART.c
(29.11 KiB) Downloaded 138 times
Last edited by STibor on Fri Jun 10, 2016 4:27 pm, edited 1 time in total.

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

Re: UART problem

Postby Benj » Tue May 17, 2016 12:11 pm

Hello,

Yes we have only allowed support for up to 8 UARTs channels but this is easy to expand.

The limitation is in the "CAL/includes.c" file.

The end of the file looks like this.

Code: Select all

#ifdef   MX_UART_REF8
  #define MX_UART_NUM 8
  #ifdef MX_CAL_PIC
   #include "PIC\PIC_CAL_UART.c"
  #endif
  #ifdef MX_CAL_PIC16
   #include "PIC16BIT\PIC16BIT_CAL_UART.c"
  #endif
  #ifdef MX_CAL_AVR
   #include "AVR\AVR_CAL_UART.c"
  #endif
  #ifdef MX_CAL_ARM
   #include "ARM\ARM_CAL_UART.c"
  #endif
  #undef MX_UART_NUM
#endif
#ifdef CALFUNCTION
   #undef CALFUNCTION
#endif


if you add this section before the #ifdef CALFUNCTION line then this should allow for up to 10 UARTs.

Code: Select all

#ifdef   MX_UART_REF9
  #define MX_UART_NUM 9
  #ifdef MX_CAL_PIC
   #include "PIC\PIC_CAL_UART.c"
  #endif
  #ifdef MX_CAL_PIC16
   #include "PIC16BIT\PIC16BIT_CAL_UART.c"
  #endif
  #ifdef MX_CAL_AVR
   #include "AVR\AVR_CAL_UART.c"
  #endif
  #ifdef MX_CAL_ARM
   #include "ARM\ARM_CAL_UART.c"
  #endif
  #undef MX_UART_NUM
#endif
#ifdef   MX_UART_REF10
  #define MX_UART_NUM 10
  #ifdef MX_CAL_PIC
   #include "PIC\PIC_CAL_UART.c"
  #endif
  #ifdef MX_CAL_PIC16
   #include "PIC16BIT\PIC16BIT_CAL_UART.c"
  #endif
  #ifdef MX_CAL_AVR
   #include "AVR\AVR_CAL_UART.c"
  #endif
  #ifdef MX_CAL_ARM
   #include "ARM\ARM_CAL_UART.c"
  #endif
  #undef MX_UART_NUM
#endif
These users thanked the author Benj for the post (total 2):
STibor (Tue May 17, 2016 1:59 pm) • Rudi (Wed May 18, 2016 1:53 am)
Rating: 10%