DUE and a TFT shield ...

Hi guys...

I am new to the DUE board and need some help to understand the PORTs...

i do have this shield ftp://imall.iteadstudio.com/IM120417021_3.2_TFT_LCD_Touch_Shield/DS_IM120417021_3.2_TFT_LCD_Touch_Shield.pdf and thats working fine on my mega together with the UTFT library.

But pinout on MEGA and DUE are not the same, so want to change the library or make my own..

But when checking the DUE ports i can not see other ports that port D which have all the pins from 0 to 7...
Port C missing PC0
Port B do start at PB10
Port A do not have PA5
And none of the ports have from 0 to 15 so i can do use only one port ...

And TFT need 2 ports ..one for ctrl and one for DATA....So how do you guys do that

in the code i want to use is

void Write_Command(unsigned int c)
{
digitalWrite(CS,LOW);
digitalWrite(RS,LOW);
PORTA = c >> 8;
PORTC = c;
digitalWrite(WR,LOW);
digitalWrite(WR,HIGH);
digitalWrite(CS,HIGH);
}

Can any one give me a hint ?

Hjalmar

Search for direct port manipulation on the Due - there have been a number of threads on this

Start by making it work with 16 digialWrite()s. See if it's fast enough for your project. If not, try with direct bit-setting on the port; is that fast enough?

On the DUE, PORTC = c; doesn't make much sense because ints are all 32-bit and you don't usually need to set 32 output pins simultaneously.

HI

I did

//PORTC = c;
tmp_c = c;
if ((tmp_c >> 0) & 0x01){ REG_PIOC_SODR = 0x1 << 5;}else{REG_PIOC_CODR = 0x1 << 5;} // pin 37 = DB0
if ((tmp_c >> 1) & 0x01){ REG_PIOC_SODR = 0x1 << 4;}else{REG_PIOC_CODR = 0x1 << 4;} // pin 36 = DB1
if ((tmp_c >> 2) & 0x01){ REG_PIOC_SODR = 0x1 << 3;}else{REG_PIOC_CODR = 0x1 << 3;} // pin 35 = DB2
if ((tmp_c >> 3) & 0x01){ REG_PIOC_SODR = 0x1 << 2; }else{REG_PIOC_CODR = 0x1 << 2;} // pin 34 = DB3
if ((tmp_c >> 4) & 0x01){ REG_PIOC_SODR = 0x1 << 1; }else{REG_PIOC_CODR = 0x1 << 1;} // pin 33 = DB4
if ((tmp_c >> 5) & 0x01){ REG_PIOD_SODR = 0x1 << 10; }else{REG_PIOD_CODR = 0x1 << 10;} // pin 32 = DB5
if ((tmp_c >> 6) & 0x01){ REG_PIOA_SODR = 0x1 << 7; }else{REG_PIOA_CODR = 0x1 << 7;} // pin 31 = DB6
if ((tmp_c >> 7) & 0x01){ REG_PIOD_SODR = 0x1 << 9; }else{REG_PIOD_CODR = 0x1 << 9;} // pin 30 = DB7

and it was fast enough…if fact VERY fast on a DUE …

Thanks

Hjalmar