caramoan tour package

caramoan tour package

Author Topic: panu po magpalabas ng counter sa LCD  (Read 681 times)

Offline rjp

  • CR2032 Battery
  • **
  • Posts: 37
  • Pogi/Ganda Points: 0
panu po magpalabas ng counter sa LCD
« on: August 25, 2009, 08:28:32 PM »
help naman mga master kung panu mag palabas ng output sa 2x16 LCD.. ito po yung code ko kaso ang lumalabas lang sa LCD is 00.00.00....help naman kung panu magcocount yung display ko sa LCD..tenx
///////////////////////////////////////
#include<ez8.h>
#include "lcd_api.h"

char *inp;
unsigned int ctr;

void main (void)
   {
   LCD_gpio_set();                                 // Set IO pins appropriately
   init_timer0();                                 // Initialize Timer0
   EI();                                       // Enable all Interrupts

   delayms(15);                                 // Provide customary 15ms power-on delay
   LCD_init();                                    // Init display
   LCD_blink_off();                              // Put-off character blinking

   ctr = 0;

   LCD_setposition(0,0);
   LCD_prints("00:00:00");

   while(1)
      {
      delayms(1000);
      //LCD_clear();
      ctr++;

      /*if (ctr == 1)
         {
         inp = "1";
         }

      if (ctr == 2)
         {
         inp = "2";
         }

      if (ctr == 3)
         {
         inp = "3";
         }

      if (ctr == 4)
         {
         inp = "4";
         }

         if (ctr == 5)
         {
         inp = "5";
         }

      if (ctr == 6)
         {
         inp = "6";
         }

      if (ctr == 7)
         {
         inp = "7";
         }

      if (ctr == 8)
         {
         inp = "8";
         }

         if (ctr == 9)
         {
         inp = "9";
         }

      if (ctr == 0)
         {
         inp = "0";
         }*/


      LCD_setposition(0,7);
      LCD_printc(ctr);

      if (ctr > 9)
         {ctr = 0;}
      }
   }

Philippine Electronics Forum

panu po magpalabas ng counter sa LCD
« on: August 25, 2009, 08:28:32 PM »

Offline janbobis

  • CR2032 Battery
  • **
  • Posts: 32
  • Pogi/Ganda Points: 3
  • Gender: Male
  • It's hard to bring good men down
Re: panu po magpalabas ng counter sa LCD
« Reply #1 on: August 29, 2009, 11:24:13 AM »
Russel, eto ang mai22long ko s inyo.. kayo n bhala mag-elaborate...

void main(void){
  unsigned int sec_ctr_ones, sec_ctr_tens;
  char myUnits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
  char myDigit;

  DI();
  LCD_gpio_set();   
  init_timer0();   
  EI();             

  delayms(15);     
  LCD_init();       
  LCD_blink_off();                               

  sec_ctr_ones=0
  sec_ctr_tens=0

  LCD_clear();
  LCD_setposition(0,0);
  LCD_prints("00:00:00"); 

  while(1){

    myDigit=myUnits[sec_ctr_ones];

    LCD_setposition(0,7);
    LCD_printc(myDigit);

    sec_ctr_ones++;

    if(sec_ctr_ones>9){

      sec_ctr_ones=0;
      sec_ctr_tens++;

      if(sec_ctr_tens>9) sec_ctr_tens=0;
 
      myDigit=myUnits[sec_ctr_tens];
     
      LCD_setposition(0,6);
      LCD_printc(myDigit);

 
    }

    delayms(1000);   
  }

}
//-------------------------------------------------//
//---- it's hard to bring good men down -----//
//-------------------------------------------------//

Philippine Electronics Forum

Re: panu po magpalabas ng counter sa LCD
« Reply #1 on: August 29, 2009, 11:24:13 AM »

 

Privacy Policy

Contact Us: elabph@yahoo.com