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

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

where to find timers ... please Urgent

Post by zenzehar »

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

User avatar
Benj
Matrix Staff
Posts: 14865
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: where to find timers ... please Urgent

Post by Benj »

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
Contact:

Re: where to find timers ... please Urgent

Post by nc56 »

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
Contact:

Re: where to find timers ... please Urgent

Post by Enamul »

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.
Enamul
University of Nottingham
enamul4mm@gmail.com

nc56
Posts: 60
Joined: Thu Nov 15, 2012 1:21 pm
Contact:

Re: where to find timers ... please Urgent

Post by nc56 »

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
Contact:

Re: where to find timers ... please Urgent

Post by Enamul »

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
Contact:

Re: where to find timers ... please Urgent

Post by nc56 »

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
Contact:

Re: where to find timers ... please Urgent

Post by Enamul »

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

Post Reply