Hi all!
I have a query, i want to consult from your comment !
I have a program to make LCD display this "VIET ELECTRONIC" My code as follow:
#include "MSP430F1121.h" void write_instruction(void) { P2DIR|=0xFF; P2OUT|=BIT2; P2OUT &=~ BIT0; P2OUT &=~ BIT1; P2OUT &=~ BIT2; } void write(char chr){ P2DIR =0xFF; P2OUT |= BIT0; //sbi(CTRL,RS); //this is a normal DATA P1DIR = 0xFF; P1OUT = chr; //out 8 bits to DATA Line P2DIR = 0xFF; P2OUT |= BIT2; P2DIR =0xFF; P2OUT &=~BIT2;//Write8Bit(chr); //wait_LCD(); }
void Data(char* str) { unsigned char i; for (i=0; str[i]!=0; i++) write(str[i]); } int main( void ) { // Stop watchdog timer to prevent time out reset WDTCTL = WDTPW + WDTHOLD; P1DIR=0xFF; P1OUT=0x38; write_instruction(); P1DIR=0xFF; P1OUT=0x0C; write_instruction(); P1DIR=0xFF; P1OUT=0x01; write_instruction(); P1DIR=0xFF; P1OUT=0x80; // the first instruction write_instruction(); Data("VIET"); P1DIR=0xFF; P1OUT=0xC0; // the second instruction write_instruction(); Data("ELECTRONIC");
return 0; }
And in my code, have 2 instruction : CODE: SELECT ALL ...... P1OUT=0x80; // the first instruction ...... P1OUT=0xC0; // the second intruction ......
Can you explain to me that: What do two instruction above mean? What are 2 instruction above used for?
Thank all! Looking for to seeing your comment soon!