AnsweredAssumed Answered

KL25Z PORTC manipulation

Question asked by Tomas Mickus on Apr 18, 2014
Latest reply on Apr 21, 2014 by Kan_Li

I bit banged PORTs on FRDM-KL25Z using FGPIO and GPIO commands.

Frequency measured on pins with GPIOC_PDOR = 4MHz, with FGPIO = 6MHz. ( MCU core 24MHZ, peripheral 24MHz)

Nice. I found that PORTC have 16 pins, so i can use entire 16 pins at once, at 6MHz, that very usefull for LCD TFT 16 bit data application !!!

BUT. PORTC sequence is not in series, PTB[0~13,16,17], so every time i push binary RGB565 color code in port i need to do:

#define LCD_color(a) FGPIOC_PDOR = ((a & 0xC000)<<2) | (a & 0x3FFF) (equation 1 )

AND. Frequency dropped from 6MHz to 4MHz (due to math operation for shifting i think). When LCD has 76800 pixels and i need to redraw it all it means a delay 76800*0.5us=38.4ms.

QUESTION. Is there a more effective way to do shiffting than equation 1.

Outcomes