*.tml是什么程序的后缀?

*.tml是什么程序的后缀?,第1张

电子书经常使用的格式,可以和XML互相转换

用iReader软件打开:

打开主界面---下载---点击你要的书本---阅读---

OK啦!

还可以前翻页,后番页来看.

应该不是判断忙碌或者不只是判断忙碌,这个语句应该是送了一串命令进去

//HD44780 LCD DRIVER

#include <AT89X52.H>

#include <ctype.h>

//LCD Commands

#define LCD_CLS 1 //Clears entire display and sets DDRAM address 0

#define LCD_HOME 2 //Sets DDRAM address 0 in address counter.

#define LCD_SETMODE 4 //Sets cursor move direction and specifies display shift.

#define LCD_SETVISIBLE 8 //Sets entire display (D) on/off,cursor on/off (C), and blinking of cursor position character (B).

#define LCD_SHIFT 16 //Moves cursor and shifts display without changing DDRAM contents.

#define LCD_SETFUNCTION 32 //Sets interface data length (DL), number of display lines (N), and character font (F).

#define LCD_SETCGADDR 64 //Sets CGRAM address.CGRAM data is sent and received after this setting.

#define LCD_SETDDADDR 128 //Sets DDRAM address. DDRAM data is sent and received after this setting.

#define TURE 1

#define FORSE 0

#define TMH 0xf8 //delay timeh 2ms

#define TML 0xCD //delay timel

//------------------------------------------

#define MAX_DISPLAY_CHAR 2

//-----------------------------------------

unsigned char code text[6]="hellow"

static unsigned char data counter,a

void wcchar(unsigned char d) //write a command char

void wdchar(unsigned char i) //write a data char

char wtbusy() //wait busy sign

voidclrscr(void) //clear screen

void initime0(void) //initial time0

void delay(unsigned char i) //delay

//-------------------------------

unsigned char crc8(unsigned char *pData,unsigned char count)

unsigned char pData[]={0x33,0x12,0x34,0x56,0x78,0x33,0x12,0x23,0x45,0x56}

unsigned char data crc

static char outputbuffer[MAX_DISPLAY_CHAR]

char *calc_decascii(char num)

//-------------------------------

void ISR_Timer0(void) interrupt 1

{

TL0=TML

TH0=TMH

counter--

}

void ISR_Int0(void) interrupt 0

{

wdchar(text[a++]) //display "hellow"

if (a>=6)

{a=0wdchar(' ')}

}

//main program display "hellow"

main(void)

{

unsigned char data k

initime0()

wcchar(0x38) //initial lcd

wcchar(LCD_SETVISIBLE+6) //set lcd visible

clrscr() //clear lcd

while(1)

{

crc8(&pData,10)

calc_decascii(crc)

wdchar (outputbuffer[1])

wdchar (outputbuffer[2])

wdchar (' ')

for(k=0k<=6k++)

{

// wdchar(text[k]) //display "hellow"

P1_2=0

delay(55) //delay

P1_2=1

delay(55) //delay

}

}

}

//sub function || display a char

void wdchar(unsigned char i) //write a char

{

unsigned char xdata *j

P1_0=1

P1_1=0

j=0x8000

*j=i

while (wtbusy())

{}

}

void wcchar(unsigned char d) //write a command char

{

unsigned char xdata *j

P1_0=0

P1_1=0

j=0x8000

*j=d

while (wtbusy())

{}

}

char wtbusy() //wait busy sign

{

unsigned char xdata *j

P1_0=0

P1_1=1

j=0x8000

if(*j&0x80)

{

return TURE

}

else

{

return FORSE

}

}

//clear screen

void clrscr()

{

wcchar(LCD_CLS)

}

//initial time0

void initime0()

{

TL0=TML

TH0=TMH

TR0=TURE

IE=0x93 //Enable T0 and Serial Port.

}

//sub function time delay

void delay(unsigned char i)

{

counter=i

while (counter)

{}

}

unsigned char crc8(unsigned char *pData,unsigned char count)

{

//unsigned char crc

crc = 0

while (count-- >0)

{

crc ^= *pData++

}

return crc

}

char *calc_decascii(char num)

// A rather messy function to convert a floating

// point number into an ASCII string.

{ long data temp = num

char data *arrayptr = &outputbuffer[MAX_DISPLAY_CHAR]

long data divisor = 10

long data result

char data remainder,asciival

int data i

// If the result of the calculation is zero

// insert a zero in the buffer and finish.

if (!temp)

{ *arrayptr = 48

goto done

}

// Handle Negative Numbers.

if (temp <0)

{ outputbuffer[0] = '-'

temp -= 2*temp

}

for (i=0 i <sizeof(outputbuffer) i++)

{ remainder = temp % divisor

result = temp / divisor

// If we run off the end of the number insert a space into

// the buffer.

if ((!remainder) &&(!result))

{ *arrayptr = ' '}

// We're in business - store the digit offsetting

// by 48 decimal to account for the ascii value.

else

{ asciival = remainder + 48

*arrayptr = asciival

}

temp /= 10

// Save a place for a negative sign.

if (arrayptr != &outputbuffer[1]) arrayptr--

}

done: return outputbuffer

}


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/11434812.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-16
下一篇 2023-05-16

发表评论

登录后才能评论

评论列表(0条)

保存