Hi all,
I am a new user to the mikroPascal IDE, but I used to program in C and assembler. I want to go over to Pascal language, so I want to try out this mikroPascal but i get troubles right in the beginning ...
I tried to test the PWM on an Atmega88 but without any luck.
I get the following errors:
E-3 Identifier 'Pwm_Init' was not declared pwm_test.apas
E-4 Syntax error: Expected 'end' but ':=' found pwm_test.apas
E-3 Identifier 'Pwm_Set_Duty' was not declared pwm_test.apas
E-4 Syntax error: Expected '.' but ';' found pwm_test.apas
E-21 Internal error: E124 pwm_test.apas
I looked in the manual too, to find out the reason for errors and I found the following Requirements:
"You need a CMO module on PORTB to use this library. Check mikroPascal installation folder, subfolder “Examples”, for alternate solutions."
Where can I find those alternate solutions?
What I have to do, to get the PWM out from the Atmega88?
I had no problems using Assembler.
Can you help me out?
/Vidor
PWM on Atmega88
I found that the PWM is not added to Atmega88def file.
I added the pwm, and now I get one error line:
E-1 Error in ASM code: Register is out of range "102" TCCR0
A step forward, but not enough.
I see that is no much here in the forum.
I see a bunch of questions, without answers.
The support is not much to have here
I hope the software it will do the promised statements.
Vidor
I added the pwm, and now I get one error line:
E-1 Error in ASM code: Register is out of range "102" TCCR0
A step forward, but not enough.
I see that is no much here in the forum.
I see a bunch of questions, without answers.
The support is not much to have here
I hope the software it will do the promised statements.
Vidor
Hi,
try TCCR0A and TCCRA0B and look here:
http://www.atmel.com/dyn/resources/prod ... /2545S.pdf
Best regards
Marco
try TCCR0A and TCCRA0B and look here:
http://www.atmel.com/dyn/resources/prod ... /2545S.pdf
Best regards
Marco
Hi Marco,
I've checked the file Atmega88.apas and I found those resister addresses on the right place and right adresses:
TCCR0B: byte; absolute 0x45; volatile; register;
TCCR0A: byte; absolute 0x44; volatile; register;
So I don't know what could be the next step. I assume that I have to write the code myself, or there is some other choises?
Regards
Vidor
I've checked the file Atmega88.apas and I found those resister addresses on the right place and right adresses:
TCCR0B: byte; absolute 0x45; volatile; register;
TCCR0A: byte; absolute 0x44; volatile; register;
So I don't know what could be the next step. I assume that I have to write the code myself, or there is some other choises?
Regards
Vidor
Hi Marco,
I think there is a missunderstanding.
The code is as follows:
What is wrong?
I get the error as I mentioned it:
E-1 Error in ASM code: Register is out of range "102" TCCR0
How can I fix it?
Regards
Vidor
I think there is a missunderstanding.
The code is as follows:
Code: Select all
program pwm_test;
var duty_cycle : byte;
begin
//PortD.6 will be the outport
DDRD.5:=1; // Setting direction
duty_cycle := 30;
Pwm_Init(PWM_PHASE_CORRECT_MODE, PWM_PRESCALER_1, PWM_NON_INVERTED, duty_cycle);
while true do
begin
Delay_ms(100);
duty_cycle := duty_cycle + 1;
Pwm_Set_Duty(duty_cycle);
end;
end.
I get the error as I mentioned it:
E-1 Error in ASM code: Register is out of range "102" TCCR0
How can I fix it?
Regards
Vidor