setting Timer-0 offset in C

For C and ASSEMBLY users to post questions and code snippets for programming in C and ASSEMBLY. And for any other C or ASM course related questions.

Moderators: Benj, Mods

Post Reply
rmr
Posts: 4
Joined: Mon Dec 22, 2008 9:48 pm
Contact:

setting Timer-0 offset in C

Post by rmr »

I thought this is no problem.....
I wanted to set the offset of TMR_0 to a value of 240 in an Interrupt-Subroutine in Flowcode V4 for PIC
The properties of Timer 0 don't allow this. So I tried to use C-Code in a C-Code window like

tmr0=240;

(As I saw somewhere here in the forum)

I got this messages:
------start messages---------------------------

Starting preprocessor:.......

..........

error: unknown identifier 'TMR0'
error: invalid operand 'TMR0'
error: failed to generate expression
Balancer 16_test1 aus 16c mit TIMER0 Startwert.c success

failure

------end of messages---------------------------

(I also tried tmr0, tmr_0, TMR_0 ....)

Thanks for a reply
rmr

User avatar
Steve
Matrix Staff
Posts: 3422
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: setting Timer-0 offset in C

Post by Steve »

What chip are you using??

rmr
Posts: 4
Joined: Mon Dec 22, 2008 9:48 pm
Contact:

Re: setting Timer-0 offset in C

Post by rmr »

Hallo Steve,
I am using Eico 40pin.
Does this depend on the chip? I thought all PICs are using this Interrupt the same way.

Thank You for your Help

rmr

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: setting Timer-0 offset in C

Post by Benj »

Hello

The names of the registers change depending on the device family.

For the ECIO40 you need to use register name "tmr0l"

In C code this is:

Code: Select all

tmr0l = 240;

rmr
Posts: 4
Joined: Mon Dec 22, 2008 9:48 pm
Contact:

Re: setting Timer-0 offset in C

Post by rmr »

Thank You for your quick Help!
It works!
I have seen this command already, but I always thought the last character is the Number "1" but it's an "l" (lowercase of "L"). In Courier it looks just the same!

rmr

Post Reply