Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
LCD counter
#54
Evo ti za PIC19F4620. Može da se primeni praktično na bilo koji 8-bitni.


Code:
#include <xc.h>
#include <stdlib.h>
#include "hd44780.h"
#include "cfg.h"

#define    _XTAL_FREQ    40000000        /* Crystal frequency in MHz */    



unsigned long c;

void interrupt ISR(void)
{
   if(TMR1IF)
   {
       TMR1IF = 0;      
   }
}



void main(void)
{
unsigned char i;
char lcd[10];

   RCON = 0b00011111;

   for(i=0;i<10;i++){__delay_ms(100);}

    CMCON = 0x07;                

    LATA = 0;
    TRISA = 0xFF;        
    LATB = 0;     
    TRISB = 0xFF;
    LATC = 0;
    TRISC = 0xFF;            
    LATD = 0;
    TRISD = 0xFF;
    ADCON1 = 0x0F;
    LATE = 0x00;
    TRISE = 0x00;

    OpenLCD();
    ClearLCD();

   TMR1L = 0;
   TMR1H = 0;
   T1CON = 0b10000111;
   TMR1IF = 0;
   TMR1IE = 1;
   
    PEIE = 1;
    GIEL = 1;
   GIEH = 1;

    while(1)
    {
       for(i=0;i<10;i++){__delay_ms(100);}

       c = (unsigned long)((TMR1H << 8) + TMR1L);

       ltoa(lcd, c, 10);
       GotoLCD(0,0);
       PutsLCD(lcd);
    
   }
}
Ovo ti broji samo u jednom smeru do vrednosti promenljive od dva bajta (65535).
Reply


Messages In This Thread
LCD counter - by Želja - 12-15-2016, 05:56 PM
RE: LCD counter - by Khadgar2007 - 12-15-2016, 05:59 PM
RE: LCD counter - by Gosha - 12-15-2016, 06:07 PM
RE: LCD counter - by Želja - 12-15-2016, 06:17 PM
RE: LCD counter - by gorankg - 12-15-2016, 07:21 PM
RE: LCD counter - by Želja - 12-15-2016, 07:24 PM
RE: LCD counter - by gorankg - 12-15-2016, 07:28 PM
RE: LCD counter - by Gosha - 12-15-2016, 10:12 PM
RE: LCD counter - by mp3police - 12-16-2016, 09:59 AM
RE: LCD counter - by Želja - 12-16-2016, 10:08 AM
RE: LCD counter - by Želja - 12-16-2016, 10:00 AM
RE: LCD counter - by mp3police - 12-16-2016, 10:32 AM
RE: LCD counter - by gorankg - 12-16-2016, 11:13 AM
RE: LCD counter - by Želja - 12-16-2016, 12:43 PM
RE: LCD counter - by gorankg - 12-16-2016, 01:06 PM
RE: LCD counter - by gorankg - 12-16-2016, 01:08 PM
RE: LCD counter - by vojinilic - 12-16-2016, 01:10 PM
RE: LCD counter - by gorankg - 12-16-2016, 01:13 PM
RE: LCD counter - by Želja - 12-16-2016, 01:27 PM
RE: LCD counter - by vojinilic - 12-16-2016, 01:29 PM
RE: LCD counter - by Želja - 12-16-2016, 01:31 PM
RE: LCD counter - by mikikg - 12-16-2016, 01:34 PM
RE: LCD counter - by Želja - 12-16-2016, 01:36 PM
RE: LCD counter - by mikikg - 12-16-2016, 01:43 PM
RE: LCD counter - by Želja - 12-16-2016, 01:59 PM
RE: LCD counter - by gorankg - 12-16-2016, 01:37 PM
RE: LCD counter - by Želja - 12-16-2016, 01:42 PM
RE: LCD counter - by gorankg - 12-16-2016, 02:01 PM
RE: LCD counter - by mikikg - 12-16-2016, 02:02 PM
RE: LCD counter - by Želja - 12-16-2016, 02:09 PM
RE: LCD counter - by vojinilic - 12-16-2016, 02:27 PM
RE: LCD counter - by mikikg - 12-16-2016, 02:21 PM
RE: LCD counter - by mikikg - 12-16-2016, 02:31 PM
RE: LCD counter - by Želja - 12-16-2016, 02:39 PM
RE: LCD counter - by vojinilic - 12-16-2016, 02:41 PM
RE: LCD counter - by vojinilic - 12-16-2016, 02:39 PM
RE: LCD counter - by mikikg - 12-16-2016, 02:52 PM
RE: LCD counter - by Želja - 12-16-2016, 02:43 PM
RE: LCD counter - by Želja - 12-16-2016, 02:52 PM
RE: LCD counter - by gorankg - 12-16-2016, 02:54 PM
RE: LCD counter - by Želja - 12-16-2016, 02:56 PM
RE: LCD counter - by mikikg - 12-16-2016, 03:00 PM
RE: LCD counter - by Želja - 12-16-2016, 03:06 PM
RE: LCD counter - by vojinilic - 12-16-2016, 03:07 PM
RE: LCD counter - by Želja - 12-16-2016, 03:10 PM
RE: LCD counter - by vojinilic - 12-16-2016, 03:15 PM
RE: LCD counter - by Želja - 12-16-2016, 03:16 PM
RE: LCD counter - by mikikg - 12-16-2016, 03:27 PM
RE: LCD counter - by Želja - 12-16-2016, 03:28 PM
RE: LCD counter - by mikikg - 12-16-2016, 03:36 PM
RE: LCD counter - by gorankg - 12-16-2016, 06:35 PM
RE: LCD counter - by Želja - 12-16-2016, 06:54 PM
RE: LCD counter - by vojinilic - 12-16-2016, 07:13 PM
RE: LCD counter - by gorankg - 12-16-2016, 07:22 PM
RE: LCD counter - by Želja - 12-16-2016, 07:23 PM
RE: LCD counter - by gorankg - 12-17-2016, 09:28 AM
RE: LCD counter - by Želja - 12-17-2016, 10:42 AM
RE: LCD counter - by vojinilic - 12-17-2016, 11:29 AM
RE: LCD counter - by gorankg - 12-17-2016, 11:46 AM
RE: LCD counter - by mikikg - 12-17-2016, 12:34 PM
RE: LCD counter - by vojinilic - 12-17-2016, 12:50 PM
RE: LCD counter - by Želja - 12-17-2016, 12:56 PM
RE: LCD counter - by mp3police - 12-17-2016, 12:59 PM
RE: LCD counter - by vojinilic - 12-17-2016, 01:02 PM
RE: LCD counter - by vojinilic - 12-17-2016, 01:01 PM
RE: LCD counter - by Želja - 12-17-2016, 01:22 PM
RE: LCD counter - by Želja - 12-17-2016, 03:20 PM
RE: LCD counter - by mp3police - 12-17-2016, 03:28 PM
RE: LCD counter - by Želja - 12-17-2016, 04:02 PM
RE: LCD counter - by vojinilic - 12-17-2016, 05:09 PM
RE: LCD counter - by gorankg - 12-17-2016, 05:44 PM
RE: LCD counter - by Gosha - 12-17-2016, 06:01 PM
RE: LCD counter - by Želja - 12-17-2016, 06:05 PM
RE: LCD counter - by Želja - 12-17-2016, 05:45 PM
RE: LCD counter - by gorankg - 12-17-2016, 05:52 PM
RE: LCD counter - by Gosha - 12-17-2016, 05:55 PM
RE: LCD counter - by Želja - 12-17-2016, 05:59 PM
RE: LCD counter - by Gosha - 12-17-2016, 06:04 PM
RE: LCD counter - by Želja - 12-17-2016, 06:09 PM
RE: LCD counter - by Želja - 12-17-2016, 05:56 PM
RE: LCD counter - by Gosha - 12-17-2016, 06:03 PM
RE: LCD counter - by vojinilic - 12-17-2016, 06:13 PM
RE: LCD counter - by Želja - 12-17-2016, 06:16 PM
RE: LCD counter - by gorankg - 12-17-2016, 06:17 PM
RE: LCD counter - by Želja - 12-17-2016, 06:21 PM
RE: LCD counter - by Gosha - 12-17-2016, 06:21 PM
RE: LCD counter - by vojinilic - 12-17-2016, 06:22 PM
RE: LCD counter - by mp3police - 12-17-2016, 06:27 PM
RE: LCD counter - by Želja - 12-17-2016, 06:35 PM
RE: LCD counter - by vojinilic - 12-17-2016, 06:40 PM
RE: LCD counter - by Želja - 12-17-2016, 06:52 PM
RE: LCD counter - by vojinilic - 12-17-2016, 07:00 PM
RE: LCD counter - by vojinilic - 12-17-2016, 06:37 PM
RE: LCD counter - by mikikg - 12-17-2016, 07:12 PM
RE: LCD counter - by gorankg - 12-17-2016, 07:30 PM
RE: LCD counter - by Želja - 12-17-2016, 07:34 PM
RE: LCD counter - by Želja - 12-17-2016, 07:48 PM
RE: LCD counter - by gorankg - 12-17-2016, 08:25 PM
RE: LCD counter - by gorankg - 12-18-2016, 09:37 AM
RE: LCD counter - by Želja - 12-18-2016, 11:12 AM
RE: LCD counter - by Želja - 12-20-2016, 01:20 PM
RE: LCD counter - by gorankg - 12-20-2016, 01:46 PM
RE: LCD counter - by Želja - 12-20-2016, 01:58 PM

Forum Jump:


Users browsing this thread: 3 Guest(s)