QL200 PIC development board and more LED examples

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]

 

Related posts

PIC18F56Q71 MCP23008 GPIO Expander LED Examples

PIC18F56Q71 VCNL4020 Ambient Light Sensor with OLED

PIC18F56Q71 VCNL4020 Proximity Sensor with OLED

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