AVR compiler errors

Moderator: Benj

Post Reply
User avatar
stasiks
Posts: 18
Joined: Tue Aug 14, 2012 1:53 am
Contact:

AVR compiler errors

Post by stasiks »

Hello
There was a need for the Programming all was good while the PWM launched, during compilation appear in the following problem:

Code: Select all

/AVR\AVR_CAL_PWM.c: In function 'FC_CAL_PWM_Enable_Channel_1':
/AVR\AVR_CAL_PWM.c:671: error: 'COM0A0' undeclared (first use in this function)
/AVR\AVR_CAL_PWM.c:671: error: (Each undeclared identifier is reported only once
/AVR\AVR_CAL_PWM.c:671: error: for each function it appears in.)
/AVR\AVR_CAL_PWM.c:676: error: 'COM0A1' undeclared (first use in this function)
/AVR\AVR_CAL_PWM.c: In function 'FC_CAL_PWM_Disable_Channel_1':
/AVR\AVR_CAL_PWM.c:702: error: 'COM0A1' undeclared (first use in this function)
/AVR\AVR_CAL_PWM.c: In function 'FC_CAL_PWM_Set_Duty_8Bit_1':
/AVR\AVR_CAL_PWM.c:845: error: 'OCR0A' undeclared (first use in this function)
/AVR\AVR_CAL_PWM.c: In function 'FC_CAL_PWM_Set_Duty_10Bit_1':
/AVR\AVR_CAL_PWM.c:1121: error: 'OCR0A' undeclared (first use in this function)
Search forum but did not find anything in google could not do anything useful to tell.
From the C language do not understand anything so I'm desperate please help, Thanks

User avatar
DavidA
Matrix Staff
Posts: 1076
Joined: Fri Apr 23, 2010 2:18 pm
Location: Matrix Multimedia Ltd
Has thanked: 58 times
Been thanked: 258 times
Contact:

Re: AVR compiler errors

Post by DavidA »

Hello,

Could you post a Flowchart and the generated c code which exhibits this problem

User avatar
stasiks
Posts: 18
Joined: Tue Aug 14, 2012 1:53 am
Contact:

Re: AVR compiler errors

Post by stasiks »

Thank you that answered so quickly, here is Flowcharts and the generated c code.
Thank you.
Attachments
Fan.fcf_avr
Flowcharts
(12.5 KiB) Downloaded 516 times
Fan.c
c code
(30.98 KiB) Downloaded 485 times

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: AVR compiler errors

Post by Benj »

Hello,

I will try and get this sorted in the main PWM CAL file. For now you can fix the issue by using this workaround.

Click On Build -> Project Options.

Tick the box "Use supplementary code" and then click the button "Supplementary code"

In the top window paste the following section of code.

Code: Select all

#define COM0A0 COM00
#define COM0A1 COM01
#define OCR0A OCR0
Click OK twice and the program should now compile correctly.

Let me know if you have any problems.

User avatar
stasiks
Posts: 18
Joined: Tue Aug 14, 2012 1:53 am
Contact:

Re: AVR compiler errors

Post by stasiks »

Thank you very much, everything did and everything was successful.
Thank you very much :D

vlad1451
Posts: 22
Joined: Sun Sep 07, 2014 6:02 am
Has thanked: 1 time
Been thanked: 1 time
Contact:

Re: AVR compiler errors

Post by vlad1451 »

Hello. Prompt, and it is possible to involve all PWM channels in the controler. If I am not mistaken at Mega16/32 their 4 channels.

vlad1451
Posts: 22
Joined: Sun Sep 07, 2014 6:02 am
Has thanked: 1 time
Been thanked: 1 time
Contact:

Re: AVR compiler errors

Post by vlad1451 »

Really there is no opportunity to involve all 4 channels?!!!

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: AVR compiler errors

Post by Benj »

Hello,

I have now fixed this in v6 for the ATMEGA32 which only showed 3 of the 4 available channels. Do you need this fix in v5 or v6?

vlad1451
Posts: 22
Joined: Sun Sep 07, 2014 6:02 am
Has thanked: 1 time
Been thanked: 1 time
Contact:

Re: AVR compiler errors

Post by vlad1451 »

v5

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: AVR compiler errors

Post by Benj »

Hello,

Ok this updated definition file should resolve the problem.
ATMEGA32.fcd
(10.11 KiB) Downloaded 420 times
Let me know how you get on.

vlad1451
Posts: 22
Joined: Sun Sep 07, 2014 6:02 am
Has thanked: 1 time
Been thanked: 1 time
Contact:

Re: AVR compiler errors

Post by vlad1451 »

Thanks.

vlad1451
Posts: 22
Joined: Sun Sep 07, 2014 6:02 am
Has thanked: 1 time
Been thanked: 1 time
Contact:

Re: AVR compiler errors

Post by vlad1451 »

In case of compilation gives out the same error:

Code: Select all

C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c: In function 'FC_CAL_PWM_Enable_Channel_2':
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:671: error: 'MX_TCCR_X' undeclared (first use in this function)
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:671: error: (Each undeclared identifier is reported only once
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:671: error: for each function it appears in.)
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:671: error: 'MX_PWM_COM0_X' undeclared (first use in this function)
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:676: error: 'MX_PWM_COM1_X' undeclared (first use in this function)
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c: In function 'FC_CAL_PWM_Disable_Channel_2':
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:702: error: 'MX_TCCR_X' undeclared (first use in this function)
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:702: error: 'MX_PWM_COM1_X' undeclared (first use in this function)
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c: In function 'FC_CAL_PWM_Set_Duty_8Bit_2':
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:845: error: 'MX_DUTY_REG_X' undeclared (first use in this function)
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c: In function 'FC_CAL_PWM_Change_Period_2':
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:977: error: 'MX_PRESCALE_X' undeclared (first use in this function)
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c: In function 'FC_CAL_PWM_Set_Duty_10Bit_2':
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:1121: error: 'MX_DUTY_REG_X' undeclared (first use in this function)
Test project on 4 canals:
Attachments
Flowcode1.fcf_avr
(8.5 KiB) Downloaded 364 times

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: AVR compiler errors

Post by Benj »

Hello,

If you go into the project options, enable supplementary code and then paste the following code into the top window of the supplementary code then the program should compile as expected.

Code: Select all

#define COM0A0 COM00
#define COM0A1 COM01
#define OCR0A OCR0
Let me know how you get on.

vlad1451
Posts: 22
Joined: Sun Sep 07, 2014 6:02 am
Has thanked: 1 time
Been thanked: 1 time
Contact:

Re: AVR compiler errors

Post by vlad1451 »

Hello, I inserted this code and still gives out an error:

Code: Select all

C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c: In function 'FC_CAL_PWM_Enable_Channel_4':
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:671: error: 'MX_TCCR_X' undeclared (first use in this function)
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:671: error: (Each undeclared identifier is reported only once
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:671: error: for each function it appears in.)
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:671: error: 'MX_PWM_COM0_X' undeclared (first use in this function)
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:676: error: 'MX_PWM_COM1_X' undeclared (first use in this function)
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c: In function 'FC_CAL_PWM_Disable_Channel_4':
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:702: error: 'MX_TCCR_X' undeclared (first use in this function)
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:702: error: 'MX_PWM_COM1_X' undeclared (first use in this function)
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c: In function 'FC_CAL_PWM_Set_Duty_8Bit_4':
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:845: error: 'MX_DUTY_REG_X' undeclared (first use in this function)
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c: In function 'FC_CAL_PWM_Change_Period_4':
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:977: error: 'MX_PRESCALE_X' undeclared (first use in this function)
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c: In function 'FC_CAL_PWM_Set_Duty_10Bit_4':
C:\Program Files\Flowcode(AVR)\v5\CAL\/AVR\AVR_CAL_PWM.c:1121: error: 'MX_DUTY_REG_X' undeclared (first use in this function)
Attachments
Flowcode1.fcf_avr
(9 KiB) Downloaded 330 times

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: AVR compiler errors

Post by Benj »

Hello,

Many thanks. I have managed to track down the issue and the attached definition file should solve all the problems, no need for the supplementary code workaround any more.
ATMEGA32.fcd
(10.19 KiB) Downloaded 341 times
Let me know how you get on.

vlad1451
Posts: 22
Joined: Sun Sep 07, 2014 6:02 am
Has thanked: 1 time
Been thanked: 1 time
Contact:

Re: AVR compiler errors

Post by vlad1451 »

Everything works, many thanks. It is pleasant to deal with you. I apologize for my English, I from Russia.

Post Reply