m16c and lcd p9 read faliure?

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
hi,

i am trying to get to work an m16c (M30624FGAFP) with an LCD (JCM12864V
JMK124). the lcd driver is a samsung S6B0724.

the problem i am having is that when i am reading the p9 port of th
controller it gives back the data which has been sent out the last time.
the configuration of the port is input without pullup. before writing th
pd9 prc2=1 is used.

anything what could go wrong?

thanks
fatso



        
This message was sent using the comp.arch.embedded web interface o
www.EmbeddedRelated.com

Re: m16c and lcd p9 read faliure?
Quoted text here. Click to load it

Changing the port 9 DDR from output to input requires PRC bit 2 = 1 (PRCR =
4) *with interrupts disabled* otherwise the unlock can be lost before the
DDR write. It sounds like you're changing the port direction but its
failing.

Peter



Re: m16c and lcd p9 read faliure?
Quoted text here. Click to load it
=
Quoted text here. Click to load it
the
Hi,

Now I have tried with disabling the interrupts however still won't work.
I have also checked whether the direction change was ok by reading bac
the pd9 which gave the 0x00.

Strange is when I am using a multimeter to see what voltages are currentl
on the pins it it shows zero volt and the input data read by the controlle
might change.

I am afraid that the display itself is faulty and won't power up leavin
the p9 open. Actually there was as mistake giving 5V istead of 3.3V to th
lcd-s control logic but now even with 3.3 doesn't seem to work. (i am stil
wondering how the lcd is able to operate with ttl voltages if it get
3.3V...)

Ferenc

        
This message was sent using the comp.arch.embedded web interface o
www.EmbeddedRelated.com

Re: m16c and lcd p9 read faliure?
Are we mind readers? What's wrong with included the offending section of
your code and details of the hardware connections. Could be a hardware
thing, you might have 8080 write mode selected or this or that or
something. Do we get a prize for best guess?

*Peter*

fatso wrote:
Quoted text here. Click to load it


Re: m16c and lcd p9 read faliure?
Sorry and thanks for trying to help me.

The JCM12864 has the following pins:
*CS1     chip select
RESET   reset   low for resetting
*RS      H for data L for control
*RW      read/write selection high for reading
*E       RW=H E=H data DB0-7 output, RW=L DB0-7 latched on falling E
*DB-7    bidirectional data singals
VDD     +3.3
VSS      Ground
Vout    voltage controller io
C4+
C3+
C1-
C1+
C2+
C2-     capacitators
V1
V2
V3
V4
V0       lcd driver supply voltages
*PS       parallel serial select. connected to H -> parallel

I've stated with a "*" which pins are connected to the MCU.
in the lcd's documentation the interface is written to be m6800
so the C68 pins must be H inside the device. just like the CS2.


the code which is operating:
#define     EEE             p8_0                                        
                                                                          
              
#define     RS              p8_1                                        
                                                                          
              
#define     CS_DISP         p8_7                                        
                                                                          
              
#define     RW              p8_6                                        
                                                                          
              
                                                                        
                                                                          
               #define     DATA            p9  
void setupDisplayPorts(void){                                            
                                                                          
              
    prc2 = 1;                               // enable writing to pd9    
                                                                          
              
    pd9 = 0xff;                             // port 9 is an outport      
                                                                          
              
    pd8_0 = 1;                              // output E                  
                                                                          
              
    pd8_1 = 1;                              // output RS                
                                                                          
              
    pd8_7 = 1;                              // output CS_DISP, chipselect
                                                                          
              
    pd8_6 = 1;                              // output RW                
                                                                          
              
    asm("nop");    asm("nop");    asm("nop");    asm("nop");            
                                                                          
              
    RS = 0;                                 // RS is the data/comman
selector                                                                
                    
    RW = 0;                                 // RW is the read/writ
control                                                                  
                      
    EEE = 0;                                // EEE is the data latc
signal                                                                  
                      
    DATA = 0;                               // DATA is the eight bit dat
bus                                                                      
                
    CS_DISP = 0;                            // select the display        
                                                                          
              
    asm("nop");    asm("nop");    asm("nop");    asm("nop");            
                                                                          
              
                                                                        
                                                                          
              
    return;                                                              
                                                                          
              

}              
...
    setupDisplayPorts();

    DATA = 0xaa;
    asm("fclr i");                                                        
                                                                          
              

    prc2 = 1;                               // enable writing to pd9      
                                                                          
              

    pd9 = 0x00;                             // p9 input                  
                                                                          
              

    asm("fset i");                                                        
                                                                          
              

                                                                          
                                                                          
              

    EEE = 1;                                                              
                                                                          
              

    RS = 0; //command                                                    
                                                                          
              

    RW = 1; //read                                                        
                                                                          
              

   while (1){                                                            
                                                                          
              

     char x;                                                              
                                                                          
                          

     wait(10);                              // waits  1s                  
                                                                          
                  

     xDA%TA;                                                              
                                                                          
              

     RS232Send2(1,&x);                       // sends the data to the pc  
                                                                          
                                          

     wait(1);         //waits 0.1s                                        
                                                                          
                                  

   };/**/  

Ferenc

Quoted text here. Click to load it


Quoted text here. Click to load it

        
This message was sent using the comp.arch.embedded web interface on
www.EmbeddedRelated.com


Re: m16c and lcd p9 read faliure?
Quoted text here. Click to load it


Firstly, isn't E low, the passive state, so thats what it should be inited
to.
Secondly, the Mitsubishi compiler, at least, can and does combine port bit
writes into an 'and' or 'or' port with constant. This can be bad news if
your expecting the rising or falling edge of one pin to clock in the value
of another pin

Quoted text here. Click to load it

RS, RW etc should change while E is active.

Quoted text here. Click to load it

bizarre? what is this about:

Quoted text here. Click to load it

Peter D



Re: m16c and lcd p9 read faliure?

Quoted text here. Click to load it
inited
E is inited to 0. and also for output, however E is only for th
communication not for the chipselect. CS1 is for the chipselect.

Quoted text here. Click to load it
bit
value
Does it mean I should use BAND and BOR with CLR C and SET C instead?


Quoted text here. Click to load it
according to the R/W characeristic. RS and RW should be set up first an
then CS1 and E. I might made a mistake with this though.
Quoted text here. Click to load it
I am trying to read the display's status with an endless loop so that
I can test the pins with a multimater as well.
Quoted text here. Click to load it
pc
Thank you again, however I seem to be stucked at the moment.
Ferenc


        
This message was sent using the comp.arch.embedded web interface o
www.EmbeddedRelated.com

Re: m16c and lcd p9 read faliure?
Quoted text here. Click to load it

Normally, for a m6800 type bus you'd expect E and CS1 to be inactive, then
RW and RS to to valid states, followed by CS1 going active, followed by E
going active. After the transfer E goes inactive and then CS1. If you are
outputing data its best done before E goes active.

Quoted text here. Click to load it

No, just put the asm nops between each operation to stop it optimizing.

Quoted text here. Click to load it

NO! I'm sure that that is wrong.

Quoted text here. Click to load it

YES!

Quoted text here. Click to load it

Peter



Re: m16c and lcd p9 read faliure?
Thanks for the help so far.

i got a new display now and it turned out that the other was dead.
now i am able to turn on the new one, seems to get the commands, howeve
the reading from the port is faulty somehow.
i can measure with a multimeter that there is 0V however the MPU reads
back instead of 0.
the following data should show up (in binary format);
(BUSY, ADC, ON/OFF, RESETB, 0, 0, 0, 0)
on/off is 1 when the display is off.
when the pins have 01000000b (adc and on) then it reads 11111110b (0xfe)
also reads the same when the display gives 01100000b (0x60) adc and off
reads 0xfc when there is 00100000. (adc0 and off)
i use the following code:

    //port9 direction for input
    asm("fclr i");                  
    prc2 = 1;    asm("nop");              
    pd9  = 0x00; asm("nop");
    asm("fset i");                  
    
                                    
    RS = 0; asm("nop");   //command    
    RW = 1; asm("nop");   //read      
    EEE = 1;asm("nop");   //enable          
    CS1 = 0;asm("nop");   //chip select          
    //reading forever
    while (1){                      
      char x;                      
      wait(10);     //wait one sec                
      x = DATA;asm("nop");    //read p9 #define DATA p9      
      RS232Send2(1,&x);       //send to pc via      
      wait(1);                      
   }

ferenc
        
This message was sent using the comp.arch.embedded web interface o
www.EmbeddedRelated.com

Site Timeline