View previous topic :: View next topic |
Author |
Message |
dong sung Guest
|
8 bit input checking |
Posted: Thu Mar 23, 2006 6:07 pm |
|
|
hello all,
I have a 8 bit input at port B.(I pulled up port B to TRUE)This value is displayed on LCD.Now I want LCD to keep displaying "Dong the king" till it actually gets input at port B.I saw lotss of codes in this forum .help me.
My question --- how I check if I am getting 8 bit input?
int8 dong;
//I display"Dong the king"here
dong = input_b();
if(dong!=11111111)// THIS CORRECT WAY??I USED NOT 1111111 since port B is pulled up TRUE initially
{
//if PIC getting input
}
Sorry poor ennglish
Dong |
|
|
Dong Guest
|
|
Posted: Thu Mar 23, 2006 11:08 pm |
|
|
Do I use 255 when checking???
how do I make my message on LCD flashing??
Thanks,
Dong |
|
|
dong Guest
|
|
Posted: Thu Mar 23, 2006 11:12 pm |
|
|
sorry one more question:
Sometimes my LCd acts weird when I switch on the power and my 8 bit input is already connected.It shows blocks.
But when I attach input wires after LCD is powered on,it shows correct messages.Why is this?
Thank you all
Dong |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Mar 24, 2006 12:09 am |
|
|
If you're not using decimal, then you have to tell the compiler
what the number system is. This is done by putting "0x" in front
of the value for Hex, or "0b" for binary, etc.
Quote: |
Decimal: 255
Hex: 0xFF
Binary: 0b11111111
|
Ideally, you should learn this in the classroom or from a textbook,
instead of on this forum. The forum should be for more advanced
topics. |
|
|
Dong Guest
|
re:one question |
Posted: Fri Mar 24, 2006 4:21 am |
|
|
thanx
one problem:
Sometimes my LCd acts weird when I switch on the power and my 8 bit input is already connected.It shows blocks.
But when I attach input wires after LCD is powered on,it shows correct messages.Why is this?
what do i do??
dong |
|
|
mpfj
Joined: 09 Sep 2003 Posts: 95 Location: UK
|
|
Posted: Fri Mar 24, 2006 4:49 am |
|
|
Dong wrote: | Sometimes my LCd acts weird when I switch on the power and my 8 bit input is already connected. It shows blocks. |
The LCD will contain some RAM to store the pixel information it will display. When you write to the LCD, the data you send is stored in this RAM, and the LCD then reads the RAM contents and "converts" the data into pixels that are on or off.
When you first power on the LCD, the RAM will usually come up in a random state, since you haven't written anything to it. This is the "weird" behaviour that you are seeing.
So the first thing you need to do is to initialise the LCD by setting the entire RAM to some known value (usually 0x00).
Consult the datasheet for the LCD (or the LCD controller chip). This should have some more information. |
|
|
|