LCD issue

Status
Not open for further replies.

AtomSoft

Well-Known Member
Ok im porting some ARM code from one ARM to another ....

The issue lies in the PINOUT. I have a 16bit value i need to place on 3 different ports. For example the INT 0x1234 needs to be split into 3 parts...

INT A = 1
INT B = 2 & 3
INT C = 4

To do this im am trying the below code"
Code:
void SetLcdInt(int data)
{
    int DAT_A = (data & 0x000F);
    int DAT_B = ((data>>4) & 0x00FF);
    int DAT_C = ((data>>12) & 0x000F);

    GPIOC->ODR &= ~(0x3C0);
    GPIOD->ODR &= ~(0xFF);
    GPIOE->ODR &= ~(0x0F);

    GPIOC->ODR |= (DAT_A<<6);
    GPIOD->ODR |= (DAT_B);
    GPIOE->ODR |= (DAT_C);
}

Ok GPIOC is the first PORT i need the data in... from bits 6:9
SO....

GPIOC [6:9] = BITS 0:3 of INT (since starts at bit 6 i shift it over after i get the bits)
GPIOD [0:7] = BITS 4:11 of INT
GPIOC [0:3] = BITS 12:15 of INT

Am i wrong? Its not working
 
Shouldn't this:

int DAT_A = (data & 0x000F);
int DAT_B = ((data>>4) & 0x00FF);
int DAT_C = ((data>>12) & 0x000F);


Be

int DAT_C = (data & 0x000F);
int DAT_B = ((data>>4) & 0x00FF);
int DAT_A = ((data>>12) & 0x000F);

Based on your example?

The ARM appears to be bi-endian, a term I hadn't heard before. It can be either big or little endian. Yipes!
 
I can debug the MCU and it seems to be setting the correct bits the way i have it. The only issue is the LCD isnt really responding and not even showing any color. I have 2 lcd and both dont work. The thing is i did not store the lcds well ... just in a draw and they could have got damaged. I need to wire up a PIC or NXP arm since thats what i had it working with before. If it works then i know its my STM32 code
 
hah , this sucks. It doesnt work on my LPC2103 with original code either. So that means i have 2 DEAD Lcds.. $40 gone I guess this should teach me to store things better oh well. nothing i can do.. .At lease i gain 2 touch screens heh.. im sure they have to be good still
 
Seems to me you need some anti static mats!! Nylon carpets and trainers are not electronic engineers best friends
 
The thing is i dont have carpets. But i assume i build some static from couch and chairs. Ill look into that. But i assume its the darn ribbon cables for now
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…