Home Code QL200 PIC development board and more LED examples

QL200 PIC development board and more LED examples

by shedboy71

Here are some more LED examples for use with the QL200 development board, all of these are written using the mikroC pro for PIC compiler

Example 1:

 

[codesyntax lang=”c”]

int j;

void main()
{
TRISA = 0x00; // Sets all pins in PORTA as output
PORTB = 0x00;
TRISB = 0x00; // Sets all pins in PORTB as output
PORTB = 0x00; // Set
TRISC = 0x00; // Sets all pins in PORTC as output
PORTC = 0xFF;


while(1)
{
//counter example
for (j=0;j<255;j++)
{
PORTC = j;
delay_ms(500);
}
}
}

[/codesyntax]

 

Example 2:

 

[codesyntax lang=”c”]

int j;

void main()
{
TRISA = 0x00; // Sets all pins in PORTA as output
PORTB = 0x00;
TRISB = 0x00; // Sets all pins in PORTB as output
PORTB = 0x00; // Set
TRISC = 0x00; // Sets all pins in PORTC as output
PORTC = 0xFF;


while(1)
{
//counter example
for (j=0;j<255;j++)
{
PORTC = j;
PORTB = j;
PORTA = j;
delay_ms(500);
}
}
}

[/codesyntax]

 

Example 3:

 

[codesyntax lang=”c”]

void main()
{
TRISA = 0x00; // Sets all pins in PORTA as output
PORTB = 0x00;
TRISB = 0x00; // Sets all pins in PORTB as output
PORTB = 0x00; // Set
TRISC = 0x00; // Sets all pins in PORTC as output
PORTC = 0xFF;


while(1)
{

PORTC = 0b00000000;
delay_ms(500);
PORTC = 0b10000001;
delay_ms(500);
PORTC = 0b11000011;
delay_ms(500);
PORTC = 0b11100111;
delay_ms(500);
PORTC = 0b11111111;
delay_ms(500);
PORTC = 0b11100111;
delay_ms(500);
PORTC = 0b11000011;
delay_ms(500);
PORTC = 0b10000001;
delay_ms(500);

}
}

[/codesyntax]

 

Share

You may also like

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More