Repetier with i2c LCD - Not initing October 12, 2012 04:26PM |
Registered: 11 years ago Posts: 121 |
#define I2C_ADDR 0x38 // Define I2C Address where the PCF8574A is #define En_pin 6 #define Rw_pin 0 #define Rs_pin 7 #define D4_pin 4 #define D5_pin 3 #define D6_pin 2 #define D7_pin 1
*/ #define UI_DISPLAY_TYPE 3 // This is line 2 of the status display at startup #define UI_VERSION_STRING2 "Orig. Mendel" /** Number of columns per row Typical values are 16 and 20 */ #define UI_COLS 20 /** Rows of your display. 2 or 4 */ #define UI_ROWS 4 /* What type of chip is used for I2C communication 0 : PCF8574 or PCF8574A or compatible chips. 1 : MCP23017 */ #define UI_DISPLAY_I2C_CHIPTYPE 0 // 0x40 till 0x4e for PCF8574, 0x40 for the adafruid RGB shield, 0x40 - 0x4e for MCP23017 #define UI_DISPLAY_I2C_ADDRESS 0x38 // For MCP 23017 define which pins should be output #define UI_DISPLAY_I2C_OUTPUT_PINS 65504 // Set the output mask that is or'd over the output data. This is needed to activate // a backlight switched over the I2C. // The adafruit RGB shields enables a light if the bit is not set. Bits 6-8 are used for backlight. #define UI_DISPLAY_I2C_OUTPUT_START_MASK 0 // For MCP which inputs are with pullup. 31 = pins 0-4 for adafruid rgb shield buttons #define UI_DISPLAY_I2C_PULLUP 31 /* How fast should the I2C clock go. The PCF8574 work only with the lowest setting 100000. A MCP23017 can run also with 400000 Hz */ #define UI_I2C_CLOCKSPEED 100000L /** Define the pin */ #if UI_DISPLAY_TYPE==3 // I2C Pin configuration #define UI_DISPLAY_RS_PIN _BV(7) #define UI_DISPLAY_RW_PIN _BV(0) #define UI_DISPLAY_ENABLE_PIN _BV(6) #define UI_DISPLAY_D0_PIN _BV(4) #define UI_DISPLAY_D1_PIN _BV(3) #define UI_DISPLAY_D2_PIN _BV(2) #define UI_DISPLAY_D3_PIN _BV(1) #define UI_DISPLAY_D4_PIN _BV(4) #define UI_DISPLAY_D5_PIN _BV(3) #define UI_DISPLAY_D6_PIN _BV(2) #define UI_DISPLAY_D7_PIN _BV(1)
Re: Repetier with i2c LCD - Not initing October 12, 2012 05:15PM |
Registered: 11 years ago Posts: 121 |
Re: Repetier with i2c LCD - Not initing October 13, 2012 03:11AM |
Registered: 12 years ago Posts: 2,705 |
Re: Repetier with i2c LCD - Not initing October 13, 2012 05:04AM |
Registered: 11 years ago Posts: 121 |
Re: Repetier with i2c LCD - Not initing October 13, 2012 05:26AM |
Registered: 12 years ago Posts: 2,705 |
Re: Repetier with i2c LCD - Not initing October 13, 2012 05:51AM |
Registered: 11 years ago Posts: 121 |
Re: Repetier with i2c LCD - Not initing November 26, 2012 05:45AM |
Registered: 12 years ago Posts: 290 |
Re: Repetier with i2c LCD - Not initing December 23, 2012 02:00PM |
Registered: 11 years ago Posts: 121 |
/* ** Example Arduino sketch for SainSmart I2C LCD2004 adapter for HD44780 LCD screens ** Readily found on eBay or [www.sainsmart.com] ** The LCD2004 module appears to be identical to one marketed by YwRobot ** ** Address pins 0,1 & 2 are all permenantly tied high so the address is fixed at 0x27 ** ** Written for and tested with Arduino 1.0 ** This example uses F Malpartida's NewLiquidCrystal library. Obtain from: ** [bitbucket.org] ** ** Edward Comer ** LICENSE: GNU General Public License, version 3 (GPL-3.0) ** ** NOTE: TEsted on Arduino NANO whose I2C pins are A4==SDA, A5==SCL */ #include #include #include #define I2C_ADDR 0x38 // Define I2C Address where the PCF8574A is #define En_pin 6 #define Rw_pin 0 #define Rs_pin 7 #define D4_pin 4 #define D5_pin 3 #define D6_pin 2 #define D7_pin 1 int n = 1; LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin); void setup() { lcd.begin(20,4); // Switch on the backlight lcd.home(); // go home lcd.print("I2C tester"); lcd.setCursor ( 0, 1 ); // go to the 2nd line lcd.print("F Malpartida library"); lcd.setCursor ( 0, 2 ); // go to the third line lcd.print("Test By OpenHardware"); lcd.setCursor ( 0, 3 ); // go to the fourth line lcd.print(".co.za ");} void loop() { // Backlight on/off every 3 seconds lcd.setCursor(14,3); // go col 14 of line 3 lcd.print(n++,DEC); }-
#define UI_DISPLAY_TYPE 3 // This is line 2 of the status display at startup #define UI_VERSION_STRING2 "Orig. Mendel" /** Number of columns per row Typical values are 16 and 20 */ #define UI_COLS 20 /** Rows of your display. 2 or 4 */ #define UI_ROWS 4 /* What type of chip is used for I2C communication 0 : PCF8574 or PCF8574A or compatible chips. 1 : MCP23017 */ #define UI_DISPLAY_I2C_CHIPTYPE 0 // 0x40 till 0x4e for PCF8574, 0x40 for the adafruid RGB shield, 0x40 - 0x4e for MCP23017 #define UI_DISPLAY_I2C_ADDRESS 0x70 // For MCP 23017 define which pins should be output #define UI_DISPLAY_I2C_OUTPUT_PINS 65504 // Set the output mask that is or'd over the output data. This is needed to activate // a backlight switched over the I2C. // The adafruit RGB shields enables a light if the bit is not set. Bits 6-8 are used for backlight. #define UI_DISPLAY_I2C_OUTPUT_START_MASK 0 // For MCP which inputs are with pullup. 31 = pins 0-4 for adafruid rgb shield buttons #define UI_DISPLAY_I2C_PULLUP 0 /* How fast should the I2C clock go. The PCF8574 work only with the lowest setting 100000. A MCP23017 can run also with 400000 Hz */ #define UI_I2C_CLOCKSPEED 100000L /** Define the pin */ #if UI_DISPLAY_TYPE==3 // I2C Pin configuration #define COMPILE_I2C_DRIVER #define UI_DISPLAY_RS_PIN _BV(5) #define UI_DISPLAY_RW_PIN _BV(6) #define UI_DISPLAY_ENABLE_PIN _BV(7) //#define UI_DISPLAY_D0_PIN _BV(5) //#define UI_DISPLAY_D1_PIN _BV(5) //#define UI_DISPLAY_D2_PIN _BV(5) //#define UI_DISPLAY_D3_PIN _BV(5) #define UI_DISPLAY_D4_PIN _BV(3) #define UI_DISPLAY_D5_PIN _BV(2) #define UI_DISPLAY_D6_PIN _BV(1) #define UI_DISPLAY_D7_PIN _BV(0)
Re: Repetier with i2c LCD - Not initing December 23, 2012 02:08PM |
Registered: 12 years ago Posts: 2,705 |
#define En_pin 6 #define Rw_pin 0 #define Rs_pin 7 #define D4_pin 4 #define D5_pin 3 #define D6_pin 2 #define D7_pin 1
#define UI_DISPLAY_RS_PIN _BV(5) #define UI_DISPLAY_RW_PIN _BV(6) #define UI_DISPLAY_ENABLE_PIN _BV(7) #define UI_DISPLAY_D4_PIN _BV(3) #define UI_DISPLAY_D5_PIN _BV(2) #define UI_DISPLAY_D6_PIN _BV(1) #define UI_DISPLAY_D7_PIN _BV(0)
#define UI_DISPLAY_RS_PIN _BV(7) #define UI_DISPLAY_RW_PIN _BV(0) #define UI_DISPLAY_ENABLE_PIN _BV(6) #define UI_DISPLAY_D4_PIN _BV(4) #define UI_DISPLAY_D5_PIN _BV(3) #define UI_DISPLAY_D6_PIN _BV(2) #define UI_DISPLAY_D7_PIN _BV(1)
Re: Repetier with i2c LCD - Not initing December 23, 2012 02:19PM |
Registered: 11 years ago Posts: 121 |
Re: Repetier with i2c LCD - Not initing December 23, 2012 02:26PM |
Registered: 11 years ago Posts: 121 |
Re: Repetier with i2c LCD - Not initing December 24, 2012 04:10AM |
Registered: 12 years ago Posts: 2,705 |
// wait until transmission completed while(!(TWCR & (1< // Uncomment this if you are using liquid crystal library #endifin Repetier.pde
#if UI_DISPLAY_TYPE==4 // Use LiquidCrystal library instead #include LiquidCrystal lcd(UI_DISPLAY_RS_PIN, UI_DISPLAY_RW_PIN,UI_DISPLAY_ENABLE_PIN,UI_DISPLAY_D4_PIN,UI_DISPLAY_D5_PIN,UI_DISPLAY_D6_PIN,UI_DISPLAY_D7_PIN);
Re: Repetier with i2c LCD - Not initing December 27, 2012 12:28PM |
Registered: 11 years ago Posts: 121 |
Re: Repetier with i2c LCD - Not initing January 17, 2013 08:38AM |
Registered: 11 years ago Posts: 121 |
/* ** Example Arduino sketch for SainSmart I2C LCD2004 adapter for HD44780 LCD screens ** Readily found on eBay or [www.sainsmart.com] ** The LCD2004 module appears to be identical to one marketed by YwRobot ** ** Address pins 0,1 & 2 are all permenantly tied high so the address is fixed at 0x27 ** ** Written for and tested with Arduino 1.0 ** This example uses F Malpartida's NewLiquidCrystal library. Obtain from: ** [bitbucket.org] ** ** Edward Comer ** LICENSE: GNU General Public License, version 3 (GPL-3.0) ** ** NOTE: TEsted on Arduino NANO whose I2C pins are A4==SDA, A5==SCL */ #include #include #include #define I2C_ADDR 0x38 // Define I2C Address where the PCF8574A is #define En_pin 6 #define Rw_pin 5 #define Rs_pin 4 #define D4_pin 3 #define D5_pin 2 #define D6_pin 1 #define D7_pin 0 int n = 1; LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin); void setup() { pinMode(13, OUTPUT); lcd.begin(20,4); // Switch on the backlight lcd.home(); // go home lcd.print("I2C tester"); lcd.setCursor ( 0, 1 ); // go to the 2nd line lcd.print("F Malpartida library"); lcd.setCursor ( 0, 2 ); // go to the third line lcd.print("Test By OpenHardware"); lcd.setCursor ( 0, 3 ); // go to the fourth line lcd.print(".co.za ");} void loop() { // Backlight on/off every 3 seconds lcd.setCursor(14,3); // go col 14 of line 3 lcd.print(n++,DEC); digitalWrite(13, HIGH); delay(100); digitalWrite(13, LOW); delay(100); }
*/ #define UI_DISPLAY_I2C_CHIPTYPE 0 // 0x40 till 0x4e for PCF8574, 0x40 for the adafruid RGB shield, 0x40 - 0x4e for MCP23017 // Official addresses have a value twice as high! #define UI_DISPLAY_I2C_ADDRESS 0x70 // For MCP 23017 define which pins should be output #define UI_DISPLAY_I2C_OUTPUT_PINS 65504 // Set the output mask that is or'd over the output data. This is needed to activate // a backlight switched over the I2C. // The adafruit RGB shields enables a light if the bit is not set. Bits 6-8 are used for backlight. #define UI_DISPLAY_I2C_OUTPUT_START_MASK 0 // For MCP which inputs are with pullup. 31 = pins 0-4 for adafruid rgb shield buttons #define UI_DISPLAY_I2C_PULLUP 0 /* How fast should the I2C clock go. The PCF8574 work only with the lowest setting 100000. A MCP23017 can run also with 400000 Hz */ #define UI_I2C_CLOCKSPEED 100000L /** Define the pin */ #if UI_DISPLAY_TYPE==3 // I2C Pin configuration #define UI_DISPLAY_RS_PIN _BV(4) #define UI_DISPLAY_RW_PIN _BV(5) #define UI_DISPLAY_ENABLE_PIN _BV(6) #define UI_DISPLAY_D0_PIN _BV(7) #define UI_DISPLAY_D1_PIN _BV(7) #define UI_DISPLAY_D2_PIN _BV(7) #define UI_DISPLAY_D3_PIN _BV(7) #define UI_DISPLAY_D4_PIN _BV(3) #define UI_DISPLAY_D5_PIN _BV(2) #define UI_DISPLAY_D6_PIN _BV(1) #define UI_DISPLAY_D7_PIN _BV(0)
Re: Repetier with i2c LCD - Not initing January 17, 2013 10:13AM |
Registered: 11 years ago Posts: 13 |
Re: Repetier with i2c LCD - Not initing January 17, 2013 10:19AM |
Registered: 11 years ago Posts: 121 |
Re: Repetier with i2c LCD - Not initing January 17, 2013 10:33AM |
Registered: 11 years ago Posts: 13 |
Re: Repetier with i2c LCD - Not initing January 17, 2013 11:01AM |
Registered: 12 years ago Posts: 2,705 |
Re: Repetier with i2c LCD - Not initing January 17, 2013 11:04AM |
Registered: 11 years ago Posts: 121 |
Re: Repetier with i2c LCD - Not initing January 17, 2013 12:02PM |
Registered: 12 years ago Posts: 2,705 |
#include LiquidCrystal lcd(UI_DISPLAY_RS_PIN, UI_DISPLAY_RW_PIN,UI_DISPLAY_ENABLE_PIN,UI_DISPLAY_D4_PIN,UI_DISPLAY_D5_PIN,UI_DISPLAY_D6_PIN,UI_DISPLAY_D7_PIN);
#if UI_DISPLAY_TYPE==4 //#include // Uncomment this if you are using liquid crystal library #endif
Re: Repetier with i2c LCD - Not initing January 17, 2013 12:23PM |
Registered: 11 years ago Posts: 121 |
Re: Repetier with i2c LCD - Not initing January 17, 2013 12:30PM |
Registered: 11 years ago Posts: 121 |
Re: Repetier with i2c LCD - Not initing January 17, 2013 01:08PM |
Registered: 12 years ago Posts: 2,705 |
Re: Repetier with i2c LCD - Not initing January 17, 2013 01:14PM |
Registered: 11 years ago Posts: 121 |
Re: Repetier with i2c LCD - Not initing January 17, 2013 01:27PM |
Registered: 12 years ago Posts: 2,705 |
Re: Repetier with i2c LCD - Not initing January 17, 2013 01:33PM |
Registered: 11 years ago Posts: 121 |
Re: Repetier with i2c LCD - Not initing January 18, 2013 03:25AM |
Registered: 12 years ago Posts: 290 |
Re: Repetier with i2c LCD - Not initing January 18, 2013 08:50AM |
Registered: 11 years ago Posts: 121 |
Re: Repetier with i2c LCD - Not initing January 18, 2013 10:34AM |
Registered: 11 years ago Posts: 121 |
//#define COMPAT_PRE1
Re: Repetier with i2c LCD - Not initing January 18, 2013 01:01PM |
Registered: 11 years ago Posts: 121 |