Цитата(MSprut @ May 20 2010, 10:16)

Приведите пожалуйста исходный код служебных функций, в частности cmdwrite.
Доброго дня! Вот такая картина:
Код
#define SetA0 set_bit(PORTG, PORTG2)
#define ClearA0 clear_bit(PORTG, PORTG2)
#define SetRD set_bit(PORTG, PORTG1)
#define ClearRD clear_bit(PORTG, PORTG1)
#define SetWR set_bit(PORTG, PORTG0)
#define ClearWR clear_bit(PORTG, PORTG0)
#define NotRESET set_bit(PORTG, PORTG3)
#define EnableRESET clear_bit(PORTG, PORTG3)
#define ComandA0 set_bit(PORTG, PORTG2)
#define DataA0 clear_bit(PORTG, PORTG2)
#define SetCS set_bit(PORTH, PORTH4)
#define ClearCS clear_bit(PORTH, PORTH4)
#define DELAY_WR_RD asm volatile ("nop\n\t" \
"nop\n\t" \
"nop\n\t" \
"nop\n\t" \
"nop\n\t" \
"nop\n\t" \
"nop\n\t" \
"nop\n\t" \
"nop\n\t" \
"nop\n\t" \
::);
void sendByte(tByte in)
{
DispPort = in;
ClearCS;
DELAY1;
ClearWR;
DELAY_WR_RD;
SetWR;
SetCS;
}
void sendCMD(tByte in)
{
ComandA0;
sendByte(in);
}
void paramwrite(tByte *p, tByte length)
{
for(tByte i = 0; i < length; i++)
{
sendByte(p[i]);
DELAY_WR_RD;
}
}
void cmdwrite(tByte *p, tByte length, tByte cmd)
{
sendCMD(cmd);
DataA0;
for(tInt j = 0; j < 500; j++)
{
DELAY_WR_RD;
}
paramwrite(p, length);
DELAY_WR_RD;
}
Забыл отметить ещё одну особенность. Считывать озу контроллера получается, и в результате считывания области памяти в которую производилась запись получаются адекватные результаты. Т.е. к примеру пишем в память "hello" на экране вначале КАЖДОЙ строки символы "hello", а содержимое памяти соответствует действительности, т.е. "hello" записано только в первые 5 байт
Сообщение отредактировал LiloQQ - May 20 2010, 07:11