08.01.2013 Aufrufe

Download - Projektlabor

Download - Projektlabor

Download - Projektlabor

MEHR ANZEIGEN
WENIGER ANZEIGEN

Erfolgreiche ePaper selbst erstellen

Machen Sie aus Ihren PDF Publikationen ein blätterbares Flipbook mit unserer einzigartigen Google optimierten e-Paper Software.

*/<br />

514: DDR(LCD_DATA0_PORT) |= 0x7F;<br />

515: }<br />

516: else if ( ( &LCD_DATA0_PORT == &LCD_DATA1_PORT) && ( &LCD_DATA1_PORT<br />

D:\juergen\Projekt\Projekt\prog\Frequenzzaehler\lcd.c<br />

== &LCD_DATA2_PORT ) && ( &LCD_DATA2_PORT == &LCD_DATA3_PORT )<br />

517: && (LCD_DATA0_PIN == 0 ) && (LCD_DATA1_PIN == 1) &&<br />

(LCD_DATA2_PIN == 2) && (LCD_DATA3_PIN == 3) )<br />

518: {<br />

519: /* configure all port bits as output (all LCD data lines on same<br />

port, but control lines on different ports) */<br />

520: DDR(LCD_DATA0_PORT) |= 0x0F;<br />

521: DDR(LCD_RS_PORT) |= _BV(LCD_RS_PIN);<br />

522: DDR(LCD_RW_PORT) |= _BV(LCD_RW_PIN);<br />

523: DDR(LCD_E_PORT) |= _BV(LCD_E_PIN);<br />

524: }<br />

525: else<br />

526: {<br />

527: /* configure all port bits as output (LCD data and control lines<br />

on different ports */<br />

528: DDR(LCD_RS_PORT) |= _BV(LCD_RS_PIN);<br />

529: DDR(LCD_RW_PORT) |= _BV(LCD_RW_PIN);<br />

530: DDR(LCD_E_PORT) |= _BV(LCD_E_PIN);<br />

531: DDR(LCD_DATA0_PORT) |= _BV(LCD_DATA0_PIN);<br />

532: DDR(LCD_DATA1_PORT) |= _BV(LCD_DATA1_PIN);<br />

533: DDR(LCD_DATA2_PORT) |= _BV(LCD_DATA2_PIN);<br />

534: DDR(LCD_DATA3_PORT) |= _BV(LCD_DATA3_PIN);<br />

535: }<br />

536: delay(16000); /* wait 16ms or more after power-on */<br />

537:<br />

538: /* initial write to lcd is 8bit */<br />

539: LCD_DATA1_PORT |= _BV(LCD_DATA1_PIN); // _BV(LCD_FUNCTION)>>4;<br />

540: LCD_DATA0_PORT |= _BV(LCD_DATA0_PIN); // _BV(LCD_FUNCTION_8BIT)>>4;<br />

541: lcd_e_toggle();<br />

542: delay(4992); /* delay, busy flag can't be checked here */<br />

543:<br />

544: /* repeat last command */<br />

545: lcd_e_toggle();<br />

546: delay(64); /* delay, busy flag can't be checked here */<br />

547:<br />

548: /* repeat last command a third time */<br />

549: lcd_e_toggle();<br />

550: delay(64); /* delay, busy flag can't be checked here */<br />

551:<br />

552: /* now configure for 4bit mode */<br />

553: LCD_DATA0_PORT &= ~_BV(LCD_DATA0_PIN); //<br />

LCD_FUNCTION_4BIT_1LINE>>4<br />

554: lcd_e_toggle();<br />

555: delay(64); /* some displays need this additional delay */<br />

556:<br />

557: /* from now the LCD only accepts 4 bit I/O, we can use lcd_command()<br />

*/<br />

558: #else<br />

559: /*<br />

560: * Initialize LCD to 8 bit memory mapped mode<br />

561: */<br />

562:<br />

563: /* enable external SRAM (memory mapped lcd) and one wait state */<br />

564: MCUCR = _BV(SRE) | _BV(SRW);<br />

565:<br />

566: /* reset LCD */<br />

567: delay(16000); /* wait 16ms after power-on<br />

*/<br />

568: lcd_write(LCD_FUNCTION_8BIT_1LINE,0); /* function set: 8bit<br />

interface */<br />

569: delay(4992); /* wait 5ms<br />

*/<br />

570: lcd_write(LCD_FUNCTION_8BIT_1LINE,0); /* function set: 8bit<br />

interface */<br />

571: delay(64); /* wait 64us<br />

*/<br />

236

Hurra! Ihre Datei wurde hochgeladen und ist bereit für die Veröffentlichung.

Erfolgreich gespeichert!

Leider ist etwas schief gelaufen!