-
#include <dos.h>
-
#include <string.h>
-
#include <conio.h>
-
#include <time.h>
-
-
#define PORTADDRESS 0x378 /* Enter Your Port Address Here */
-
-
#define DATA PORTADDRESS+0
-
#define STATUS PORTADDRESS+1
-
#define CONTROL PORTADDRESS+2
-
-
void lcd_init(void);
-
void lcd_write(char char2write);
-
void lcd_putch(char char2write);
-
void lcd_puts(char * str2write);
-
void lcd_goto(int row, int column);
-
void lcd_clear(void);
-
void lcd_home(void);
-
void lcd_cursor(int cursor);
-
void lcd_entry_mode(int mode);
-
-
-
void main(void)
-
{
-
lcd_init();
-
lcd_goto(1,1);
-
lcd_puts("Welcome To");
-
lcd_goto(1,0);
-
lcd_puts("electroSofts.com");
-
-
while(!kbhit() ) //wait until a key is pressed...
-
{}
-
-
}
-
-
void lcd_init()
-
{
-
-
outportb(CONTROL, inportb(CONTROL) & 0xDF);
-
//config data pins as output
-
-
outportb(CONTROL, inportb(CONTROL) | 0x08);
-
//RS is made high: control (register select)
-
-
lcd_write(0x0f);
-
delay(20);
-
lcd_write( 0x01);
-
delay(20);
-
lcd_write( 0x38);
-
delay(20);
-
-
}
-
-
void lcd_write(char char2write)
-
{
-
-
outportb(DATA, char2write);
-
outportb(CONTROL,inportb(CONTROL) | 0x01); /* Set Strobe */
-
delay(2);
-
outportb(CONTROL,inportb(CONTROL) & 0xFE); /* Reset Strobe */
-
delay(2);
-
-
}
-
-
void lcd_putch(char char2write)
-
{
-
-
outportb(CONTROL, inportb(CONTROL) & 0xF7);
-
//RS=low: data
-
lcd_write(char2write);
-
-
}
-
-
void lcd_puts(char *str2write)
-
{
-
-
outportb(CONTROL, inportb(CONTROL) & 0xF7);
-
//RS=low: data
-
while(*str2write)
-
lcd_write(*(str2write++));
-
-
}
-
-
void lcd_goto(int row, int column)
-
{
-
-
outportb(CONTROL, inportb(CONTROL) | 0x08);
-
if(row==2) column+=0x40;
-
/* Add these if you are using LCD module with 4 columns
-
if(row==2) column+=0x14;
-
if(row==3) column+=0x54;
-
*/
-
lcd_write(0x80 | column);
-
-
}
-
-
void lcd_clear()
-
{
-
-
outportb(CONTROL, inportb(CONTROL) | 0x08);
-
lcd_write(0x01);
-
-
}
-
-
void lcd_home()
-
{
-
-
outportb(CONTROL, inportb(CONTROL) | 0x08);
-
lcd_write(0x02);
-
-
}
-
-
void lcd_entry_mode(int mode)
-
{
-
-
/*
-
if you dont call this function, entry mode sets to 2 by default.
-
mode: 0 - cursor left shift, no text shift
-
1 - no cursor shift, text right shift
-
2 - cursor right shift, no text shift
-
3 - no cursor shift, text left shift
-
*/
-
outportb(CONTROL, inportb(CONTROL) | 0x08);
-
lcd_write(0x04 + (mode%4));
-
-
}
-
-
void lcd_cursor(int cursor)
-
{
-
-
/*
-
set cursor: 0 - no cursor, no blink
-
1 - only blink, no cursor
-
2 - only cursor, no blink
-
3 - both cursor and blink
-
*/
-
-
-
outportb( CONTROL, inportb(CONTROL) | 0x08 );
-
lcd_write( 0x0c + (cursor%4));
-
-
}
-
-
--------------------------------------------------------------------------------
-
1 1622 horace1 1,510
Recognized Expert Top Contributor
using Turbo C V3.0 this code compiles and links OK
Have not tried to run it!
what is your problem?
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: ^CeFoS^ |
last post by:
Hello to everybody,
I've done an application that draws in a frame the trajectory of a
robot. The robot position is readed through the serial port, and
several commands are wrote through the same port to change the
direction of the robot.
The trajectory frame is managed by an applet, and the project works
good when the applet is called by a html document allocated in the
same local machine under W98 where the classes and the serial port...
|
by: MNQ |
last post by:
Hi All
I want to use my parallel port of my PC to control some external devices. I
am writing a program in ANSI C using the PacificC compiler. What I need to
know is how to access the parallel port ie to send data and to read the
state of the parallel port including the control lines. Can anyone
help/point me in the correct direction? I have tried the help files and the
internet but am unable to find anything relevant.
Thanks in...
|
by: halukg |
last post by:
I am trying to send a 6 byte char array from the serial port in new C# 2005
Express:
com.Write(new string(new char { (char)34, (char)14, (char)192, (char)51,
(char)0, (char)0 }, 0, 6));
I am receiving 34,14,63,51,0,0 from the port as I connected Tx and Rx pins
to each other by using the following code:
private void com_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
|
by: kai |
last post by:
Hi,
I was tring to run an example (HelloWorld.aspx) from MSPrss book, I get
this message:
"ASP.NET Development Server faild to start listening port 1034.
Error message:
An attempt was made to access a socket in a way fobidden by its access
permissions."
|
by: henrycortezwu |
last post by:
Hi All,
I'm trying to connect to a virtual port (COM19, OUTGOING, "Bluetooth
Serial Port") using VS2005 System.IO.Ports.
When I ran the ff code below here's what happens.
1) VS2005 Compiles w/o errors
2) My Nokia 6600 prompted me the message "Accept Connection request
from DEMON?"
note: DEMON is my computers name.
3) Using my Nokia 6600, I hit the button that refers to the "Yes"
| |
by: vorange |
last post by:
Hello,
I have a problem I have been unable to solve for quite some
time now. I'm using the Serialport class and opening the port and
writing a byte to it. The byte is successfully received by the other
device. The other device then sends back a response.
But what I get back is the same character I sent! e.g. if i send 2, i
get back 2.
What is going on here? Why are things being echoed back. My code is
|
by: Phoe6 |
last post by:
Hi,
The following piece of code works properly when my proxy password
contains characters etc. But when my proxy password
contained something like '|\/|' , the httplib incorrectly indentified
it as separator. How do I resolve this issue.
<code>
# Proxy Address
PROXY_IP = "1.1.9.8:80"
|
by: mmcgee00 |
last post by:
Hi,
Currently, I am trying to get different service banner by connecting
to different ports using python (code below). The versions I am
working with are python 4.2.1 and fedora core 4. I am trying to
reproduce a very small piece of nmap, since nmap has to get a port's
banner in order to figure out the version. However, I haven't been
entirely successful.
*******************************************************
|
by: blunt |
last post by:
trying to write a program to write the configuration files for a load of wireless access points. i've never been a good programmer and haven't done any for nearly a decade so have obviously made some mistakes, i'm using cygwin on a windows pc and it seems that some functions cause stack overflows so am using fgets instead of fgetc (don't know y it solved the problem but that part is working).
my problem now is that i am reading strings a few...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| | |