Loading...
  Show Posts
Pages: [1]
1  International / Español / Re: Como manejar la memoria flash en Arduino Due on: January 09, 2013, 03:52:05 am
En el siguiente post http://arduino.cc/forum/index.php/topic,135341.msg1021643.html#msg1021643 tengo puesto todo el código modificado que escribe en los puertos.

Esper oque te sirva.

Un saludo
2  Products / Arduino Due / Re: Arduino.h and wiring_digital.c problem. on: December 07, 2012, 04:25:11 am
Currently it takes 352 milliseconds to clean the screen.

It is an acceptable time.
3  Products / Arduino Due / Re: TFT library compatible with Due? on: December 05, 2012, 06:42:35 pm
Hello.
I adapted the library for Arduino DUE. I also added a method to paint buttons, I added some new parameters to several methods, and have optimized several loops gaining some speed.
I've only tested on a 480x272 screen with SSD1963.
I have not tried the method LCD_Writ_Bus to 8 bits.

I was sent to the developer UTFT, but if you want to have before, you can download from the following link http://www.piensayactua.com/tmp/UTFT.rar

greetings
4  Products / Arduino Due / Re: Arduino.h and wiring_digital.c problem. on: December 05, 2012, 10:19:03 am
In the first define, change UTFT.c by this

Code:
#if defined(__AVR__)
#include <avr/pgmspace.h>
#include "HW_AVR.h"
#elif defined(__SAM3X8E__)
#include "Arduino.h"
#include "HW_SAM.h"
#else
#include "HW_PIC32.h"
#endif

In the define __AVR__ of file UTFT.h change by this

Code:
#if defined(__AVR__)
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include "HW_AVR_defines.h"
#elif defined(__SAM3X8E__)
#include "Arduino.h"
#include "HW_SAM_defines.h"
#else
#include "WProgram.h"
#include "HW_PIC32_defines.h"
#endif

copy HW_AVR_defines.h to HW_SAM_defines.h
copy HW_AVR.h to HW_SAM.h
Changes HW_SAM_defines.h by this

Code:
#define cbi(reg, bitmask) *reg &= ~bitmask
#define sbi(reg, bitmask) *reg |= bitmask
#define pulse_high(reg, bitmask) sbi(reg, bitmask); cbi(reg, bitmask);
#define pulse_low(reg, bitmask) cbi(reg, bitmask); sbi(reg, bitmask);

#define pgm_read_word(data) *data
#define pgm_read_byte(data) *data

#define cport(port, data) port &= data
#define sport(port, data) port |= data

#define swap(type, i, j) {type t = i; i = j; j = t;}

#define fontbyte(x) cfont.font[x] 

#define regtype volatile uint32_t
#define regsize uint32_t
#define bitmapdatatype unsigned uint16_t

Changes HW_SAM.h by this

Code:
// *** Hardwarespecific functions ***
void UTFT::LCD_Writ_Bus(char VH,char VL, byte mode)
{   
switch (mode)
{
case 1:
if (display_serial_mode==SERIAL_4PIN)
{
if (VH==1)
sbi(P_SDA, B_SDA);
else
cbi(P_SDA, B_SDA);
pulse_low(P_SCL, B_SCL);
}
else
{
if (VH==1)
sbi(P_RS, B_RS);
else
cbi(P_RS, B_RS);
}

if (VL & 0x80)
sbi(P_SDA, B_SDA);
else
cbi(P_SDA, B_SDA);
pulse_low(P_SCL, B_SCL);
if (VL & 0x40)
sbi(P_SDA, B_SDA);
else
cbi(P_SDA, B_SDA);
pulse_low(P_SCL, B_SCL);
if (VL & 0x20)
sbi(P_SDA, B_SDA);
else
cbi(P_SDA, B_SDA);
pulse_low(P_SCL, B_SCL);
if (VL & 0x10)
sbi(P_SDA, B_SDA);
else
cbi(P_SDA, B_SDA);
pulse_low(P_SCL, B_SCL);
if (VL & 0x08)
sbi(P_SDA, B_SDA);
else
cbi(P_SDA, B_SDA);
pulse_low(P_SCL, B_SCL);
if (VL & 0x04)
sbi(P_SDA, B_SDA);
else
cbi(P_SDA, B_SDA);
pulse_low(P_SCL, B_SCL);
if (VL & 0x02)
sbi(P_SDA, B_SDA);
else
cbi(P_SDA, B_SDA);
pulse_low(P_SCL, B_SCL);
if (VL & 0x01)
sbi(P_SDA, B_SDA);
else
cbi(P_SDA, B_SDA);
pulse_low(P_SCL, B_SCL);
break;
case 8:
// NOT IMPLEMENTED
break;
case 16:
//Clear port registers
REG_PIOA_CODR=0xc080; //PA7,PA14,PA15
REG_PIOB_CODR=0x4000000; //PB26
REG_PIOC_CODR=0x3e; //PC1 - PC5
REG_PIOD_CODR=0x64f; //PD0-3,PD6,PD9-10
               
//DB00 on PIN37 -> PIO_PC5
REG_PIOC_SODR=(VL<<5) & 0x20;
//DB01 on PIN36 -> PIO_PC4
REG_PIOC_SODR=(VL<<3) & 0x10;
//DB02 on PIN35 -> PIO_PC3
REG_PIOC_SODR=(VL<<1) & 0x08;
//DB03 on PIN34 -> PIO_PC2
REG_PIOC_SODR=(VL>>1) & 0x04;
//DB04 on PIN33 -> PIO_PC1
REG_PIOC_SODR=(VL>>3) & 0x02;
//DB05 on PIN32 -> PIO_PD10
REG_PIOD_SODR=(VL<<5) & 0x400;
//DB06 on PIN31 -> PIO_PA7
REG_PIOA_SODR=(VL<<1) & 0x80;
//DB07 on PIN30 -> PIO_PD9
REG_PIOD_SODR=(VL<<2) & 0x200;
//DB08 on PIN22 -> PIO_PB26
REG_PIOB_SODR=(VH<<26) & 0x4000000;
//DB09 on PIN23 -> PIO_PA14
REG_PIOA_SODR=(VH<<13) & 0x4000;
//DB10 on PIN24 -> PIO_PA15
REG_PIOA_SODR=(VH<<13) & 0x8000;
//DB11 on PIN25 -> PIO_PD0
REG_PIOD_SODR=(VH>>3) & 0x01;
//DB12 on PIN26 -> PIO_PD1
REG_PIOD_SODR=(VH>>3) & 0x02;
//DB13 on PIN27 -> PIO_PD2
REG_PIOD_SODR=(VH>>3) & 0x04;
//DB14 on PIN28 -> PIO_PD3
REG_PIOD_SODR=(VH>>3) & 0x08;
//DB15 on PIN29 -> PIO_PD6
REG_PIOD_SODR=(VH>>1) & 0x40;

pulse_low(P_WR, B_WR);
break;
}
}

void UTFT::_set_direction_registers(byte mode)
{
if (mode==16)
{
REG_PIOA_OER=0xc080; //PA7,PA14,PA15 enable
REG_PIOB_OER=0x4000000; //PB26 enable
REG_PIOC_OER=0x3e; //PC1 - PC5 enable
REG_PIOD_OER=0x64f; //PD0-3,PD6,PD9-10 enable
}
}

If it works, let me know and I use it, I have not tried.

If winds are going to send him UTFT developer to implement it.

regards

5  Products / Arduino Due / Re: Arduino.h and wiring_digital.c problem. on: November 29, 2012, 04:36:12 am
Thank you very much for your answer
6  Products / Arduino Due / Re: Arduino.h and wiring_digital.c problem. on: November 28, 2012, 05:00:20 pm
After doing some tests, I see that it works by putting the code which says cmaglie.
Quote
  REG_PIOA_OWER = 0xFFFFFFFF;
  REG_PIOB_OWER = 0xFFFFFFFF;
  REG_PIOC_OWER = 0xFFFFFFFF;

then hit the code.

Code:
#define sbi(reg, mask) *reg |= mask
#define cbi(reg, mask) *reg &= ~mask

int led = 13;
volatile uint32_t * Registro;
uint32_t Mascara;

// the setup routine runs once when you press reset:
void setup() {               
  REG_PIOA_OWER = 0xFFFFFFFF;
  REG_PIOB_OWER = 0xFFFFFFFF;
  REG_PIOC_OWER = 0xFFFFFFFF;
  Registro = portOutputRegister(digitalPinToPort(led));
  Mascara = digitalPinToBitMask(led);
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);   
 
 
}

// the loop routine runs over and over again forever:
void loop() {
  sbi(Registro,Mascara);
  delay(1000);               // wait for a second
  cbi(Registro,Mascara);
  delay(1000);               // wait for a second
}

7  Products / Arduino Due / Re: Arduino.h and wiring_digital.c problem. on: November 28, 2012, 09:44:07 am
Hello alvesjc

Can you put the sample code you already it works.
I refer to the set of sbi, cbi.

It would be far better that you put the modified UTFT to download.

I have cast a write methods for UTFT ports that I have not been able to apply, but I set the display directly and go very fast, I would like to adapt the library and send it to the developer to UTFT but I'm missing that part.

Thanks
8  International / Español / Como manejar la memoria flash en Arduino Due on: November 17, 2012, 10:21:15 am
Hola.

Me he comprado el arduino due y ya tengo los primeros problemas.

Estoy adaptando la librería UTFT para poder manejar mi display en el nuevo arduino y no se cuales son las funciones equivalentes a la librería PROGMEM, por ejemplo pgm_read_byte().

También me he encontrado problemas para escribir directamente en los puertos pero ya lo he solucionado, pondre otro pos explicando como se hace para lso que le interesen

Gracias
9  Products / Arduino Due / How I can read and write data to flash memory? on: November 17, 2012, 09:00:12 am
Hello.
How I can read and write data to flash memory?
Pages: [1]