PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : [ERLEDIGT] 4x20 Display an M256



copcom-weber
18.11.2013, 10:05
Hallo

habe ähnlich wie bei der M32 die Libs verändert aber da kommt nur misst bei raus.
habe es so abgeändert:
h. lib


void _showScreenLCD_P(const char *line1, const char *line2, const char *line3, const char *line4);

#define showScreenLCD(__line1,__line2,__line3,__line4); ({_showScreenLCD_P((PSTR(__line1)),(PSTR(__line2)) ,(PSTR(__line3)),(PSTR(__line4)));})


c. lib


void initLCD(void)
{
delayCycles(34000); //No need for Power ON delay as usually the
// Bootloader should have been executed before...
PORTG &= ~DISP_WR;
PORTG &= ~DISP_RS_ALE;
PORTG &= ~DISP_EN_RD;

mSleep(5);

writeLCDCommand(0b00101100);
delayCycles(55500);
mSleep(50);

writeLCDCommand(0b00001001);
delayCycles(55500);
mSleep(5);

writeLCDCommand(0b00101000);
delayCycles(55500);

mSleep(5);

writeLCDCommand(0b00001000);
delayCycles(55500);
mSleep(1);


writeLCDCommand(0b00000001);
delayCycles(55500);
mSleep(1);

writeLCDCommand(0b00000010);
delayCycles(55500);
mSleep(1);

writeLCDCommand(0b00001100);
delayCycles(55500);
mSleep(1);

mSleep(5);

clearLCD();
}
und


void _showScreenLCD_P(const char *line1, const char *line2, const char *line3, const char *line4)
{
clearLCD();
writeNStringLCD_P(line1);
setCursorPosLCD(1, 0);
writeNStringLCD_P(line2);
setCursorPosLCD(2, 0);
writeNStringLCD_P(line3);
setCursorPosLCD(3, 0);
writeNStringLCD_P(line4);
}

/**
* Sets the cursor position on LCD.
*/
void setCursorPosLCD(uint8_t line, uint8_t pos)
{
pos |= 128;
if(line==1) pos += 0x40;
if(line==2) pos += 0x14;
if(line==3) pos += 0x54;
writeLCDCommand(pos);
}

was ist daran nun falsch?

danke schonmal

radbruch
18.11.2013, 10:39
Hallo

Meine Anpassungen an mein 20x4-LCD:


// LDC 20x4
void setCursorPosLCD_20x4(uint8_t line, uint8_t pos)
{
pos |= 128;
if(line==1) pos += 0x40;
else if(line==2) pos += 20;
else if(line==3) pos += 0x40+20;
writeLCDCommand(pos);
}

void _showScreenLCD_P_20x4(const char *line1, const char *line2, const char *line3, const char *line4)
{
clearLCD();
writeNStringLCD_P(line1);
setCursorPosLCD_20x4(1, 0);
writeNStringLCD_P(line2);
setCursorPosLCD_20x4(2, 0);
writeNStringLCD_P(line3);
setCursorPosLCD_20x4(3, 0);
writeNStringLCD_P(line4);
}

#define showScreenLCD_20x4(__line1,__line2, __line3,__line4); \
({_showScreenLCD_P_20x4((PSTR(__line1)),(PSTR(__li ne2)), (PSTR(__line3)),(PSTR(__line4)));})
(Aus https://www.roboternetz.de/community/threads/60347-Display-RP6-16x4?p=567418&viewfull=1#post567418)


http://www.youtube.com/watch?v=_XI_xrk95H8

Gruß

mic

copcom-weber
18.11.2013, 10:51
wunderbar hatte was verändert was ich garnicht musste und es geht danke!