Mostrando postagens com marcador i2c. Mostrar todas as postagens
Mostrando postagens com marcador i2c. Mostrar todas as postagens

2011-01-19

Pinguino RTC with a LCD 16x2

A new sample using RTC DS1307 and a LCD Display 16x2 ...



Get source code here!


ATENTION: To setup date look at line 62!

2011-01-17

Pinguino Real Time Clock - Again!

 Pinguino BreadBoarded!
Esquemático (LusoRobótica, port)

Eis mais um exemplo do uso do integrado DS1307, um CI para Real Time Clock RTC, este projeto fiz com base em outros dois projetos:
Real Time Clock DS1307 (RTC) + Arduino, escrito pelo Tr3s do LusoRobótica

Prueba de Pinguino y Reloj externo ds1307, escrito pelo Sergio Alvarez

E agradeço também ao Roger Coscia, pela generosa contribuição de dois integrados DS1307!

Acrescentei suporte USB CDC, ao projeto do Sergio Alvarez, e fiz algumas alterações baseando-me no trabalho do Tr3s.

No Linux podemos acessar a porta CDC com o minicom ou cutecom, ou qualquer outro programa de terminal serial:

bash$    minicom -D /dev/ttyACM0 -b 9600

Exemplo da saída dos dados, via USB:
Welcome to minicom 2.4

OPÇÕES: I18n
Compilado em Jun  3 2010, 13:46:31.
Port /dev/ttyACM0

Pressione CTRL-A Z para ajuda sobre teclas especiais


segunda,17 de janeiro de 2011 11:42:28
segunda,17 de janeiro de 2011 11:42:29
segunda,17 de janeiro de 2011 11:42:30
segunda,17 de janeiro de 2011 11:42:31
segunda,17 de janeiro de 2011 11:42:32
segunda,17 de janeiro de 2011 11:42:33
Download dos fontes aqui

ATENÇÃO: Para ajustar a hora, olhem na linha 59 !

2010-12-16

Pinguino i2c OLED Display




Thanks for help of JPMandon, we have OLED Display working
with libi2c on pinguino Board!

Pinguino full sourcecode here:
OLED.zip
//Program for I2C communication with a 128x64 OLED Display (http://www.seeedstudio.com)
//Marcus Fazzi 2010
#define LED 13
#define I2C_address 0x3c    //i2c address of Display
#include <libI2C.c>
//For working with strings strlen() function
// #include <string.h>
#include "data.c"
unsigned char fill_OLED = 0x55;
unsigned char fill_string1[13]="Pinguino OLED";
unsigned char fill_string2[11]="OLED 128x64";
unsigned char fill_string3[16]="0123456789ABCDEF";
unsigned char fill_string4[2]="SS";
//=======================
void sendcommand(unsigned char com)
{   
  short dt[2] =  { 0x80, com }; //command mode
  I2C_write(I2C_address, dt, 2);
  I2C_STOP(); //stop transmitting
}
//===================================
void SendChar(unsigned char dat)
{
  short dt[2] =  { 0x40, dat }; //data mode
  I2C_write(I2C_address, dt, 2);
  I2C_STOP();    //stop transmitting
}
//===================================
void setXY(unsigned char row,unsigned char col)
{
  sendcommand(0xb0 + row); //set page address
  sendcommand(0x00 + (8 * col & 0x0f)); //set low col address
  sendcommand(0x10 + ((8 * col >> 4) & 0x0f)); //set high col address
}
//==================================
void clear_display()
{
  unsigned char i,k;
  for(k=0;k<8;k++)
  {     
    setXY(k,0);    
    {
      for(i=0;i<128;i++) //clear all COL
      {
        SendChar(0);
      }
    }
  }
}
//==================================
void printChar(unsigned char ascii)
{
  unsigned char i;
  for(i=0;i<8;i++)
  {
    SendChar(myFont[ascii-0x20][i]);
  }
}
//==================================
void sendStr(unsigned char *string, unsigned char len)
{
  unsigned char i, j;
  //setXY(0,0);    
  for(i=0;i<len;i++)
  {
    for(j=0;j<8;j++)
    {
      SendChar(myFont[*string-0x20][j]);
                //SendChar(*string);
      delay(10);
    }
    *string++;
  }
}
//=================================
void init_OLED(void)
{
  sendcommand(0xae);            //display off
  delay(50); 
//  sendcommand(0xa0);          //seg re-map 0->127(default)
//  sendcommand(0xa1);          //seg re-map 127->0
//  sendcommand(0xc8);
//        delay(1000);
  sendcommand(0xaf);            //display on
  delay(50);
}
void setup()
{
   delay(500);
   init_I2C();
        //SSPADD=19;  //Slow mode
        
   init_OLED();
        delay(10);
        clear_display();
   delay(50);
   
   pinMode(LED, OUTPUT);  
   
}
//========================
void loop()
{
  short i;
  
  clear_display();
  delay(50);
  sendcommand(0x20);          //Set Memory Addressing Mode
  sendcommand(0x02);          //Set Memory Addressing Mode ab Page addressing mode(RESET)  
 
  sendcommand(0xa6);                    //Set Normal Display (default)
  setXY(3,2);
  sendStr(fill_string1, 13);
  setXY(4,3);
  sendStr(fill_string2, 11);
  
  delay(2000);
  sendcommand(0xa7);                    //Set Inverse Display  
  delay(2000);
  clear_display();
  delay(50);  
  setXY(0,0);
  sendcommand(0xa6);                    //Set Normal Display
  sendcommand(0xae);                            //display off
  sendcommand(0x20);                    //Set Memory Addressing Mode
  sendcommand(0x00);                    //Set Memory Addressing Mode ab Horizontal addressing mode
  
  for(i=0;i<128*8;i++)                  //write a 128x64 picture
  {
    SendChar(logo[i]);
  }
  
  sendcommand(0xaf);                            //display on
  delay(2000);
  sendcommand(0xa7);                    //Set Inverse Display
  delay(2000);  
 /*
  while(1)
  {
    //sendcommand(0xa6);  Set Normal Display
    sendcommand(0x29);  //Vertical and Horizontal Scroll Setup
    sendcommand(0x00);  //dummy byte
    sendcommand(0x00);  //define page0 as startpage address
    sendcommand(0x00);  //set time interval between each scroll ste as 6 frames
    sendcommand(0x07);  //define page7 as endpage address
    sendcommand(0x01);  //set vertical scrolling offset as 1 row
    sendcommand(0x2f);  //active scrolling
    delay(3000);
  };
  */
}

You can see datasheet, arduino sample, and buy one at:
http://www.seeedstudio.com/depot