Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

Project Request

Return
charlie Ioannou
charllie1

posted on 2016/02/22 01:37:17 PM CET

Timers (Real time clock)

LED

Hi

I am looking for code that will blink an LED on RB0 at 7.9hz. I would relay appreciate any help with this project.

Kind Reagrds

USER Comments

Stanko Radonic
RStan

posted on 2016/05/04 09:27:28 AM CEST

for Pic45K22

unsigned char cnt=0;

void interrupt() {
if (TMR1IF_bit) {
cnt++; // increment counter
if (cnt>15)
{
cnt=0;
LATD4_Bit=~LATD4_Bit; //Led on PortD4 / blinking

}

TMR1IF_bit = 0; // clear TMR0IF
TMR1H = 0x00;
TMR1L = 0x00;
}
}




void main() {


T1CON =49; // // Timer1 settings
TMR1IF_bit = 0; // clear TMR1IF
TMR1H = 0x80; // Initialize Timer1 register
TMR1L = 0x00;
TMR1IE_bit = 1; // enable Timer1 interrupt

cnt = 0; // initialize cnt
INTCON = 0xC0; // Set GIE, PEIE

TRISD4_Bit=1;

while(1)
{

}
}







  • Rating:
0
No Abuse Reported

Do you want to report abuse comment ID: 1751 in "LED" request.

pat eff
nabonki

posted on 2016/02/22 03:15:31 PM CET

http://www.rakeshmondal.info/pic18f4550-tutorial-blinking-led

  • Rating:
0
No Abuse Reported

Do you want to report abuse comment ID: 1664 in "LED" request.