Quantcast
Channel: MSP430 Technical Forums
Viewing all articles
Browse latest Browse all 2077

LCD library in Assembly

$
0
0

Hello everyone. I'm a beginner at forum and I don't know if I can post this here. Sorry if im wrong =/

 

So... I'm writing a simple program that sends hours,minutes and seconds to lcd. I know... im very newbie...

Im using a 16x2 LCD 4 bits mode.

I have this c code and I want to send upper and lower nibble like that.

I've just made a search over the forum and only found this in c code.

Anyone have idea how to do this work?

My biggest doubt is how to write that part in assembly:  P2OUT |= ((Data >> 4) & 0x0F);

Thanks.

Beco08

 

 

void lcdcmd(unsigned char Data)
{
 
P2OUT &= ~RS; //because sending command //BIC.B #0X40,P2OUT
P2OUT  &=~EN;                                                //BIC.B #0x10,P2OUT
 
P2OUT &= 0xF0;                                              //BIC.B #0x0F,P2OUT
P2OUT |= ((Data >> 4) & 0x0F);
P2OUT  |=EN;
waitlcd(2);
P2OUT  &=~EN;
 
P2OUT &= 0xF0;
P2OUT  |= (Data & 0x0F);
P2OUT  |=EN;
waitlcd(2);
P2OUT  &=~EN;

}


Viewing all articles
Browse latest Browse all 2077

Trending Articles