Vizitator vaidaionutradu Postat Iunie 20, 2007 Partajează Postat Iunie 20, 2007 salut am un lcd dem16216 si un pic18f458.... lcd-ul imi merge...adica e alimentat ok...cum am vazut pe aici trebuie sa mi se aprinda cel putin o linie intreaga....face asta.... nu am debugger decat MPLab. am un cod a nu reusesc sa fac nimica cu el si nu pot initializa lcd-ul deloc....daca aveti vreo idee ce tre modificat v-as fi recunoscator:fisierul xlcd_init.c/* $Id: openxlcd.c,v 1.1 2003/12/09 22:52:09 GrosbaJ Exp $ */#include #include "xlcd_zo.h"#include /********************************************************************* For the XLCD, from the xlcd.h file, we must provide:* - DelayFor18TCY() provides a 18 Tcy delay* - DelayPORXLCD() provides at least 15ms delay* - DelayXLCD() provides at least 5ms delay********************************************************************/// My clock running at 4mhz - then devided by 4? to be ~ 1us/cycle ?void DelayFor18TCY(void){Delay10TCYx(0x2); //delays 20 cyclesreturn;}void DelayPORXLCD(void) // minimum 15ms{Delay100TCYx(0xA0); // 100TCY * 160return;}void DelayXLCD(void) // minimum 5ms{Delay100TCYx(0x36); // 100TCY * 54return;}/********************************************************************* Function Name: OpenXLCD ** Return Value: void ** Parameters: lcdtype: sets the type of LCD (lines) ** Description: This routine configures the LCD. Based on ** the Hitachi HD44780 LCD controller. The ** routine will configure the I/O pins of the ** microcontroller, setup the LCD for 4- or ** 8-bit mode and clear the display. The user ** must provide three delay routines: ** DelayFor18TCY() provides a 18 Tcy delay ** DelayPORXLCD() provides at least 15ms delay ** DelayXLCD() provides at least 5ms delay ** ** NOTE: I think there may be some problems with the BIT8 mode *********************************************************************/void OpenXLCD(unsigned char lcdtype){ // For PICDEM 2 Plus, setup the A/D bits so they // don't interfere with the XLCD control bits.ADCON1 = 0b00001111;DelayPORXLCD(); // delay 15ms // The data bits must be either a 8-bit port or the upper or // lower 4-bits of a port. These pins are made into inputs#ifdef BIT8 // 8-bit mode, use whole port DATA_PORT = 0; TRIS_DATA_PORT = 0xff;#else // 4-bit mode#ifdef UPPER // Upper 4-bits of the port DATA_PORT &= 0x0f; TRIS_DATA_PORT |= 0xf0;#else // Lower 4-bits of the port DATA_PORT &= 0xf0; TRIS_DATA_PORT |= 0x0f;#endif#endif TRIS_RW = 0; // All control signals made outputs TRIS_RS = 0; TRIS_E = 0; RW_PIN = 0; // R/W pin made low RS_PIN = 0; // Register select pin made low E_PIN = 0; // Clock pin made low // Delay for 15ms to allow for LCD Power on reset DelayPORXLCD(); // Setup interface to LCD - First Init Nibble#ifdef BIT8 // 8-bit mode interface TRIS_DATA_PORT = 0; // Data port output DATA_PORT = 0b00110000; // Function set cmd(8-bit interface)#else // 4-bit mode interface#ifdef UPPER // Upper nibble interface TRIS_DATA_PORT &= 0x0f; DATA_PORT &= 0x0f; DATA_PORT |= 0b00110000; // Function set cmd(4-bit interface)#else // Lower nibble interface TRIS_DATA_PORT &= 0xf0; DATA_PORT &= 0xf0; DATA_PORT |= 0b00000011; // Function set cmd(4-bit interface)#endif#endif E_PIN = 1; // Clock the cmd in DelayFor18TCY(); E_PIN = 0; // Delay for at least 4.1ms DelayXLCD(); // Second Init Nibble#ifdef BIT8 // 8-bit mode interface #else // 4-bit mode interface#ifdef UPPER // Upper nibble interface TRIS_DATA_PORT &= 0x0f; DATA_PORT &= 0x0f; DATA_PORT |= 0b00110000; // Function set cmd(4-bit interface)#else // Lower nibble interface TRIS_DATA_PORT &= 0xf0; DATA_PORT &= 0xf0; DATA_PORT |= 0b00000011; // Function set cmd(4-bit interface)#endif#endif E_PIN = 1; // Clock the cmd in DelayFor18TCY(); E_PIN = 0; // Delay for at least 100us DelayXLCD(); // Third Init Nibble#ifdef BIT8 // 8-bit interface DATA_PORT = 0b00110000; // Function set cmd(8-bit interface)#else // 4-bit interface#ifdef UPPER // Upper nibble interface DATA_PORT &= 0x0f; // Function set cmd(4-bit interface) DATA_PORT |= 0b00110000;#else // Lower nibble interface DATA_PORT &= 0xf0; // Function set cmd(4-bit interface) DATA_PORT |= 0b00000011;#endif#endif E_PIN = 1; // Clock the cmd in DelayFor18TCY(); E_PIN = 0; // Delay for at least 4.1ms DelayXLCD(); // Fourth Init Nibble (Word for 8 bit)#ifdef BIT8 // 8-bit interface DATA_PORT = 0b00111100; // Function set cmd(8-bit interface) // Check lower Nibble for correct bits // This Init sequence has some issues!#else // 4-bit interface#ifdef UPPER // Upper nibble interface DATA_PORT &= 0x0f; // Function set cmd(4-bit interface) DATA_PORT |= 0b00100000;#else // Lower nibble interface DATA_PORT &= 0xf0; // Function set cmd(4-bit interface) DATA_PORT |= 0b00000010;#endif#endif E_PIN = 1; // Clock cmd in DelayFor18TCY(); E_PIN = 0;#ifdef BIT8 // 8-bit interface TRIS_DATA_PORT = 0xff; // Make data port input#else // 4-bit interface#ifdef UPPER // Upper nibble interface TRIS_DATA_PORT |= 0xf0; // Make data nibble input#else // Lower nibble interface TRIS_DATA_PORT |= 0x0f; // Make data nibble input#endif#endif // From now on, send bytes - (2) nibbles for 4bit // Set data interface width, # lines, font while(BusyXLCD()); // Wait if LCD busy// WriteCmdXLCD(lcdtype); // Function set cmd WriteCmdXLCD(0x28); // Function set cmd // Turn the display on then off while(BusyXLCD()); // Wait if LCD busy// WriteCmdXLCD(DOFF&CURSOR_OFF&BLINK_OFF); // Display OFF/Blink OFF WriteCmdXLCD(0x0D); while(BusyXLCD()); // Wait if LCD busy// WriteCmdXLCD(DON&CURSOR_ON&BLINK_ON); // Display ON/Blink ON // Clear display while(BusyXLCD()); // Wait if LCD busy WriteCmdXLCD(0x01); // Clear display // Set entry mode inc, no shift while(BusyXLCD()); // Wait if LCD busy// WriteCmdXLCD(SHIFT_CUR_LEFT); // Entry Mode WriteCmdXLCD(0x06); // Set DD Ram address to 0 while(BusyXLCD()); // Wait if LCD busy// SetDDRamAddr(0); // Set Display data ram address to 0 WriteCmdXLCD(0x80); // Set Display data ram address to 0 return;}/********************************************************************* Function Name: BusyXLCD ** Return Value: char: busy status of LCD controller ** Parameters: void ** Description: This routine reads the busy status of the ** Hitachi HD44780 LCD controller. *********************************************************************/unsigned char BusyXLCD(void){ RW_PIN = 1; // Set the control bits for read RS_PIN = 0; DelayFor18TCY(); E_PIN = 1; // Clock in the command DelayFor18TCY();#ifdef BIT8 // 8-bit interface if(DATA_PORT&0x80) // Read bit 7 (busy bit) { // If high E_PIN = 0; // Reset clock line RW_PIN = 0; // Reset control line return 1; // Return TRUE } else // Bit 7 low { E_PIN = 0; // Reset clock line RW_PIN = 0; // Reset control line return 0; // Return FALSE }#else // 4-bit interface#ifdef UPPER // Upper nibble interface if(DATA_PORT&0x80)#else // Lower nibble interface if(DATA_PORT&0x08)#endif { E_PIN = 0; // Reset clock line DelayFor18TCY(); E_PIN = 1; // Clock out other nibble DelayFor18TCY(); E_PIN = 0; RW_PIN = 0; // Reset control line return 1; // Return TRUE } else // Busy bit is low { E_PIN = 0; // Reset clock line DelayFor18TCY(); E_PIN = 1; // Clock out other nibble DelayFor18TCY(); E_PIN = 0; RW_PIN = 0; // Reset control line return 0; // Return FALSE }#endif}/********************************************************************* Function Name: putrsXLCD* Return Value: void* Parameters: buffer: pointer to string* Description: This routine writes a string of bytes to the* Hitachi HD44780 LCD controller. The user* must check to see if the LCD controller is* busy before calling this routine. The data* is written to the character generator RAM or* the display data RAM depending on what the* previous SetxxRamAddr routine was called.********************************************************************//*void putrsXLCD(const rom char *buffer){ while(*buffer) // Write data to LCD up to null { while(BusyXLCD()); // Wait while LCD is busy WriteDataXLCD(*buffer); // Write character to LCD buffer++; // Increment buffer } return;}*//********************************************************************* Function Name: putsXLCD* Return Value: void* Parameters: buffer: pointer to string* Description: This routine writes a string of bytes to the* Hitachi HD44780 LCD controller. The user* must check to see if the LCD controller is* busy before calling this routine. The data* is written to the character generator RAM or* the display data RAM depending on what the* previous SetxxRamAddr routine was called.********************************************************************/void putsXLCD(char *buffer){ while(*buffer) // Write data to LCD up to null { while(BusyXLCD()); // Wait while LCD is busy WriteDataXLCD(*buffer); // Write character to LCD buffer++; // Increment buffer } return;}/********************************************************************** Function Name: ReadAddrXLCD ** Return Value: char: address from LCD controller ** Parameters: void ** Description: This routine reads an address byte from the ** Hitachi HD44780 LCD controller. The user ** must check to see if the LCD controller is ** busy before calling this routine. The address** is read from the character generator RAM or ** the display data RAM depending on what the ** previous SetxxRamAddr routine was called. **********************************************************************/unsigned char ReadAddrXLCD(void){ char data; // Holds the data retrieved from the LCD#ifdef BIT8 // 8-bit interface RW_PIN = 1; // Set control bits for the read RS_PIN = 0; DelayFor18TCY(); E_PIN = 1; // Clock data out of the LCD controller DelayFor18TCY(); data = DATA_PORT; // Save the data in the register E_PIN = 0; RW_PIN = 0; // Reset the control bits#else // 4-bit interface RW_PIN = 1; // Set control bits for the read RS_PIN = 0; DelayFor18TCY(); E_PIN = 1; // Clock data out of the LCD controller DelayFor18TCY();#ifdef UPPER // Upper nibble interface data = DATA_PORT&0xf0; // Read the nibble into the upper nibble of data#else // Lower nibble interface data = (DATA_PORT<<4)&0xf0; // Read the nibble into the upper nibble of data#endif E_PIN = 0; // Reset the clock DelayFor18TCY(); E_PIN = 1; // Clock out the lower nibble DelayFor18TCY();#ifdef UPPER // Upper nibble interface data |= (DATA_PORT>>4)&0x0f; // Read the nibble into the lower nibble of data#else // Lower nibble interface data |= DATA_PORT&0x0f; // Read the nibble into the lower nibble of data#endif E_PIN = 0; RW_PIN = 0; // Reset the control lines#endif return (data&0x7f); // Return the address, Mask off the busy bit}/********************************************************************* Function Name: ReadDataXLCD ** Return Value: char: data byte from LCD controller ** Parameters: void ** Description: This routine reads a data byte from the ** Hitachi HD44780 LCD controller. The user ** must check to see if the LCD controller is ** busy before calling this routine. The data ** is read from the character generator RAM or ** the display data RAM depending on what the ** previous SetxxRamAddr routine was called. *********************************************************************/char ReadDataXLCD(void){ char data;#ifdef BIT8 // 8-bit interface RS_PIN = 1; // Set the control bits RW_PIN = 1; DelayFor18TCY(); E_PIN = 1; // Clock the data out of the LCD DelayFor18TCY(); data = DATA_PORT; // Read the data E_PIN = 0; RS_PIN = 0; // Reset the control bits RW_PIN = 0;#else // 4-bit interface RW_PIN = 1; RS_PIN = 1; DelayFor18TCY(); E_PIN = 1; // Clock the data out of the LCD DelayFor18TCY();#ifdef UPPER // Upper nibble interface data = DATA_PORT&0xf0; // Read the upper nibble of data#else // Lower nibble interface data = (DATA_PORT<<4)&0xf0; // read the upper nibble of data#endif E_PIN = 0; // Reset the clock line DelayFor18TCY(); E_PIN = 1; // Clock the next nibble out of the LCD DelayFor18TCY();#ifdef UPPER // Upper nibble interface data |= (DATA_PORT>>4)&0x0f; // Read the lower nibble of data#else // Lower nibble interface data |= DATA_PORT&0x0f; // Read the lower nibble of data#endif E_PIN = 0; RS_PIN = 0; // Reset the control bits RW_PIN = 0;#endif return(data); // Return the data byte}/********************************************************************* Function Name: SetCGRamAddr ** Return Value: void ** Parameters: CGaddr: character generator ram address ** Description: This routine sets the character generator ** address of the Hitachi HD44780 LCD ** controller. The user must check to see if ** the LCD controller is busy before calling ** this routine. *********************************************************************/void SetCGRamAddr(unsigned char CGaddr){#ifdef BIT8 // 8-bit interface TRIS_DATA_PORT = 0; // Make data port ouput DATA_PORT = CGaddr | 0b01000000; // Write cmd and address to port RW_PIN = 0; // Set control signals RS_PIN = 0; DelayFor18TCY(); E_PIN = 1; // Clock cmd and address in DelayFor18TCY(); E_PIN = 0; DelayFor18TCY(); TRIS_DATA_PORT = 0xff; // Make data port inputs#else // 4-bit interface#ifdef UPPER // Upper nibble interface TRIS_DATA_PORT &= 0x0f; // Make nibble input DATA_PORT &= 0x0f; // and write upper nibble DATA_PORT |= ((CGaddr | 0b01000000) & 0xf0);#else // Lower nibble interface TRIS_DATA_PORT &= 0xf0; // Make nibble input DATA_PORT &= 0xf0; // and write upper nibble DATA_PORT |= (((CGaddr |0b01000000)>>4) & 0x0f);#endif RW_PIN = 0; // Set control signals RS_PIN = 0; DelayFor18TCY(); E_PIN = 1; // Clock cmd and address in DelayFor18TCY(); E_PIN = 0;#ifdef UPPER // Upper nibble interface DATA_PORT &= 0x0f; // Write lower nibble DATA_PORT |= ((CGaddr<<4)&0xf0);#else // Lower nibble interface DATA_PORT &= 0xf0; // Write lower nibble DATA_PORT |= (CGaddr&0x0f);#endif DelayFor18TCY(); E_PIN = 1; // Clock cmd and address in DelayFor18TCY(); E_PIN = 0;#ifdef UPPER // Upper nibble interface TRIS_DATA_PORT |= 0xf0; // Make inputs#else // Lower nibble interface TRIS_DATA_PORT |= 0x0f; // Make inputs#endif#endif return;}/********************************************************************* Function Name: SetDDRamAddr ** Return Value: void ** Parameters: CGaddr: display data address ** Description: This routine sets the display data address ** of the Hitachi HD44780 LCD controller. The ** user must check to see if the LCD controller** is busy before calling this routine. *********************************************************************/void SetDDRamAddr(unsigned char DDaddr){#ifdef BIT8 // 8-bit interface TRIS_DATA_PORT = 0; // Make port output DATA_PORT = DDaddr | 0b10000000; // Write cmd and address to port RW_PIN = 0; // Set the control bits RS_PIN = 0; DelayFor18TCY(); E_PIN = 1; // Clock the cmd and address in DelayFor18TCY(); E_PIN = 0; DelayFor18TCY(); TRIS_DATA_PORT = 0xff; // Make port input#else // 4-bit interface#ifdef UPPER // Upper nibble interface TRIS_DATA_PORT &= 0x0f; // Make port output DATA_PORT &= 0x0f; // and write upper nibble DATA_PORT |= ((DDaddr | 0b10000000) & 0xf0);#else // Lower nibble interface TRIS_DATA_PORT &= 0xf0; // Make port output DATA_PORT &= 0xf0; // and write upper nibble DATA_PORT |= (((DDaddr | 0b10000000)>>4) & 0x0f);#endif RW_PIN = 0; // Set control bits RS_PIN = 0; DelayFor18TCY(); E_PIN = 1; // Clock the cmd and address in DelayFor18TCY(); E_PIN = 0;#ifdef UPPER // Upper nibble interface DATA_PORT &= 0x0f; // Write lower nibble DATA_PORT |= ((DDaddr<<4)&0xf0);#else // Lower nibble interface DATA_PORT &= 0xf0; // Write lower nibble DATA_PORT |= (DDaddr&0x0f);#endif DelayFor18TCY(); E_PIN = 1; // Clock the cmd and address in DelayFor18TCY(); E_PIN = 0;#ifdef UPPER // Upper nibble interface TRIS_DATA_PORT |= 0xf0; // Make port input#else // Lower nibble interface TRIS_DATA_PORT |= 0x0f; // Make port input#endif#endif return;}/********************************************************************* Function Name: WriteCmdXLCD ** Return Value: void ** Parameters: cmd: command to send to LCD ** Description: This routine writes a command to the Hitachi** HD44780 LCD controller. The user must check ** to see if the LCD controller is busy before ** calling this routine. *********************************************************************/void WriteCmdXLCD(unsigned char cmd){#ifdef BIT8 // 8-bit interface TRIS_DATA_PORT = 0; // Data port output DATA_PORT = cmd; // Write command to data port RW_PIN = 0; // Set the control signals RS_PIN = 0; // for sending a command DelayFor18TCY(); E_PIN = 1; // Clock the command in DelayFor18TCY(); E_PIN = 0; DelayFor18TCY(); TRIS_DATA_PORT = 0xff; // Data port input#else // 4-bit interface#ifdef UPPER // Upper nibble interface TRIS_DATA_PORT &= 0x0f; DATA_PORT &= 0x0f; DATA_PORT |= cmd&0xf0;#else // Lower nibble interface TRIS_DATA_PORT &= 0xf0; DATA_PORT &= 0xf0; DATA_PORT |= (cmd>>4)&0x0f;#endif RW_PIN = 0; // Set control signals for command RS_PIN = 0; DelayFor18TCY(); E_PIN = 1; // Clock command in DelayFor18TCY(); E_PIN = 0;#ifdef UPPER // Upper nibble interface DATA_PORT &= 0x0f; DATA_PORT |= (cmd<<4)&0xf0;#else // Lower nibble interface DATA_PORT &= 0xf0; DATA_PORT |= cmd&0x0f;#endif DelayFor18TCY(); E_PIN = 1; // Clock command in DelayFor18TCY(); E_PIN = 0;#ifdef UPPER // Make data nibble input TRIS_DATA_PORT |= 0xf0;#else TRIS_DATA_PORT |= 0x0f;#endif#endif return;}/********************************************************************* Function Name: WriteDataXLCD ** Return Value: void ** Parameters: data: data byte to be written to LCD ** Description: This routine writes a data byte to the ** Hitachi HD44780 LCD controller. The user ** must check to see if the LCD controller is ** busy before calling this routine. The data ** is written to the character generator RAM or** the display data RAM depending on what the ** previous SetxxRamAddr routine was called. *********************************************************************/void WriteDataXLCD(char data){#ifdef BIT8 // 8-bit interface TRIS_DATA_PORT = 0; // Make port output DATA_PORT = data; // Write data to port RS_PIN = 1; // Set control bits RW_PIN = 0; DelayFor18TCY(); E_PIN = 1; // Clock data into LCD DelayFor18TCY(); E_PIN = 0; RS_PIN = 0; // Reset control bits TRIS_DATA_PORT = 0xff; // Make port input#else // 4-bit interface#ifdef UPPER // Upper nibble interface TRIS_DATA_PORT &= 0x0f; DATA_PORT &= 0x0f; DATA_PORT |= data&0xf0;#else // Lower nibble interface TRIS_DATA_PORT &= 0xf0; DATA_PORT &= 0xf0; DATA_PORT |= ((data>>4)&0x0f);#endif RS_PIN = 1; // Set control bits RW_PIN = 0; DelayFor18TCY(); E_PIN = 1; // Clock nibble into LCD DelayFor18TCY(); E_PIN = 0;#ifdef UPPER // Upper nibble interface DATA_PORT &= 0x0f; DATA_PORT |= ((data<<4)&0xf0);#else // Lower nibble interface DATA_PORT &= 0xf0; DATA_PORT |= (data&0x0f);#endif DelayFor18TCY(); E_PIN = 1; // Clock nibble into LCD DelayFor18TCY(); E_PIN = 0;#ifdef UPPER // Upper nibble interface TRIS_DATA_PORT |= 0xf0;#else // Lower nibble interface TRIS_DATA_PORT |= 0x0f;#endif#endif return;}void delay_putsXLCD(char *buffer, char delay){ while(*buffer) // Write data to LCD up to null { while(BusyXLCD()); // Wait while LCD is busy WriteDataXLCD(*buffer); // Write character to LCD buffer++; // Increment buffer Delay10KTCYx(delay); while(BusyXLCD()); WriteCmdXLCD(SHIFT_DISP_LEFT); } return;}fisierul xlcd_start.c/* $Id: openxlcd.c,v 1.1 2003/12/09 22:52:09 GrosbaJ Exp $ */#include #include "xlcd_zo.h"#include /********************************************************************* For the XLCD, from the xlcd.h file, we must provide:* - DelayFor18TCY() provides a 18 Tcy delay* - DelayPORXLCD() provides at least 15ms delay* - DelayXLCD() provides at least 5ms delay********************************************************************/// My clock running at 4mhz - then devided by 4? to be ~ 1us/cycle ?void DelayFor18TCY(void){Delay10TCYx(0x2); //delays 20 cyclesreturn;}void DelayPORXLCD(void) // minimum 15ms{Delay100TCYx(0xA0); // 100TCY * 160return;}void DelayXLCD(void) // minimum 5ms{Delay100TCYx(0x36); // 100TCY * 54return;}/********************************************************************* Function Name: OpenXLCD ** Return Value: void ** Parameters: lcdtype: sets the type of LCD (lines) ** Description: This routine configures the LCD. Based on ** the Hitachi HD44780 LCD controller. The ** routine will configure the I/O pins of the ** microcontroller, setup the LCD for 4- or ** 8-bit mode and clear the display. The user ** must provide three delay routines: ** DelayFor18TCY() provides a 18 Tcy delay ** DelayPORXLCD() provides at least 15ms delay ** DelayXLCD() provides at least 5ms delay ** ** NOTE: I think there may be some problems with the BIT8 mode *********************************************************************/void OpenXLCD(unsigned char lcdtype){ // For PICDEM 2 Plus, setup the A/D bits so they // don't interfere with the XLCD control bits.ADCON1 = 0b00001111;DelayPORXLCD(); // delay 15ms // The data bits must be either a 8-bit port or the upper or // lower 4-bits of a port. These pins are made into inputs#ifdef BIT8 // 8-bit mode, use whole port DATA_PORT = 0; TRIS_DATA_PORT = 0xff;#else // 4-bit mode#ifdef UPPER // Upper 4-bits of the port DATA_PORT &= 0x0f; TRIS_DATA_PORT |= 0xf0;#else // Lower 4-bits of the port DATA_PORT &= 0xf0; TRIS_DATA_PORT |= 0x0f;#endif#endif TRIS_RW = 0; // All control signals made outputs TRIS_RS = 0; TRIS_E = 0; RW_PIN = 0; // R/W pin made low RS_PIN = 0; // Register select pin made low E_PIN = 0; // Clock pin made low // Delay for 15ms to allow for LCD Power on reset DelayPORXLCD(); // Setup interface to LCD - First Init Nibble#ifdef BIT8 // 8-bit mode interface TRIS_DATA_PORT = 0; // Data port output DATA_PORT = 0b00110000; // Function set cmd(8-bit interface)#else // 4-bit mode interface#ifdef UPPER // Upper nibble interface TRIS_DATA_PORT &= 0x0f; DATA_PORT &= 0x0f; DATA_PORT |= 0b00110000; // Function set cmd(4-bit interface)#else // Lower nibble interface TRIS_DATA_PORT &= 0xf0; DATA_PORT &= 0xf0; DATA_PORT |= 0b00000011; // Function set cmd(4-bit interface)#endif#endif E_PIN = 1; // Clock the cmd in DelayFor18TCY(); E_PIN = 0; // Delay for at least 4.1ms DelayXLCD(); // Second Init Nibble#ifdef BIT8 // 8-bit mode interface #else // 4-bit mode interface#ifdef UPPER // Upper nibble interface TRIS_DATA_PORT &= 0x0f; DATA_PORT &= 0x0f; DATA_PORT |= 0b00110000; // Function set cmd(4-bit interface)#else // Lower nibble interface TRIS_DATA_PORT &= 0xf0; DATA_PORT &= 0xf0; DATA_PORT |= 0b00000011; // Function set cmd(4-bit interface)#endif#endif E_PIN = 1; // Clock the cmd in DelayFor18TCY(); E_PIN = 0; // Delay for at least 100us DelayXLCD(); // Third Init Nibble#ifdef BIT8 // 8-bit interface DATA_PORT = 0b00110000; // Function set cmd(8-bit interface)#else // 4-bit interface#ifdef UPPER // Upper nibble interface DATA_PORT &= 0x0f; // Function set cmd(4-bit interface) DATA_PORT |= 0b00110000;#else // Lower nibble interface DATA_PORT &= 0xf0; // Function set cmd(4-bit interface) DATA_PORT |= 0b00000011;#endif#endif E_PIN = 1; // Clock the cmd in DelayFor18TCY(); E_PIN = 0; // Delay for at least 4.1ms DelayXLCD(); // Fourth Init Nibble (Word for 8 bit)#ifdef BIT8 // 8-bit interface DATA_PORT = 0b00111100; // Function set cmd(8-bit interface) // Check lower Nibble for correct bits // This Init sequence has some issues!#else // 4-bit interface#ifdef UPPER // Upper nibble interface DATA_PORT &= 0x0f; // Function set cmd(4-bit interface) DATA_PORT |= 0b00100000;#else // Lower nibble interface DATA_PORT &= 0xf0; // Function set cmd(4-bit interface) DATA_PORT |= 0b00000010;#endif#endif E_PIN = 1; // Clock cmd in DelayFor18TCY(); E_PIN = 0;#ifdef BIT8 // 8-bit interface TRIS_DATA_PORT = 0xff; // Make data port input#else // 4-bit interface#ifdef UPPER // Upper nibble interface TRIS_DATA_PORT |= 0xf0; // Make data nibble input#else // Lower nibble interface TRIS_DATA_PORT |= 0x0f; // Make data nibble input#endif#endif // From now on, send bytes - (2) nibbles for 4bit // Set data interface width, # lines, font while(BusyXLCD()); // Wait if LCD busy// WriteCmdXLCD(lcdtype); // Function set cmd WriteCmdXLCD(0x28); // Function set cmd // Turn the display on then off while(BusyXLCD()); // Wait if LCD busy// WriteCmdXLCD(DOFF&CURSOR_OFF&BLINK_OFF); // Display OFF/Blink OFF WriteCmdXLCD(0x0D); while(BusyXLCD()); // Wait if LCD busy// WriteCmdXLCD(DON&CURSOR_ON&BLINK_ON); // Display ON/Blink ON // Clear display while(BusyXLCD()); // Wait if LCD busy WriteCmdXLCD(0x01); // Clear display // Set entry mode inc, no shift while(BusyXLCD()); // Wait if LCD busy// WriteCmdXLCD(SHIFT_CUR_LEFT); // Entry Mode WriteCmdXLCD(0x06); // Set DD Ram address to 0 while(BusyXLCD()); // Wait if LCD busy// SetDDRamAddr(0); // Set Display data ram address to 0 WriteCmdXLCD(0x80); // Set Display data ram address to 0 return;}/********************************************************************* Function Name: BusyXLCD ** Return Value: char: busy status of LCD controller ** Parameters: void ** Description: This routine reads the busy status of the ** Hitachi HD44780 LCD controller. *********************************************************************/unsigned char BusyXLCD(void){ RW_PIN = 1; // Set the control bits for read RS_PIN = 0; DelayFor18TCY(); E_PIN = 1; // Clock in the command DelayFor18TCY();#ifdef BIT8 // 8-bit interface if(DATA_PORT&0x80) // Read bit 7 (busy bit) { // If high E_PIN = 0; // Reset clock line RW_PIN = 0; // Reset control line return 1; // Return TRUE } else // Bit 7 low { E_PIN = 0; // Reset clock line RW_PIN = 0; // Reset control line return 0; // Return FALSE }#else // 4-bit interface#ifdef UPPER // Upper nibble interface if(DATA_PORT&0x80)#else // Lower nibble interface if(DATA_PORT&0x08)#endif { E_PIN = 0; // Reset clock line DelayFor18TCY(); E_PIN = 1; // Clock out other nibble DelayFor18TCY(); E_PIN = 0; RW_PIN = 0; // Reset control line return 1; // Return TRUE } else // Busy bit is low { E_PIN = 0; // Reset clock line DelayFor18TCY(); E_PIN = 1; // Clock out other nibble DelayFor18TCY(); E_PIN = 0; RW_PIN = 0; // Reset control line return 0; // Return FALSE }#endif}/********************************************************************* Function Name: putrsXLCD* Return Value: void* Parameters: buffer: pointer to string* Description: This routine writes a string of bytes to the* Hitachi HD44780 LCD controller. The user* must check to see if the LCD controller is* busy before calling this routine. The data* is written to the character generator RAM or* the display data RAM depending on what the* previous SetxxRamAddr routine was called.********************************************************************//*void putrsXLCD(const rom char *buffer){ while(*buffer) // Write data to LCD up to null { while(BusyXLCD()); // Wait while LCD is busy WriteDataXLCD(*buffer); // Write character to LCD buffer++; // Increment buffer } return;}*//********************************************************************* Function Name: putsXLCD* Return Value: void* Parameters: buffer: pointer to string* Description: This routine writes a string of bytes to the* Hitachi HD44780 LCD controller. The user* must check to see if the LCD controller is* busy before calling this routine. The data* is written to the character generator RAM or* the display data RAM depending on what the* previous SetxxRamAddr routine was called.********************************************************************/void putsXLCD(char *buffer){ while(*buffer) // Write data to LCD up to null { while(BusyXLCD()); // Wait while LCD is busy WriteDataXLCD(*buffer); // Write character to LCD buffer++; // Increment buffer } return;}/********************************************************************** Function Name: ReadAddrXLCD ** Return Value: char: address from LCD controller ** Parameters: void ** Description: This routine reads an address byte from the ** Hitachi HD44780 LCD controller. The user ** must check to see if the LCD controller is ** busy before calling this routine. The address** is read from the character generator RAM or ** the display data RAM depending on what the ** previous SetxxRamAddr routine was called. **********************************************************************/unsigned char ReadAddrXLCD(void){ char data; // Holds the data retrieved from the LCD#ifdef BIT8 // 8-bit interface RW_PIN = 1; // Set control bits for the read RS_PIN = 0; DelayFor18TCY(); E_PIN = 1; // Clock data out of the LCD controller DelayFor18TCY(); data = DATA_PORT; // Save the data in the register E_PIN = 0; RW_PIN = 0; // Reset the control bits#else // 4-bit interface RW_PIN = 1; // Set control bits for the read RS_PIN = 0; DelayFor18TCY(); E_PIN = 1; // Clock data out of the LCD controller DelayFor18TCY();#ifdef UPPER // Upper nibble interface data = DATA_PORT&0xf0; // Read the nibble into the upper nibble of data#else // Lower nibble interface data = (DATA_PORT<<4)&0xf0; // Read the nibble into the upper nibble of data#endif E_PIN = 0; // Reset the clock DelayFor18TCY(); E_PIN = 1; // Clock out the lower nibble DelayFor18TCY();#ifdef UPPER // Upper nibble interface data |= (DATA_PORT>>4)&0x0f; // Read the nibble into the lower nibble of data#else // Lower nibble interface data |= DATA_PORT&0x0f; // Read the nibble into the lower nibble of data#endif E_PIN = 0; RW_PIN = 0; // Reset the control lines#endif return (data&0x7f); // Return the address, Mask off the busy bit}/********************************************************************* Function Name: ReadDataXLCD ** Return Value: char: data byte from LCD controller ** Parameters: void ** Description: This routine reads a data byte from the ** Hitachi HD44780 LCD controller. The user ** must check to see if the LCD controller is ** busy before calling this routine. The data ** is read from the character generator RAM or ** the display data RAM depending on what the ** previous SetxxRamAddr routine was called. *********************************************************************/char ReadDataXLCD(void){ char data;#ifdef BIT8 // 8-bit interface RS_PIN = 1; // Set the control bits RW_PIN = 1; DelayFor18TCY(); E_PIN = 1; // Clock the data out of the LCD DelayFor18TCY(); data = DATA_PORT; // Read the data E_PIN = 0; RS_PIN = 0; // Reset the control bits RW_PIN = 0;#else // 4-bit interface RW_PIN = 1; RS_PIN = 1; DelayFor18TCY(); E_PIN = 1; // Clock the data out of the LCD DelayFor18TCY();#ifdef UPPER // Upper nibble interface data = DATA_PORT&0xf0; // Read the upper nibble of data#else // Lower nibble interface data = (DATA_PORT<<4)&0xf0; // read the upper nibble of data#endif E_PIN = 0; // Reset the clock line DelayFor18TCY(); E_PIN = 1; // Clock the next nibble out of the LCD DelayFor18TCY();#ifdef UPPER // Upper nibble interface data |= (DATA_PORT>>4)&0x0f; // Read the lower nibble of data#else // Lower nibble interface data |= DATA_PORT&0x0f; // Read the lower nibble of data#endif E_PIN = 0; RS_PIN = 0; // Reset the control bits RW_PIN = 0;#endif return(data); // Return the data byte}/********************************************************************* Function Name: SetCGRamAddr ** Return Value: void ** Parameters: CGaddr: character generator ram address ** Description: This routine sets the character generator ** address of the Hitachi HD44780 LCD ** controller. The user must check to see if ** the LCD controller is busy before calling ** this routine. *********************************************************************/void SetCGRamAddr(unsigned char CGaddr){#ifdef BIT8 // 8-bit interface TRIS_DATA_PORT = 0; // Make data port ouput DATA_PORT = CGaddr | 0b01000000; // Write cmd and address to port RW_PIN = 0; // Set control signals RS_PIN = 0; DelayFor18TCY(); E_PIN = 1; // Clock cmd and address in DelayFor18TCY(); E_PIN = 0; DelayFor18TCY(); TRIS_DATA_PORT = 0xff; // Make data port inputs#else // 4-bit interface#ifdef UPPER // Upper nibble interface TRIS_DATA_PORT &= 0x0f; // Make nibble input DATA_PORT &= 0x0f; // and write upper nibble DATA_PORT |= ((CGaddr | 0b01000000) & 0xf0);#else // Lower nibble interface TRIS_DATA_PORT &= 0xf0; // Make nibble input DATA_PORT &= 0xf0; // and write upper nibble DATA_PORT |= (((CGaddr |0b01000000)>>4) & 0x0f);#endif RW_PIN = 0; // Set control signals RS_PIN = 0; DelayFor18TCY(); E_PIN = 1; // Clock cmd and address in DelayFor18TCY(); E_PIN = 0;#ifdef UPPER // Upper nibble interface DATA_PORT &= 0x0f; // Write lower nibble DATA_PORT |= ((CGaddr<<4)&0xf0);#else // Lower nibble interface DATA_PORT &= 0xf0; // Write lower nibble DATA_PORT |= (CGaddr&0x0f);#endif DelayFor18TCY(); E_PIN = 1; // Clock cmd and address in DelayFor18TCY(); E_PIN = 0;#ifdef UPPER // Upper nibble interface TRIS_DATA_PORT |= 0xf0; // Make inputs#else // Lower nibble interface TRIS_DATA_PORT |= 0x0f; // Make inputs#endif#endif return;}/********************************************************************* Function Name: SetDDRamAddr ** Return Value: void ** Parameters: CGaddr: display data address ** Description: This routine sets the display data address ** of the Hitachi HD44780 LCD controller. The ** user must check to see if the LCD controller** is busy before calling this routine. *********************************************************************/void SetDDRamAddr(unsigned char DDaddr){#ifdef BIT8 // 8-bit interface TRIS_DATA_PORT = 0; // Make port output DATA_PORT = DDaddr | 0b10000000; // Write cmd and address to port RW_PIN = 0; // Set the control bits RS_PIN = 0; DelayFor18TCY(); E_PIN = 1; // Clock the cmd and address in DelayFor18TCY(); E_PIN = 0; DelayFor18TCY(); TRIS_DATA_PORT = 0xff; // Make port input#else // 4-bit interface#ifdef UPPER // Upper nibble interface TRIS_DATA_PORT &= 0x0f; // Make port output DATA_PORT &= 0x0f; // and write upper nibble DATA_PORT |= ((DDaddr | 0b10000000) & 0xf0);#else // Lower nibble interface TRIS_DATA_PORT &= 0xf0; // Make port output DATA_PORT &= 0xf0; // and write upper nibble DATA_PORT |= (((DDaddr | 0b10000000)>>4) & 0x0f);#endif RW_PIN = 0; // Set control bits RS_PIN = 0; DelayFor18TCY(); E_PIN = 1; // Clock the cmd and address in DelayFor18TCY(); E_PIN = 0;#ifdef UPPER // Upper nibble interface DATA_PORT &= 0x0f; // Write lower nibble DATA_PORT |= ((DDaddr<<4)&0xf0);#else // Lower nibble interface DATA_PORT &= 0xf0; // Write lower nibble DATA_PORT |= (DDaddr&0x0f);#endif DelayFor18TCY(); E_PIN = 1; // Clock the cmd and address in DelayFor18TCY(); E_PIN = 0;#ifdef UPPER // Upper nibble interface TRIS_DATA_PORT |= 0xf0; // Make port input#else // Lower nibble interface TRIS_DATA_PORT |= 0x0f; // Make port input#endif#endif return;}/********************************************************************* Function Name: WriteCmdXLCD ** Return Value: void ** Parameters: cmd: command to send to LCD ** Description: This routine writes a command to the Hitachi** HD44780 LCD controller. The user must check ** to see if the LCD controller is busy before ** calling this routine. *********************************************************************/void WriteCmdXLCD(unsigned char cmd){#ifdef BIT8 // 8-bit interface TRIS_DATA_PORT = 0; // Data port output DATA_PORT = cmd; // Write command to data port RW_PIN = 0; // Set the control signals RS_PIN = 0; // for sending a command DelayFor18TCY(); E_PIN = 1; // Clock the command in DelayFor18TCY(); E_PIN = 0; DelayFor18TCY(); TRIS_DATA_PORT = 0xff; // Data port input#else // 4-bit interface#ifdef UPPER // Upper nibble interface TRIS_DATA_PORT &= 0x0f; DATA_PORT &= 0x0f; DATA_PORT |= cmd&0xf0;#else // Lower nibble interface TRIS_DATA_PORT &= 0xf0; DATA_PORT &= 0xf0; DATA_PORT |= (cmd>>4)&0x0f;#endif RW_PIN = 0; // Set control signals for command RS_PIN = 0; DelayFor18TCY(); E_PIN = 1; // Clock command in DelayFor18TCY(); E_PIN = 0;#ifdef UPPER // Upper nibble interface DATA_PORT &= 0x0f; DATA_PORT |= (cmd<<4)&0xf0;#else // Lower nibble interface DATA_PORT &= 0xf0; DATA_PORT |= cmd&0x0f;#endif DelayFor18TCY(); E_PIN = 1; // Clock command in DelayFor18TCY(); E_PIN = 0;#ifdef UPPER // Make data nibble input TRIS_DATA_PORT |= 0xf0;#else TRIS_DATA_PORT |= 0x0f;#endif#endif return;}/********************************************************************* Function Name: WriteDataXLCD ** Return Value: void ** Parameters: data: data byte to be written to LCD ** Description: This routine writes a data byte to the ** Hitachi HD44780 LCD controller. The user ** must check to see if the LCD controller is ** busy before calling this routine. The data ** is written to the character generator RAM or** the display data RAM depending on what the ** previous SetxxRamAddr routine was called. *********************************************************************/void WriteDataXLCD(char data){#ifdef BIT8 // 8-bit interface TRIS_DATA_PORT = 0; // Make port output DATA_PORT = data; // Write data to port RS_PIN = 1; // Set control bits RW_PIN = 0; DelayFor18TCY(); E_PIN = 1; // Clock data into LCD DelayFor18TCY(); E_PIN = 0; RS_PIN = 0; // Reset control bits TRIS_DATA_PORT = 0xff; // Make port input#else // 4-bit interface#ifdef UPPER // Upper nibble interface TRIS_DATA_PORT &= 0x0f; DATA_PORT &= 0x0f; DATA_PORT |= data&0xf0;#else // Lower nibble interface TRIS_DATA_PORT &= 0xf0; DATA_PORT &= 0xf0; DATA_PORT |= ((data>>4)&0x0f);#endif RS_PIN = 1; // Set control bits RW_PIN = 0; DelayFor18TCY(); E_PIN = 1; // Clock nibble into LCD DelayFor18TCY(); E_PIN = 0;#ifdef UPPER // Upper nibble interface DATA_PORT &= 0x0f; DATA_PORT |= ((data<<4)&0xf0);#else // Lower nibble interface DATA_PORT &= 0xf0; DATA_PORT |= (data&0x0f);#endif DelayFor18TCY(); E_PIN = 1; // Clock nibble into LCD DelayFor18TCY(); E_PIN = 0;#ifdef UPPER // Upper nibble interface TRIS_DATA_PORT |= 0xf0;#else // Lower nibble interface TRIS_DATA_PORT |= 0x0f;#endif#endif return;}void delay_putsXLCD(char *buffer, char delay){ while(*buffer) // Write data to LCD up to null { while(BusyXLCD()); // Wait while LCD is busy WriteDataXLCD(*buffer); // Write character to LCD buffer++; // Increment buffer Delay10KTCYx(delay); while(BusyXLCD()); WriteCmdXLCD(SHIFT_DISP_LEFT); } return;}fisierul xlcd_main.c/* $Id: openxlcd.c,v 1.1 2003/12/09 22:52:09 GrosbaJ Exp $ */#include #include "xlcd_zo.h"#include /********************************************************************* For the XLCD, from the xlcd.h file, we must provide:* - DelayFor18TCY() provides a 18 Tcy delay* - DelayPORXLCD() provides at least 15ms delay* - DelayXLCD() provides at least 5ms delay********************************************************************/// My clock running at 4mhz - then devided by 4? to be ~ 1us/cycle ?void DelayFor18TCY(void){Delay10TCYx(0x2); //delays 20 cyclesreturn;}void DelayPORXLCD(void) // minimum 15ms{Delay100TCYx(0xA0); // 100TCY * 160return;}void DelayXLCD(void) // minimum 5ms{Delay100TCYx(0x36); // 100TCY * 54return;}/********************************************************************* Function Name: OpenXLCD ** Return Value: void ** Parameters: lcdtype: sets the type of LCD (lines) ** Description: This routine configures the LCD. Based on ** the Hitachi HD44780 LCD controller. The ** routine will configure the I/O pins of the ** microcontroller, setup the LCD for 4- or ** 8-bit mode and clear the display. The user ** must provide three delay routines: ** DelayFor18TCY() provides a 18 Tcy delay ** DelayPORXLCD() provides at least 15ms delay ** DelayXLCD() provides at least 5ms delay ** ** NOTE: I think there may be some problems with the BIT8 mode *********************************************************************/void OpenXLCD(unsigned char lcdtype){ // For PICDEM 2 Plus, setup the A/D bits so they // don't interfere with the XLCD control bits.ADCON1 = 0b00001111;DelayPORXLCD(); // delay 15ms // The data bits must be either a 8-bit port or the upper or // lower 4-bits of a port. These pins are made into inputs#ifdef BIT8 // 8-bit mode, use whole port DATA_PORT = 0; TRIS_DATA_PORT = 0xff;#else // 4-bit mode#ifdef UPPER // Upper 4-bits of the port DATA_PORT &= 0x0f; TRIS_DATA_PORT |= 0xf0;#else // Lower 4-bits of the port DATA_PORT &= 0xf0; TRIS_DATA_PORT |= 0x0f;#endif#endif TRIS_RW = 0; // All control signals made outputs TRIS_RS = 0; TRIS_E = 0; RW_PIN = 0; // R/W pin made low RS_PIN = 0; // Register select pin made low E_PIN = 0; // Clock pin made low // Delay for 15ms to allow for LCD Power on reset DelayPORXLCD(); // Setup interface to LCD - First Init Nibble#ifdef BIT8 // 8-bit mode interface TRIS_DATA_PORT = 0; // Data port output DATA_PORT = 0b00110000; // Function set cmd(8-bit interface)#else // 4-bit mode interface#ifdef UPPER // Upper nibble interface TRIS_DATA_PORT &= 0x0f; DATA_PORT &= 0x0f; DATA_PORT |= 0b00110000; // Function set cmd(4-bit interface)#else // Lower nibble interface TRIS_DATA_PORT &= 0xf0; DATA_PORT &= 0xf0; DATA_PORT |= 0b00000011; // Function set cmd(4-bit interface)#endif#endif E_PIN = 1; // Clock the cmd in DelayFor18TCY(); E_PIN = 0; // Delay for at least 4.1ms DelayXLCD(); // Second Init Nibble#ifdef BIT8 // 8-bit mode interface #else // 4-bit mode interface#ifdef UPPER // Upper nibble interface TRIS_DATA_PORT &= 0x0f; DATA_PORT &= 0x0f; DATA_PORT |= 0b00110000; // Function set cmd(4-bit interface)#else // Lower nibble interface TRIS_DATA_PORT & Link spre comentariu
Abram Burel Postat Iunie 20, 2007 Partajează Postat Iunie 20, 2007 Uau! Dar ai programat ceva la chestia asta! Sau poate e luat de undeva :rolleyes:E greu de spus cum e cu buba. Daca cel ce a facut softul a fost cinstit, l-a publicat... corect. Cu hardul cum stai? Esti sigur ca e in regula? Atat conceptula, cat si ca realizare.Am si eu un televizor care nu merge. Dca vrei pun aici schema. Poti sa-mi spui ce are :snakeman: Link spre comentariu
Vizitator vaidaionutradu Postat Iunie 20, 2007 Partajează Postat Iunie 20, 2007 de schema sunt sigur ca ii buna :yawinkle: Link spre comentariu
Abram Burel Postat Iunie 21, 2007 Partajează Postat Iunie 21, 2007 Ne spui daca lucrezi pe 8 sau pe 4 biti? Link spre comentariu
Vizitator vaidaionutradu Postat Iunie 21, 2007 Partajează Postat Iunie 21, 2007 pe 4 biti Link spre comentariu
XAN77 Postat Iunie 24, 2007 Partajează Postat Iunie 24, 2007 eu cred ca esti cel putin entuziast sa crezi ca sta cineva sa iti inteleaga programul tau kilometric, puteai pune o secventa mica in care doar se afisa ceva la lcd si care nu facea ce trebuie. Citeste datasheet al lcdului, daca il ai, ca sa vezi daca are particularitati legate de timeing si daca e compatibil HD44780 si incearca afisari simple atat din C, Basic, Jal etc. dar in special din asambler conform specificatiilor standardului hd44780, nu e deloc complicat sa trimiti o initializre, clear screen si un caracter la un lcd, ca sa vezi daca mai e bun lcdul tau ; ca nu ai zis ca sigur e bun, adica afiseaza ceva cu alte .hex-uri . Link spre comentariu
aghora17 Postat Iunie 24, 2007 Partajează Postat Iunie 24, 2007 1. te-as sfatui in prima faza sa incerci pe 8 biti. e mai usor de controlat magaoaia. 2. pe site-ul de la microchip, (si daca dai search pe google gasesti si acolo), sunt coduri gata scrise pentru unele MCU. Ideea este ca daca ai mai mult de o problema, este foarte dificil sa o identifici, referindu-ma aici la una hard si la una soft. De aceea este bine sa stii ca totul merge bine dpdv hard, ca apoi sa te ocupi de soft. Cat despre codul postat de tine, este mult prea mare pentru a fi urmarit de cineva, ca sa nu mai spun de a sapa pentru o eroare. O greseala frecventa este, la initiere, delay-ul mai mic de 5ms, specificat in catalog, in partea de initiere, pulsul pe pinul E, mai mic decat specificatia. http://aghora17.idilis.ro/scheme/lcd.pdf poate asta te ajuta. Link spre comentariu
XAN77 Postat Iunie 25, 2007 Partajează Postat Iunie 25, 2007 tocmai scrisesem "sau vestitu pdf : How to use intelligent LCD 's, unde ai exemplu de cod asm pentru pic ." dar nu lam putut atasa. Este o arhiva rar in care sunt cele 2 pdf-uri, ca e din 2 parti materialul respectiv . Am primit mesajul - Sorry, you have reached your maximum Upload Quota Limit of 5 MB . wtf :rolleyes: Link spre comentariu
MirceaM Postat Iulie 2, 2007 Partajează Postat Iulie 2, 2007 Daca lucrezi pe 4 biti este posibil sa trebuiasca (este posibil sa fie chiar obligatoriu) ca acei 4 biti sa fie: D4, D5, D6 si D7, pe LCD. Nu merge cu D0, D1, D2, D3. Eu asa am patit, am facut aceasta greseala. Nu pot sa afirm ca este asa cu toate LCD-urile (poate ne spune cineva mai mult), motiv pt care am introdus mai sus cuvantul "posibil". Asa ca verifica si treaba asta. Link spre comentariu
bld Postat Iulie 2, 2007 Partajează Postat Iulie 2, 2007 La standardul HD44780 e obligatoriu ca cei patru bitit sa fie D7-D4. Link spre comentariu
Vizitator dandu_jucauu Postat Mai 22, 2009 Partajează Postat Mai 22, 2009 Din pacate am aceeasi problema:D..ai reusit pana la urma?....daca da..te rog trimite-mi si mie codul de initializare...ca si eu ma chinui de ceva vreme...... Link spre comentariu
aghora17 Postat Mai 22, 2009 Partajează Postat Mai 22, 2009 din cate stiu pe site la microchip exista un soft complet pentru ele. Link spre comentariu
nooob64 Postat Iunie 16, 2009 Partajează Postat Iunie 16, 2009 Uite de la mine un raspuns de noob:Mai bine folosesti un soft gen MikroC (daca tot C vrei sa folosesti) ai functii gata definite si nu trebuie sa te mai chinuiesti ca cauti 'buba' din ditamai codu, plus are si ICD debug. Link spre comentariu
Vizitator piggolo Postat Iulie 22, 2009 Partajează Postat Iulie 22, 2009 iti ofer eu partea soft pt initializare :)ce vrei, ASM sau C ?cu o singura precizare, asm-ul e pt o interfata de 8biti iar c-ul pt 4biti Link spre comentariu
caddyct Postat Iulie 26, 2009 Partajează Postat Iulie 26, 2009 daca doresti in sa folosesti in compilatorul C18 de la microchip iti pot oferi un cod sursa pentru initalizarea lcd-ului (initializare/scriere etc).de asemenea si biblioteca xlcd.h a compilatorului modificata pentru PORT D.contacteaza-ma pe privat.ca o alternativa poti sa citesti si pe forumul celor de la microchip sunt zeci de posturi pe tematica asta. Link spre comentariu
Postări Recomandate
Creează un cont sau autentifică-te pentru a adăuga comentariu
Trebuie să fi un membru pentru a putea lăsa un comentariu.
Creează un cont
Înregistrează-te pentru un nou cont în comunitatea nostră. Este simplu!
Înregistrează un nou contAutentificare
Ai deja un cont? Autentifică-te aici.
Autentifică-te acum