where to find timers ... please Urgent

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

zenzehar
Posts: 21
Joined: Sat Nov 01, 2008 4:00 pm
Contact:

where to find timers ... please Urgent

Postby zenzehar » Sat Nov 01, 2008 4:05 pm

where to find timers ... i am using PIC 16f84 or AVR ATMEGA8535

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

Re: where to find timers ... please Urgent

Postby Benj » Mon Nov 03, 2008 11:36 am

Hello

Timers can be used by using the interrupt enable icons. If you wish to read the timer registers directly then you will need to create either a single variable or two variables depending on the size of the timer registers.

Eg in flowcode create variables timer1h and timer1l.

Then using a C code block use the following code to pull the data from the timer registers into the Flowcode variables.

Code: Select all

FCV_TIMER1H = tmr1h;
FCV_TIMER1L = tmr1l;

nc56
Posts: 60
Joined: Thu Nov 15, 2012 1:21 pm
Has thanked: 14 times
Been thanked: 4 times
Contact:

Re: where to find timers ... please Urgent

Postby nc56 » Fri Nov 23, 2012 9:43 pm

Hello Benj
If I want to read from TMR3 for example canI write
FCV_TIMER3H = tmr3h;
FCV_TIMER3L = tmr3l;
thank you

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: where to find timers ... please Urgent

Postby Enamul » Fri Nov 23, 2012 10:03 pm

Hi
Yes, you have to declare to variable named TIMER3H and TIMER3L and then used c code box where you have to put those two lines. In the rest of the code you can use flowcode variable as normal variable where you will see Timer values.
These users thanked the author Enamul for the post:
nc56 (Fri Nov 23, 2012 10:53 pm)
Rating: 5.26%
 
Enamul
University of Nottingham
enamul4mm@gmail.com

nc56
Posts: 60
Joined: Thu Nov 15, 2012 1:21 pm
Has thanked: 14 times
Been thanked: 4 times
Contact:

Re: where to find timers ... please Urgent

Postby nc56 » Fri Nov 23, 2012 11:00 pm

FCV_TIMER2L and FCV_TIMER2H are unknown by the compilator !

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: where to find timers ... please Urgent

Postby Enamul » Fri Nov 23, 2012 11:06 pm

Variable name should be TIMER2L and TIMER2H to read data from..as compiler knows tmr2l and tmr2h..but to make bridge between c and flowcode you need flowcode variable. Using flowcode variable directly in c code you will get error..but add FCV_ prefix and caps variable compiler can link the variable.
Enamul
University of Nottingham
enamul4mm@gmail.com

nc56
Posts: 60
Joined: Thu Nov 15, 2012 1:21 pm
Has thanked: 14 times
Been thanked: 4 times
Contact:

Re: where to find timers ... please Urgent

Postby nc56 » Fri Nov 23, 2012 11:32 pm

thank you , tat's true :)
for the 18f4550 ;
FCV_TIMER3L=tmr3l;
FCV_TIMER3H=tmr3h;
is working and the same thing for tmr0 and tmr1 because they are on 16 bit but for tmr2 it's only 8 bit
so we can not write tmr2l and tmr2h

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: where to find timers ... please Urgent

Postby Enamul » Sat Nov 24, 2012 12:00 am

Yes, but for some chip tmr0 is also 8-bit. So it's always better to check datasheet.
Enamul
University of Nottingham
enamul4mm@gmail.com