how do i assign 0x00 to port P2. P2 = 0x00 ; how do i control the font size for this forum keep getting very big font
#include <mcs51/8051.h> #define port2 = P2 #define rs = P1_0 #define rw = P1_1 #define e = P1_2 // __sbit __at (0x90h)rs; // sbit rs=P1^0; // __sbit __at (0x91h)rw; // sbit rw=P1^1; // __sbit __at (0x92h)en; // sbit en=P1^2; void lcmd ( unsigned char); void lcdat (unsigned char); void delay(); void main(); P2 = 0x00 ; // P2=0x00h; while (1) { lcdcmd (0x38); delay (); lcdcmd (0x01); delay (); lcdcmd (0x10); delay (); lcdcmd (0x0c); delay (); lcddat ('W'); delay (); lcddat ('A'); delay (); lcddat ('J'); delay (); } } void lcdcmd (unsigned char val) { P2=val; rs=0; rw=0; en=1; delay (); en=0; } void lcddat (unsigned char val) { P2=val; rs=1; rw=0; en=1; delay (); en=0; } void delay () { unsigned int i; for (i=0;i<1200;i++); }
Regarding the formatting, you might want to read the markdown syntax guide. I took the liberty to edit the post for you.
Your #define syntax looks wrong. You have to write #define new_name old_name.
#define
#define new_name old_name
Log in to post a comment.
how do i assign 0x00 to port P2. P2 = 0x00 ; how do i control the font size for this forum keep getting very big font
Last edit: Benedikt Freisen 2020-08-30
Regarding the formatting, you might want to read the markdown syntax guide. I took the liberty to edit the post for you.
Your
#definesyntax looks wrong. You have to write#define new_name old_name.