Ejemplo n.º 1
0
void interrupt(){
if( (INTCON.RBIF)  ){
x = PORTB;
INTCON.RBIF = 0;
cont++; // El contador vale 1 cuando comienza el pulso y 2 cuando termina
if(cont == 1){ // Comienza el pulso ? comienza temporización
TMR0H = (0 >> 8);
TMR0L = 0;
Lcd_Out_CP("Calculando...");
}else{
void main() {
     /*
       Lcd_Init() to initialize the library
     */
     Lcd_Init();
     
     /*
       In order to print a string on a specific
       row, colum, use the following function.
       
       first number is the line number.
       second number is the column number.
     */
     Lcd_Out(1, 1, "Jontropati.com");
     
     Delay_ms(1000);      // delay- 1 sec
     
     
     /*
       THis function append some new string from
       previous string position
     */
     Lcd_Out_CP(" !!!");

     Delay_ms(1000);    // delay 1 sec
     
     /*
       Clear the LCD display
     */
     Lcd_Cmd(_LCD_CLEAR);
     

     /*
       Below funciton, prints a charecter
       on specific line, column
     */
     Lcd_Chr(1, 1, 'A');
     
     Delay_ms(1000);
     
     /*
       This function appends a new charecter
       from previous position.
     */
     Lcd_Chr_CP('B');

     while (1) {

     }
}
Ejemplo n.º 3
0
char writeCurrentCursorLcd4Bits2x16( char* texto ){
    trisd = 0; // pinos D como saida
    Lcd_Out_CP( texto );
    trisd = 255; // pinos D como entrada
    return 0;
}
Ejemplo n.º 4
0
void main() {
     int citajPrvBroj = 1;
     int broj1 = 0;
     int broj2 = 0;
     int suma;

     ANSEL = 0;
     ANSELH = 0;
     
     Lcd_Init();
     Lcd_Cmd(_LCD_CLEAR);
     do {
        char kp = 0;
        do {
           kp = Keypad_Key_Click();
        } while (kp == 0);
        
        switch (kp)
        {
          case 1: kp = '1'; break; // 1
          case 2: kp = '2'; break; // 2
          case 3: kp = '3'; break; // 3
          case 4: kp = '+'; break; // +
          case 5: kp = '4'; break; // 4
          case 6: kp = '5'; break; // 5
          case 7: kp = '6'; break; // 6
          case 8: kp = 'C'; break; // C
          case 9: kp = '7'; break; // 7
          case 10: kp = '8'; break; // 8
          case 11: kp = '9'; break; // 9
          case 12: kp = '='; break; // =
          case 13: kp = 'B'; break; // brisi
          case 14: kp = '0'; break; // 0
          case 15: kp = 'K'; break; // kraj
          case 16: kp = 'P'; break; //prikazi
        }
        
        if (kp >= '0' && kp <= '9') {
           if (citajPrvBroj) {
              broj1 = kp - '0';
           } else {
             broj2 = kp - '0';
           }
        } else if (kp == '+') {
          citajPrvBroj = 0;
        } else if (kp == '=') {
          suma = broj1 + broj2;
        } else if (kp == 'B') {
          if (citajPrvBroj) {
             broj1 = 0;
           } else {
             broj2 = 0;
           }
        } else if (kp == 'C') {
          broj1 = broj2 = suma = 0;
          citajPrvBroj = 1;
          Lcd_Cmd(_LCD_CLEAR);
        } else if (kp == 'P') {
          IntToStr(suma, text);
          Lcd_Out_CP(text);
        } else if (kp == 'K') {
          break;
        }
        Lcd_Chr_CP(kp);
     } while (1);
}