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

2012-05-21

Nova IDE Pinguino 3.X!

Novos recusos como autocomplementação, lista de funções, includes, arquivos, debug serial, ...

Suporte Mac OS X para placas com PIC32, e muito mais! ;-)

Para testar a versão X.3 da IDE uso o seguinte comandos:


Instalação:
svn checkout http://pinguino32.googlecode.com/svn/branches/x.3/ pinguino32-x.3

Atualização:
cd pinguino32-x.3
svn update

Imagens:



2011-09-12

Pinguino32X versão svn x.2

A nova versão da IDE Pinguino para PIC32 e PIC18, já está disponível, neste final de semana atualizei a biblioteca ITDB02 para o PIC32, a versão x.2 é uma grande revisão do projeto PIC32 inicial, bem como têm muitas atualizações para PIC18.

- Suporta um número maior de placas PIC18 e PIC32
- Compilador open source para PIC32 com otimizações, que são pagas na plataforma C32 da Microchip (-O2 e outras)
- Devido a essas otimizações o display ITDB02 não estava se garantindo com a nova velocidade, patch

Para instalar a partir do svn use o comando:
svn checkout http://pinguino32.googlecode.com/svn/trunk/ pinguino32-read-only

2011-05-26

Android and Motorola ATRIX, Pinguino 8 bits say Hello!

I made a small test with Android, USB OTG cable, a modded USB hub and Pinguino 8bits board.

It uses a small .pde sample:


#define PIC18F4550

int counter = 0;
void setup(){
    Serial.begin(9600);
    Serial.print("Hello Android!");
}

void loop(){
char str[50];
char numstr[10];

str[0]=0;
delay(500);

strcat(str,"From Pinguino: Hello Android: c=");

counter++;
uitoa(counter,numstr,10);
strcat(str, numstr);
strcat(str,"\r\n");

CDC.print(str,strlen(str));

if(counter>10000)
 counter = 0;

}


The Pinguino 8bits board:


Atrix detects Pinguino and loads CDC driver, that phone already have CDC driver... I think it is because Google wants use ADK project too, but yes We did it before! :P


Now I want to see that working...

Man! this works! nice not? 




2011-04-28

MPLAB X IDE



The MPLAB X IDE!
A Microchip acaba de lançar uma nova página para sua nova IDE multiplataforma o MPLAB-X!
http://www.microchip.com/mplabx/

2011-02-18

Pinguino Sonar Z!!!

Esse é o projeto interdisciplinar de 2010 do curso de Engnharia de Computação (IESAM).
Originalmente o projeto utilizava um sensor IR, contudo ainda estou com problemas com este e a placa Pinguino, detalhe curioso é que funciona com uma placa arduino.

Para este projeto portei as bibliotecas stepper e a função pulseIn do Arduino para Pinguino.
Biblioteca stepper para Pinguino
pulsIn será adicionada à proxima versão da Pinguino IDE.
download Pulse.c

Fiz dois modelos de sensor
Sensor IR
OBS: Preciso de mais tempo para arrumar o problema com o PIC/Sensor IR que está ficando em corte...


 Sensor Ultrasom (Precisa da função pulseIn()):

Aqui o programa para Pinguino:
Pinguino IR Radar
Pinguino Sonar

Fiz ainda um programa para PC em C++ e QT4:



Códigos fonte do programa

Apenas por razões históricas o nome do programa é sensorservo, já que iria usar um Servo...

Aqui o circuito com o sensor IR:
Circuito ultrassom sonar:

Artigo aqui:
Artigo_Projeto_Interdisciplinar_2010.pdf

2011-01-25

GLCD 1.6.2 and Pinguino RTC, 128x64 Display and Temperature!


For this project I made a new version of KS0108 GLCD library, this supports now use of PORTD for display data, and we dont need use stdlib.h with it, this free some space for more nice programs.

Use of PORTD for data in/out, is vital because DS1307 real time clock (RTC) uses i2c and it, on PIC18, is placed on PORTB (default data port).

Use of PORTC for display control, this free PORTA for use of Analog PINs, I added it on 1.6.1 version.

GLCD 1.6.2 download here

For Analog Clock I used sin and cos, functions from math.h, but it uses about 6K and my Pinguino project got 100% of flash use, I made many changes on variables types and reuse someones, but need more memory for add pushbuttons for time setup, display date, load small font and do a graphical thermometer.

A idea, do my own version of sine and cosine.

From that I made a  flash array with all 16 float values of sines for seconds and minutes degrees, on first 90º, hours just multiply by 5, for have correct position. And calculate all others degrees using trigonometry.

sincos library, download here

And here GLCD_RTC_LM35_mem.pde file for use with all it.

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-28

Stepper Motors library ported from Arduino to Pinguino


This library was ported from Stepper library from Arduino project,
Same samples works with minimum changes!
http://arduino.cc/en/Reference/Stepper

You need add a 1µF or 10µF capacitor between GND and VCC on pinguino board.
Tested with a PM35-048 stepper and ULN2003a / ULN2803a drivers.

DOWNLOAD


INSTALL
1- Copy Stepper.lib/stepper.c and Stepper.lib/stepper.h to pinguino/tools/share/sdcc/include/pic16/
2- Copy Stepper.lib/stepper.pdl to pinguino/lib

Sample:

/*
 * Based on MotorKnob Stepper Library from Arduino Project
 *
 * A stepper motor follows the turns of a potentiometer
 * (or other sensor) on analog input 0.
 *
 * http://www.arduino.cc/en/Reference/Stepper
 * 
 * Pinguino port by Anunakin 
 * For use this sample on Pinguino boards, 
 * you need add a 10uF or less capacitor 
 * between GND and VCC on pinguino board.
 */
#define PIC18F4550
#define LED 4
#define POT 13
// change this to the number of steps on your motor
// PM35S-048
#define STEPS 48
// specify the number of steps of the motor and the pins it's
// attached to
// the previous reading from the analog input
int previous = 0;
void setup()
{
  stepper(STEPS, 0, 1, 2, 3);
  //stepper(STEPS, 0, 1);
  // set the speed of the motor to 30 RPMs
  stepper.setSpeed(100);
  
  pinMode(POT,INPUT);
  pinMode(LED,OUTPUT);
}
void loop()
{
   // get the sensor value
  int val = analogRead(POT);
  val = (int)(val*1/16);
  
  // move a number of steps equal to the change in the
  // sensor reading
  if (val != previous){    
    stepper.step(val - previous);
  }
    
    digitalWrite(LED,HIGH);
    delay(50 + val);
  //}
  digitalWrite(LED,LOW);
  delay(50);
  
  //remember the previous value of the sensor
  previous = val;
}

GLCD Pinguino library revision 1.6.1

A small patch on PORTA/PORTC switch routine.

GLCD_pinguino_library_v1.6.1.zip

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