help

Timer Calculator is a free software development tool used for easier calculation of timer interrupts.
Post Reply
Author
Message
azer
Posts: 2
Joined: 10 Mar 2020 22:03

help

#1 Post by azer » 10 Mar 2020 22:31

this program works but the LEDs light up and go out very quickly
What should I change
#define Rpp RA0_bit
#define Vpp RA1_bit
#define Vp RA2_bit
#define Op RA3_bit
#define Rp RB6_bit
#define Rps RB1_bit
#define Vps RB2_bit
#define Vs RB3_bit
#define Os RB4_bit
#define Rs RB5_bit


unsigned int counter=0;


void Interrupt() {
if (INTCON.T0IF) {
counter++;
TMR0 += 255;
INTCON.T0IF = 0;


if (counter==15)


Vp=0; Op=1; Rp=0; Vpp=0; Rpp=1; Vs=0; Os=0; Rs=1; Vps=0; Rps=1;
TMR0 = 15;

if (counter==137)

Op=0; Rp=1; Vpp=1; Rpp=0; Vs=1;Rs=0;
TMR0 = 137;

if (counter==152)

Vpp=0; Rpp=1; Vs=0; Os=1;
TMR0= 152;

if (counter==241)

Vp=1; Rp=0;Os=0; Rs=1; Op=1; Rps=0; Vps=1;
TMR0= 241;


}}


void main() {
INTCON =0B10100000;
OPTION_REG = 0B00000111;
TRISB = 0 ;
PORTB = 0 ;
TRISA = 0 ;
PORTA = 0 ;
}

User avatar
stefan.filipovic
mikroElektronika team
Posts: 1135
Joined: 18 Dec 2018 10:30

Re: help

#2 Post by stefan.filipovic » 12 Mar 2020 11:31

Hi,

Welcome to the MikroE forum.

Could you tell me which MCU you are using?

As I see, you haven't used the Timer Calculator to generate the code for a timer interrupt.
Have you tried with the Timer Calculator?

Kind regards,
Stefan Filipović

Post Reply

Return to “Timer Calculator”