.


:




:

































 

 

 

 





 

. - .

Sym<0x20
Sym=0x0C
DispPos=0
Sym=0x0D
DispPos &= 0x10
WriteComm((DispPos<<2)|0x80)
Sym >0x7F  
Sym = Table[Sym & 0x7F]
WaitReady()
WriteDataAddr = Sym
DispPos++
DispPos &= 0xF

 

. - .

, , , . , . , , . .

 


 

 

, . : MAIN , INIT(), WaitReady(), WriteComm(), WriteData(). , _WDR() .

 

.

 

#include <io2313.h> // 90S2313

#include <ina90.h> // 90Sxxxx

 

#define DispBASE 0x010000/* 1 -

, DispBASE =0000 */

#define ReadStateAddr (*(char *) (DispBASE+0x800)) /* =0200h*/

#define WriteCommAddr (*(char *) (DispBASE+0x000)) /* =0000h*/

#define ReadDataAddr (*(char *) (DispBASE+0xC00)) /* =0300h*/

#define WriteDataAddr (*(char *) (DispBASE+0x400))/* =0100h*/

 

char DispPos; /* - */

 

/*********************************************************************************/

void main(void)

{

INIT(); //

_SEI(); //

 

//

while (1)

{

_WDR(); //

}

}

 

/*********************************************************************************/

void INIT(void) //

{

TCCR1A = 0x00;

TCCR1B = 0x14;

 

TIMSK |= Bit(MskTIE1); // 1 -

GIMSK |= Bit(MskInt0); // INT0 -

WDTCR = 0x0F; // WATCHDOG

 

//

DDR = 0xFF; //11111111 0...7-

PORTD = 0x00; //

 

}

/****************************************************************************/

/* */

void WaitReady(void)

{

while (ReadStateAddr & 0x80); /* */

}

/****************************************************************************/

/* */

void WriteComm(char Cmd)

{

WaitReady();

WriteCommAddr = Cmd; /* */

}

/* */

code const char Table[128] = (0x41,0xA0,0x42,0xA1,0xE0,0x45,0xA3,0xA4, 0xA5,0xA6,0x4B,0xA7,0x4D,0x48,0x4F,0xA8,

0x50,0x43,0x54,0xA9,0xAA,0x58,0xE1,0xAB, 0xAC,0xE2,0xAD,0xAE,0x62,0xAF,0xB0,0xB1,

0x61,0xB2,0xB3,0xB4,0xE3,0x65,0xB6,0xB7, 0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0x6F,0x6E,

0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7, 0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF,

0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7, 0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,

0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7, 0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF,

0x70,0x63,0xBF,0x79,0xE4,0x78,0xE5,0xC0, 0xC1,0xE6,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,

0xA2,0xB5,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,

0xEA,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF);

 

/****************************************************************************/

/* */

void WriteData(char Sym) /* Sym - ASCII */

{

if (Sym < 0x20) /* */

{

switch (Sym)

{

case 0x0C: /* */

WriteComm(0x01); /* */

DispPos=0; /* */

break;

case 0x0D: /* */

DispPos &= 0x10; /* */

WriteComm((DispPos<<2)|0x80); /* */

break;

}

}

else /* */

{

if (Sym >0x7F) /* ASCII ? */

Sym = Table[Sym & 0x7F]; /* */

WaitReady(); /* */

WriteDataAddr = Sym; /* */

DispPos++; DispPos &= 0xF; /*

015, .. 15 0*/

}

else /* */

{

if (Sym >0x30 && Dat <0x39) /* ? */

WaitReady(); /* */

WriteDataAddr = Sym; /* */

DispPos++; DispPos &= 0xF; /*

015, .. 15 0 */

}

}


 

.

 

 

 


 

 

1. .. . .- -: , 2003.

2. . . 2- . .: , 2001.

3. .. AVR Classic ATMEL. .: XXI 2002.

 





:


: 2017-04-14; !; : 302 |


:

:

.
==> ...

1560 - | 1389 -


© 2015-2024 lektsii.org - -

: 0.014 .