Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/07/09 10:05
Read: times


 
#161351 - Using bit masks.
Responding to: ???'s previous message
Munish Kumar said:

3. I didnt get the meaning of double data read. Can you please clarify it a little bit how to do that?

4. Really thanks for this one. I didnt know there were drivers for KS0108. I downloaded from http://en.radzio.dxp.pl/ks0108/. But I am puzzled how to specify the pins for rs, rw, en, cs1/2 etc... I was trying to find something like: sbit rs = P2^0;
sbit rw = P2^1;
sbit en = P2^2; etc. The low level instructions file (KS0108-8051.c) says #define KS0108_RS (1 << 0)
#define KS0108_RW (1 << 1)... I didn't understand its meaning, while i changed #define KS0108_DATA_PORT P3 to my needs...


3. The double data read is explained in the data sheet.

4. Just use the library code as supplied. If your data is on P3
If your rw, en control lines are on P2.1, P2.2 then:

#define KS0108_DATA_PORT	P3
#define KS0108_DATA_DIR		P3
#define KS0108_DATA_PIN		P3

#define KS0108_CTRL_PORT	P2
#define KS0108_CTR_DIR		P2

#define KS0108_RW			(1 << 1)
#define KS0108_EN			(1 << 2)

 


Do not worry about the 8051 not having a DDR ( data direction register ). I am sure that this will all be solved elsewhere in the code.

You will probably find that most 8051 compilers will execute an efficient machine instruction for:
P2 |= (1<<2);      // P2.2 = 1;
P2 &= ~(1<<2);     // P2.2 = 0;

 

The above syntax is legal C, so will work with any compiler on any architecture. The sfr.2 syntax is NOT portable.

Good Luck. I have not used this library but I am sure that it should work ok.

David.


List of 7 messages in thread
TopicAuthorDate
Ks0108 Graphics LCD read problem            01/01/70 00:00      
   You need to obey the data sheet.            01/01/70 00:00      
      I tried all things but...            01/01/70 00:00      
         Using bit masks.            01/01/70 00:00      
            SORTED ! :)            01/01/70 00:00      
               Your strobe still leaves EN true            01/01/70 00:00      
                  Prhps other functions take care of it...            01/01/70 00:00      

Back to Subject List