RS232 ISSUING WHEN USING MEGA162

Forum for problems or queries regarding Flowcode Comms Components. Eg LIN, I2C, SPI, RS232, CAN, IrDA etc

Moderators: Benj, Mods

Post Reply
DavidJ
Posts: 30
Joined: Fri Mar 21, 2008 11:16 pm
Has thanked: 1 time
Been thanked: 3 times
Contact:

RS232 ISSUING WHEN USING MEGA162

Post by DavidJ »

HI

Have a problem with the RS232 Component

If I compie to HEX using RS232 Component with Target set at Mega32 all is okay

However if i do same again but with Mega 162 selected I get multiple compiilation errors ie the UART functions UBRRH etc etc are not defined

Note Mega162 has 2 UARTS so its registers have different names ie UBRR0H & UBRR1H
It would appear that flow code is not recognising this requirement ie it should be defining UBRR0H not UBRRH

Any comments

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

Re: RS232 ISSUING WHEN USING MEGA162

Post by Benj »

Hello

We will look into this problem for you.

However a simple temporary fix would be to go into the Edit - Supplementary code window and enter the following line of code into the top window.

Code: Select all

#define UBRRH UBRR0H
Repeat this for all of the registers that are flagged as not defined.

DavidJ
Posts: 30
Joined: Fri Mar 21, 2008 11:16 pm
Has thanked: 1 time
Been thanked: 3 times
Contact:

Re: RS232 ISSUING WHEN USING MEGA162

Post by DavidJ »

Thanks for prompt reply

I had already tried this before I sent the querry and it worked however it would be time consuming for all the other registers

I was wondering why Flowcode was not picking it up automatically

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

Re: RS232 ISSUING WHEN USING MEGA162

Post by Benj »

Hello

The problem is due to a small bug in the component code file. Once this has been updated the program should compile correctly again without having to redefine registers. You may wish to update this RS232.C file by hand or search/replace techniques to use the correct register names. However this will mean that your component code file will then not work for other devices. We will post the updated component file onto the forums as soon as we get chance to dig in and fix this.

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times
Contact:

Re: RS232 ISSUING WHEN USING MEGA162

Post by Sean »

The problem was caused by two missing definitions in the ATMEGA162.fcd file. I have attached a corrected version of this file.
ATMEGA162.fcd
(6.27 KiB) Downloaded 365 times
Copy the file to the FCD folder of the Flowcode for AVR installation, replacing the original copy.

Compilation generates two warnings regarding redefinition of UMSEL0 and UMSEL1. These can be ignored.

Post Reply