compilation error

For general Flowcode discussion that does not belong in the other sections.
ChrisT66
Posts: 103
http://meble-kuchenne.info.pl
Joined: Mon Dec 07, 2020 12:47 pm
Been thanked: 1 time

compilation error

Post by ChrisT66 »

Hi, when I try to compile with the macro ‘SetBaud’ I get this error (and other similar ones):
error: ‘UBRR1L’ undeclared (first use in this function)

What exactly does this mean?

Thanks and best regards Chris
Attachments
SetBaud.fcm
(1.19 KiB) Downloaded 16 times

LeighM
Valued Contributor
Posts: 447
Joined: Mon Dec 07, 2020 1:00 pm
Has thanked: 81 times
Been thanked: 243 times

Re: compilation error

Post by LeighM »

The macro has C code which has been written for a specific target device,
so won't work with a different device.

ChrisT66
Posts: 103
Joined: Mon Dec 07, 2020 12:47 pm
Been thanked: 1 time

Re: compilation error

Post by ChrisT66 »

Yes exactly, also for the ATMEGA328P that I use

medelec35
Matrix Staff
Posts: 1924
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 623 times
Been thanked: 645 times

Re: compilation error

Post by medelec35 »

If you change the target device to one that does contain all the SFR's e.g. ATMEGA640 then the code will compile successfully.
Is there a reason for creating your own C code?
I would recommend if it's for learning, check register names within the microcontroller datasheet first.
ATMEGA328 only contains UBRR0H/L, all the other register e.g. UBRR1H/L etc are missing.
Hence reason for failing to compile.
Martin

ChrisT66
Posts: 103
Joined: Mon Dec 07, 2020 12:47 pm
Been thanked: 1 time

Re: compilation error

Post by ChrisT66 »

Unfortunately, the normal ‘ChangeHWBaude’ function for the UART does not work. There have already been posts about this here...

medelec35
Matrix Staff
Posts: 1924
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 623 times
Been thanked: 645 times

Re: compilation error

Post by medelec35 »

ChrisT66 wrote:
Thu Jan 23, 2025 9:59 am
Unfortunately, the normal ‘ChangeHWBaude’ function for the UART does not work. There have already been posts about this here...
In that case, thank you for letting us know.
I will put it on my list to investigate, so you won't need to use C code.
If I replicate it not working, I will move the topic to Bugs.
Martin

ChrisT66
Posts: 103
Joined: Mon Dec 07, 2020 12:47 pm
Been thanked: 1 time

Re: compilation error

Post by ChrisT66 »

Ok, then I hope you find the error, thanks!

medelec35
Matrix Staff
Posts: 1924
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 623 times
Been thanked: 645 times

Flowcode v10 Re: compilation error

Post by medelec35 »

As you have not added 9 or 10 post icon, I will assume you are using FC10.
Just tested on the Uno and ChangeHWBaud is working as intended, toggling between 4800 and 19200 .
Analyser set for 2400 & sending U:
ChangeHWBaud1.png
ChangeHWBaud1.png (53.08 KiB) Viewed 1944 times
Do have an example .fcfx project where it is not working?
Martin

ChrisT66
Posts: 103
Joined: Mon Dec 07, 2020 12:47 pm
Been thanked: 1 time

Re: compilation error

Post by ChrisT66 »

I have to generate a new project first, I can do that. I'm not using a UNO etc. but the chip direct, an ATMEGA328P and 328PB.

ChrisT66
Posts: 103
Joined: Mon Dec 07, 2020 12:47 pm
Been thanked: 1 time

Re: compilation error

Post by ChrisT66 »

I have tested it again, I am transmitting from one module with 115200 baud to another. If I configure the UART of the receiver module with 9600 baud and then set it to 115200 with ChangeHWBaud after initialisation in the program, it does not work.

Post Reply