졸업작품/Counter (7Segment, LCD)

LCD Counter (PIC16F883 Based) Hi-Tech (가구점)

ElectricShock 2017. 1. 22. 16:50

가구점 의뢰

Websat 제작

INTOSCIO


counter.rar


#define _XTAL_FREQ 8000000

#define BIT8


#include <htc.h>

#include <xlcd.h>

#include "stdio.h"


__CONFIG(FOSC_INTRC_NOCLKOUT & WDTE_OFF & PWRTE_ON & MCLRE_OFF & CPD_OFF);

__CONFIG(BOREN_ON & WRT_OFF & LVP_OFF & CP_OFF);


char Counter_String[16];

long int Counter = 20000;

int i;


int main()

{

TRISA = 0;

ANSEL = 0;

PORTA = 0xFF;

    while(1)

    {

        //lcd_clear();

//lcd_puts("www.electroSome.com");

ANSELH = 0x0;

OpenXLCD(02);

SetDDRamAddr(0x82);

putrsXLCD("COUNTER MODE:");

while(BusyXLCD());

SetDDRamAddr(0xC5);

while(BusyXLCD());

sprintf(Counter_String,"%03u",Counter);

putrsXLCD(Counter_String);

while(BusyXLCD());

while (1)

{

                PORTA = 0xF;

for (i=0; i<120; i++)

__delay_ms(100);

PORTA = 0x0F0;

for (i=0; i<130; i++)

__delay_ms(100);

Counter++;

sprintf(Counter_String,"%03u",Counter);

SetDDRamAddr(0xC5);

while(BusyXLCD());

putrsXLCD(Counter_String);

while(BusyXLCD());

}

    }

    return 0;

}


void Loop_Lcd (signed int Delay_input)

{

while (Delay_input > 0)

{

Delay_input --;

}

}