![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| Hey, does any of you have a C routine i can start with for displaying some characters on an I2C display (maxtrix orbital 2041) Thanks, K | |
| |
| | (permalink) |
| You can find I2C related routines in this C file. http://www.phanderson.com/PIC/PICC/C.../24_256_1.html You will require following routines from this file. byte i2c_in_byte(void); void i2c_out_byte(byte o_byte); void i2c_nack(void); void i2c_ack(void); void i2c_start(void); void i2c_stop(void); void i2c_high_sda(void); void i2c_low_sda(void); void i2c_high_scl(void); void i2c_low_scl(void); Don't forget to change the I2C port pin definitions. Now that you have all I2C routines, you just need to send command and data to your display driver using them.
__________________ "There is no way to peace, peace is the way!" | |
| |
| | (permalink) |
| Thank, i have this file you mention. Still, the microchip C-compiler has all the commands 'embedded'. I want to start writing with the microchip C-compiler commands. ex. void main (void) { //i2c_start(); //i2c_out_byte(0xa0 | (dev_adr << 1)); //i2c_nack(); //i2c_out_byte((mem_adr >> 8) & 0xff); // high byte of memory address //i2c_nack(); //i2c_out_byte(mem_adr & 0xff); // low byte of mem address //i2c_nack(); //i2c_out_byte(dat); // and finally the data //i2c_nack(); //i2c_stop(); OpenI2C(MASTER, SLEW_ON); StartI2C(); WriteI2C(0xB8); //B8 = display adress NotAckI2C(); WriteI2C(0xFE); // command prefix NotAckI2C(); WriteI2C(0x46); // Turn backlight off NotAckI2C(); StopI2C(); CloseI2C(); } | |
| |
| | (permalink) |
| What problem are you facing?
__________________ "There is no way to peace, peace is the way!" | |
| |
| | (permalink) |
| Well, why is this routine not doing what it should do. address the display, and turn the backlight off. OpenI2C(MASTER, SLEW_ON); StartI2C(); WriteI2C(0xB8); //B8 = display adress NotAckI2C(); WriteI2C(0xFE); // command prefix NotAckI2C(); WriteI2C(0x46); // Turn backlight off NotAckI2C(); StopI2C(); CloseI2C(); | |
| |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |