02.02.2014 Views

Numeric LCD Display - Serial, Expandable - Sunrom Technologies

Numeric LCD Display - Serial, Expandable - Sunrom Technologies

Numeric LCD Display - Serial, Expandable - Sunrom Technologies

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

*<br />

Author: <strong>Sunrom</strong> <strong>Technologies</strong> http://www.sunrom.com<br />

Date: 28th Sep 2012<br />

Hardware Model: <strong>Numeric</strong> <strong>LCD</strong> <strong>Display</strong> Model 1129<br />

Compiler: Keil C51<br />

Shows demo how to control the <strong>LCD</strong> serially<br />

*/<br />

#include <br />

#include <br />

#include <br />

// Hardware Inteface to MCU<br />

#define CLOCK P2_0<br />

#define LATCH P2_1<br />

#define SDATA P2_2<br />

#define COM P2_3<br />

#define TIMER0_COUNT 0xDC11 /* 10000h - ((11,059,200 Hz / (12 * FREQ)) - 17) */<br />

#define NUMBER_OF_REGISTERS 4<br />

unsigned char digits[NUMBER_OF_REGISTERS]; // we will seperate a integer and<br />

use this variable to store seperated digits<br />

unsigned int count; // we will create a count variable and make it go from 0 to<br />

9999<br />

unsigned char cflag;<br />

// This array has values as to which segment becomes on for a digit from 0 to 9<br />

code unsigned char SegmentMapping[12] =<br />

{<br />

119, //0<br />

17, //1<br />

107, //2<br />

59, //3<br />

29, //4<br />

62, //5<br />

126, //6<br />

19, //7<br />

127, //8<br />

63, //9<br />

0x00, //10: All OFF<br />

0x80 //11: Special mapping for only 1 segment of display<br />

};<br />

/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-<br />

Delay x Milisecond<br />

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/<br />

void delay_ms(unsigned int x) // delays x msec (at fosc=11.0592MHz)<br />

{<br />

unsigned char j=0;<br />

while(x-- > 0)<br />

{<br />

for (j=0; j

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!