Код... не проблема.
Если внутри LcdOutValue присвоить zX и yZ эти значения, то все работает как надо.
//******************************
#include <mega32.h>
#include <delay.h>
#include <math.h>
#include "alphab.h"
//******************************
#define ABS(x) (x < 0) ? -1*x : x
#define MIN(x,y) (x < y) ? x : y
#define MAX(x,y) (x > y) ? x : y
//******************************
#define _BV(x) (1 << (x))
#define SET_B(x) |= ((unsigned char)(1)<<x)
#define CLR_B(x) &=~((unsigned char)(1)<<x)
#define INV_B(x) ^= ((unsigned char)(1)<<x)
#define SET_BI(x) |= (unsigned int)(((unsigned int)(1)) << x)
#define CLR_BI(x) &=~(unsigned int)(((unsigned int)(1)) << x)
#define HI(V) (unsigned char)((unsigned int)(V) >> 8)
#define LO(V) (unsigned char)(V)
#define GetRow(Y) (unsigned char)((unsigned char)Y / 8)
//******************************
#define LCD_W 84
#define LCD_H 48
#define LCD_WH 504 // LCD_W * LCD_H / 8
#define LCD_X(zX) (unsigned char)((zX < LCD_W) ? zX : LCD_W-1)
#define LCD_Y(zY) (unsigned char)((zY < LCD_H) ? zY : LCD_H-1)
#define LCD_GetByte(cX, cY) ((unsigned int)cY * (unsigned int)LCD_W + (unsigned int)cX)
#define LCD_FONT_WIDTH 5
#define LCD_FONT_HEIGHT 8
#define LCD_OFS_DIGIT 13
//******************************
#define SYNC_OUT PORTD.5
#define SYNC_RESET_OUT PORTD.6
#define SINE_OUT PORTD.7
#define SOUND_OUT PORTB.3
#define SOUND_POT_CS PORTB.4
#define SOUND_POT_SDI PORTB.5
#define SOUND_POT_CLK PORTB.6
#define KBD_ADR0 PORTC.0
#define KBD_ADR1 PORTC.1
#define KBD_ADR2 PORTC.2
#define KBD_IN PORTC.3
#define ADC_CH PORTB.2
#define ADC_CS PORTA.3
#define ADC_SDATA PINA.2
#define ADC_SCLK PORTA.1
#define LCD_DC PORTC.6
#define LCD_CE PORTC.5
#define LCD_SDI PORTC.7
#define LCD_RST PORTC.4
#define LCD_CLK PORTA.7
//*****************************
#define Filter_MAX 10
#define MIN_VLF_FREQ 2000
#define MAX_VLF_FREQ 20000
#define SYS_FREQ 8254160UL
#define _V2(zFreq) SYS_FREQ / zFreq / 32 - 1
#define _Freq(zV2) SYS_FREQ / (zV2 + 1) / 32
#define _NormFreq(zFreq) (zFreq < MIN_VLF_FREQ) ? MIN_VLF_FREQ : ((zFreq > MAX_VLF_FREQ) ? MAX_VLF_FREQ : zFreq)
//******************************
unsigned char LCD_Buffer[LCD_WH];
//******************************
typedef enum {LCD_CMD = 0, LCD_DATA = 1} LcdCmdData;
//******************************
//flash const unsigned char KeysCode [6] = {6, 3, 5, 2, 7, 0};
flash const unsigned char strr [] = "Loading...waiting..";
//******************************
void Clear()
{
unsigned int i;
for (i = 0; i < LCD_WH; i++) LCD_Buffer[i] = 0;
}
//******************************
void OutByte(unsigned char zX, unsigned char zY, unsigned char zByte)
{
unsigned char y;
unsigned char Y0;
unsigned char y2 = zY + 8;
Y0 = zY / 8;
for (y = zY; y <= y2; y++)
{
unsigned char YY = y / 8;
if (Y0 != YY)
{
LCD_Buffer[(unsigned int)zX + ((unsigned int)y - 1) / 8 * (unsigned int)LCD_W] |= (zByte)<<(8 - y + zY);
Y0 = YY;
}
if (y == y2)
{
LCD_Buffer[(unsigned int)zX + (unsigned int)y / 8 * (unsigned int)LCD_W] |= (zByte)>>(((y/8)*8+8-y));
break;
}
}
}
//******************
void OutChar(unsigned char zX, unsigned char zY, unsigned char zIndex)
{
unsigned char x, y;
unsigned char Y0;
unsigned char x2 = zX + LCD_FONT_WIDTH;
unsigned char y2 = zY + LCD_FONT_HEIGHT;
zX = MIN(zX, LCD_W);
x2 = MIN(x2, LCD_W);
zY = MIN(zY, LCD_H);
y2 = MIN(y2, LCD_H);
Y0 = zY / 8;
for (y = zY; y <= y2; y++)
{
unsigned char YY = y/8;
if (Y0 != YY)
{
for (x = zX; x < x2; x++)
{
LCD_Buffer[(unsigned int)x + ((unsigned int)y - 1) / 8 * (unsigned int)LCD_W] |= AlphaBet[zIndex][ x - zX]<<(8 - y + zY);
}
Y0 = YY;
}
if (y == y2)
{
for (x = zX; x < x2; x++)
{
LCD_Buffer[(unsigned int)x + (unsigned int)y / 8 * (unsigned int)LCD_W] |= AlphaBet[zIndex][ (unsigned int)x - (unsigned int)zX]>>((y/8)*8+8-y);
}
break;
}
}
}
//******************
void ClearArea(unsigned char zX, unsigned char zY, unsigned char zdX, unsigned char zdY, unsigned char zFill)
{
unsigned char X2 = MIN(zX + zdX, LCD_W);
unsigned char Y2 = MIN(zY + zdY, LCD_H);
unsigned char x, y, b, cRow, aByte, aSta, aEnd;
unsigned char aRow;
unsigned char cX, cY;
zX = MIN(zX, LCD_W);
zY = MIN(zY, LCD_H);
aRow = GetRow(zY);
for (y = zY; y < Y2; y++)
{
cRow = GetRow(y);
if (cRow != aRow)
{
cX = LCD_X(zX);
cY = LCD_Y(aRow);
for (x = zX; x < X2; x++)
{
aSta = (aRow == GetRow(zY)) ? zY - aRow * 8 : 0;
aEnd = 7;
aByte = LCD_Buffer[LCD_GetByte(cX, cY)];
for (b = aSta; b <= aEnd; b++)
{
if (zFill) { aByte SET_B(

; } else { aByte CLR_B(

; }
}
LCD_Buffer[LCD_GetByte(cX, cY)] = aByte;
cX++;
cX = (cX < LCD_W) ? cX : LCD_W - 1;
}
aRow = cRow;
}
if (y == Y2-1)
{
cX = LCD_X(zX);
cY = LCD_Y(cRow);
for (x = zX; x < X2; x++)
{
aByte = LCD_Buffer[LCD_GetByte(cX, cY)];
aSta = (cRow == GetRow(zY)) ? zY - aRow * 8 : 0;
aEnd = y-cRow*8;
for (b = aSta; b <= aEnd; b++)
{
if (zFill) { aByte SET_B(

; } else { aByte CLR_B(

; }
}
LCD_Buffer[LCD_GetByte(cX, cY)] = aByte;
cX++;
cX = (cX < LCD_W) ? cX : LCD_W-1;
}
break;
}
}
}
//************************
void OutText(unsigned char zX, unsigned char zY, unsigned char flash * zIndex, unsigned char zStart, unsigned char zCount)
{
unsigned char i;
for (i = 0; i < zCount; i++) OutChar(zX + i * (LCD_FONT_WIDTH + 1), zY, zIndex[zStart + i]);
}
//************************
void LcdSend(unsigned int zValue, LcdCmdData zDC)
{
signed char b;
LCD_CE = 0;
LCD_DC = (zDC == LCD_DATA) ? 1 : 0;
for (b = 7; b >= 0; b--)
{
LCD_CLK = 0;
LCD_SDI = ((zValue & (((unsigned int)(1)) <<

) ? 1 : 0);
LCD_CLK = 1;
}
LCD_CE = 1;
}
//***************************************
void LcdInit()
{
LCD_RST = 0;
delay_ms(1);
LCD_RST = 1;
delay_ms(1);
LCD_CE = 1;
LcdSend(0x21, LCD_CMD); // LCD Extended Commands.
LcdSend(0xC8, LCD_CMD); // Set LCD Vop (Contrast).
LcdSend(0x06, LCD_CMD); // Set Temp coefficent.
LcdSend(0x13, LCD_CMD); // LCD bias mode 1:48.
LcdSend(0x20, LCD_CMD); // LCD Standard Commands, Horizontal addressing mode.
LcdSend(0x0C, LCD_CMD); // LCD in normal mode.
}
/*--------------------------------------------------------------------------------------------------
Argument(s) : contrast -> Contrast value from 0x00 to 0x7F.
Notes : No change visible at ambient temperature.
--------------------------------------------------------------------------------------------------*/
/*
void LcdContrast (unsigned char zContrast)
{
LcdSend(0x21, LCD_CMD); // LCD Extended Commands.
LcdSend(0x80 | zContrast, LCD_CMD); // Set LCD Vop (Contrast).
LcdSend(0x20, LCD_CMD); // LCD Standard Commands, horizontal addressing mode.
}
*/
/*--------------------------------------------------------------------------------------------------
Description : Copies the LCD cache into the device RAM.
--------------------------------------------------------------------------------------------------*/
void LcdUpdate()
{
//register
signed int i;
signed char b;
LcdSend(0x80, LCD_CMD);
LcdSend(0x40, LCD_CMD);
LCD_DC = 1;
LCD_CE = 0;
for (i = 0; i < LCD_WH; i++)
for (b = 7; b >= 0; b--)
{
LCD_CLK = 0;
LCD_SDI = ((LCD_Buffer[i] & (((unsigned char)(1)) <<

) ? 1 : 0);
LCD_CLK = 1;
}
LCD_CE = 1;
}
//*******************
void LcdOutValue(unsigned char zX, unsigned char zY, int zValue, unsigned char zLength)
{
unsigned char Digit = 0;
unsigned char i, ii;
unsigned char Len10 = 0;
unsigned int Temp, e;
Temp = zValue;
//ClearArea(zX, zY, (zLength)*(LCD_FONT_WIDTH+1), LCD_FONT_HEIGHT, 0);
while (Temp >= 1) { Len10 += 1; Temp /= 10; }
Temp = zValue;
for (i = zLength; i > 0; i--)
{
e = 1;
for (ii = 1; ii <= i-1; ii++) e *= 10;
Digit = Temp / e;
if (Digit > 0)
{
Temp -= Digit * e;
} else
{
Digit = 0;
}
OutChar(zX+(zLength-i)*(LCD_FONT_WIDTH+1), zY, LCD_OFS_DIGIT + Digit);
}
}
//*****************************************************
unsigned int ADC_Read()
{
unsigned char b[14];
unsigned char i;
unsigned int Result = 0;
for (i = 0; i < 16; i++) b[i] = 0;
ADC_CS = 0;
ADC_SCLK = 0;
delay_us(1);
ADC_SCLK = 1;
delay_us(1);
for (i = 0; i < 14; i++)
{
ADC_SCLK = 0;
delay_us(1);
ADC_SCLK = 1;
b[13-i] = ADC_SDATA;
delay_us(1);
}
ADC_SCLK = 0;
ADC_CS = 1;
ADC_SCLK = 1;
for (i = 0; i < 14; i++) if (b[i]) Result SET_BI(i);
return Result;
}
//***************************
void main(void)
{
PORTA=0xFF;
DDRA=0xFA;
PORTB=0x00;
DDRB=0xFF;
PORTC=0x00;
DDRC=0xF7;
PORTD=0x00;
DDRD=0xFF;
LcdInit();
TCCR0=0x00;
TCNT0=0x00;
OCR0=0x00;
/*
TCCR0=0x1D;
TCNT0=0x00;
OCR0=0x10; */
TCCR1A=0x00;
TCCR1B=0x00;
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x00;
ICR1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;
ASSR=0x00;
TCCR2=0x00;
TCNT2=0x00;
OCR2=0x00;
// External Interrupt(s) initialization
MCUCR=0x00;
MCUCSR=0x00;
// Timer(s)/Counter(s) Interrupt(s) initialization
TIMSK=0x00;
// Analog Comparator initialization
ACSR=0x80;
SFIOR=0x00;
//******************************
//Start(6500);
Clear();
LcdOutValue(5, 8, ADC_Read(), 5);
LcdUpdate();
//******************************
while (1) { };
}