Sunday 10 June 2012

Episode 1

Introduction & LEDs patterns

This introductory video will show you what you get with the basic kit of QL-200 Dev board, how to download and install the QL-200 software and PIC C CCS Compiler. A review of the product and two examples for the LED module.




Useful links

Download the QL-200 Software and the driver for your OS:

Download the PIC C CCS Compiler:
http://www.ccsinfo.com/ccsfreedemo.php


Board Settings

Connect QL-200 to a free USB on your PC.


Then the USB LED will be ON as long the board is connected to the USB.


Turn ON the board by pressing the Supply Switch down. The Power LED will be ON. 



This are the basic steps that you need to follow every time you want to switch on and connect your board.

For this Episode you will need to enable the LED arrays and to do so turn all bits of SW11, SW12 and SW13 to ON.




Example Code

Blink example


//Include the header for 16F877A.
#include <16F877A.h>

//We use an xtal crystal, no watchdog,
//no low-voltage protection and no code protection.
#fuses XT, NOWDT, NOLVP, NOPROTECT

//The crystal is at 4,000,000 Hz.
#use delay (clock=4M)

//This is the starting point of the program.
void main()
{
   //Infinite loop.
   while(1)
   {
     //Set pin B0 to low output.
     output_low(PIN_B0);

     //Have a delay for 500 milliseconds.
     delay_ms(500);

     //Set pin B0 to high output.
     output_high(PIN_B0);

     //Have a delay for 500 milliseconds.
     delay_ms(500); 

     //Switch ON and OFF the pin A1
     //with 250 milliseconds delay.
     output_toggle(PIN_A1);
     delay_ms(250);

     //Send a bit to pin B1 every 100 milliseconds.
     output_bit(PIN_B1,1);
     delay_ms(100);
     output_bit(PIN_B1,0);
     delay_ms(100);
 
     //Send a hexadecimal byte to port C 
     //every 100 milliseconds. 
     output_c(0xff);
     delay_ms(100);
     output_c(0x00);
     delay_ms(100);
    }
}


Pattern example


//Include the header for 16F877A.
#include <16F877A.h>

//We use an xtal crystal, no watchdog,
//no low-voltage protection and no code protection.
#fuses XT, NOWDT, NOLVP, NOPROTECT

//The crystal is at 4,000,000 Hz.
#use delay (clock=4M)

//This is the counter for the for loop.
int j;

//This is the starting point of the program.
void main()
{
   //Infinite loop.
   while(1)
   {
     //Pattern of blinking LEDs on port C.
     for (j=0;j<5;j++)
     {
       //Send a binary byte to port C
       //every 500 milliseconds.
       output_c(0b10000001);
       delay_ms(500);
       output_c(0b01000010);
       delay_ms(500);
       output_c(0b00100100);
       delay_ms(500);
       output_c(0b00011000);
       delay_ms(500);
       output_c(0b00000000);
       delay_ms(500);
      }
   }
}