CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

HG25504, 256 x 128 GLCD with SED1330 controller problem
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Sergeant82d



Joined: 01 Nov 2009
Posts: 55
Location: Central Oklahoma

View user's profile Send private message

HG25504, 256 x 128 GLCD with SED1330 controller problem
PostPosted: Sun Nov 29, 2009 4:56 pm     Reply with quote

I am trying to get a graphics LCD working with a PIC 18F4620. I am using an EasyPIC3 development board from MikroElektronika. I am passing the data from the EasyPIC3 through header cables approx. 18” long to a breadboard and the LCD.

The display as it is now, only shows flickering, all pixels staying mostly dark but showing definite lines side-to-side, mostly appearing to scroll rapidly from top to bottom. Going through as much troubleshooting as I know how I have been able to change the screen from all dark to mostly light, but NO displayable characters of any type. Right now I am only trying to display a rectangle and circle to verify operation.

The display is a Hyundai # HG25504 256 x 128 Graphics LCD which you can see here: http://www.allelectronics.com/make-a-store/item/LCD-101/256-X-128-LCD-PANEL/-/1.html , which uses a Seiko SED 1330 controller. According to the Technical Manual, the SED1330 is software compatible with the SED1335, so I am using that driver which comes with CCS C. I have remapped the control pins in the driver file to match my pins (below).

I am using PORTD as the data port (D0=DB0, thru D7=DB7), and PORTC, 0-4, as the control port as follows:

Reset C0
Read C1
Write C2
CS C3
AO C4


I have +5 VDC on the logic, and -10VDC thru a 10K pot to the screen. I have confirmed voltages; I have 2 DMMs hooked up monitoring full-time.

The below code compiles in MPLAB 8.4 using CCS ver 4.088 without errors:

Code:

#include <18F4620.h>
#fuses HS, NOWDT, NOPROTECT, NOLVP, BROWNOUT, PUT, NOPBADEN
#use delay(clock=32M,oscillator=8M)   // I tried everything from 4 – 32 MHz
#define FAST_GLCD
#define LARGE_LCD 1   // Use 16 bit int variables

#include "SED1335.c"
#include <graphics.c>


void main(){

//   delay_ms(100);    // I tried all the delays with no change
   glcd_init(on);
   delay_ms(2000);   // I tried delays ranging from none to this value without success
   glcd_power(on);
   delay_ms(500);

while(true){

   glcd_circle(192, 64, 50, yes, off);
// Purpose:       Draw a circle on a graphic LCD
// Inputs:        (x,y) - the center of the circle
//                radius - the radius of the circle
//                fill - YES or NO
//                color - ON or OFF

//  delay_ms(50);

  glcd_rect(10, 10, 140, 70, yes, off);
// Purpose:       Draw a rectangle on a graphic LCD
// Inputs:        (x1, y1) - the start coordinate
/                (x2, y2) - the end coordinate
//                fill  - YES or NO
//                color - ON or OFF
// Dependencies:  glcd_pixel(), glcd_line()

   }
}


The display is “alive”, and the PIC is working – when I add large delays, or delays in the while loop, I can see changes relating properly to those delays. The scope verifies data passing.

I do not see any direct data port assignments in the SED1335.c driver; only references to tris_d… is perhaps my file missing something? Like I said, the above code does compile properly and *seems* like it’s working… except that the screen stays black and flickering!

Any and all help greatly appreciated.
Brad


Last edited by Sergeant82d on Tue Dec 01, 2009 9:05 am; edited 1 time in total
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Nov 29, 2009 5:08 pm     Reply with quote

The #use delay statement must match the actual oscillator frequency.
According the EasyPic3 manual, it ships with an 8 MHz crystal. Initially,
just use HS mode and set the #use delay for 8 MHz as shown below.
Code:

#include <18F4620.h>
#fuses HS, NOWDT, NOPROTECT, NOLVP, BROWNOUT, PUT, NOPBADEN
#use delay(clock=8000000)
 
Sergeant82d



Joined: 01 Nov 2009
Posts: 55
Location: Central Oklahoma

View user's profile Send private message

PostPosted: Sun Nov 29, 2009 5:20 pm     Reply with quote

Thanks, I have tried 4, 8, 16 & 32 MHz, using both internal and crystal oscillators, with and without PLL multiplation... and did again after reading your reply (thanks!) just to be sure, but with no effect.

I have spent quite a bit of time with Google trying to verify that I could use the 1335 driver with the 1330, but finally satisfied myself that it would work fine.

Since I don't see anything specifically about PortD being the data port I have been concerned that may be the problem, but I don't see anything to convince me that it shouldn't work.

I already have >10 hours in just this LCD... I am afraid I may have to go to PicBasic Pro and buy the graphics library from the guys at the workbench, dedicating another PIC and using it as a serial GLCD... but I'd really like to use C instead!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Nov 29, 2009 5:30 pm     Reply with quote

To test is your PIC is really running at 8 MHz, run the following program.
It will blink an LED on pin A0, once per second.

On Dip Switch SW2, position 1 should be set to "On". This switch is
labeled as "PortA LED". Look on your board to make sure this has been
done. Then it should be able to blink the LED.

Does it blink at a rate of once per second ?
Code:

#include <18F4620.h>
#fuses HS, NOWDT, NOPROTECT, NOLVP, BROWNOUT, PUT, NOPBADEN
#use delay(clock=8000000)

//======================================
void main(void)
{

while(1)
  {
   output_high(PIN_A0);
   delay_ms(100);
   output_low(PIN_A0);
   delay_ms(900);
  } 

}
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Sun Nov 29, 2009 5:34 pm     Reply with quote

Quote:
I do not see any direct data port assignments in the SED1335.c driver
But there are output_d() and input_d() in the driver.
Sergeant82d



Joined: 01 Nov 2009
Posts: 55
Location: Central Oklahoma

View user's profile Send private message

PostPosted: Sun Nov 29, 2009 5:40 pm     Reply with quote

Thanks, yes that works fine, blinking away...

I've been using this dev board off and on for about four years, up until the past month or so I've been using PICBASICPro. I finally decided to learn C because of the limits of available information on BASIC out here in the country...

I have the included GLCD, a 128x64, working with EX_GLCD; I've used your Flex_LCD, PWM, ADC and a few other routines, blinking bits... I am very much a novice programmer but the board is working... mostly... just not this LCD!
Sergeant82d



Joined: 01 Nov 2009
Posts: 55
Location: Central Oklahoma

View user's profile Send private message

PostPosted: Sun Nov 29, 2009 5:43 pm     Reply with quote

@ FVM - yes, the port_d directives are there; I just kind of expected to see a #define or something, to make the driver more portable.

Like I said in the post above, I am very much a novice programmer, but I've been reading a lot and am trying to "do things right". But right now, I'd settle for simply getting it working!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Nov 29, 2009 6:09 pm     Reply with quote

Code:

Reset C0
Read  C1
Write C2
CS    C3
AO    C4

Your EasyPic3 board has jumpers JP7, JP8, and JP9 that control the
connections on PortC, pins C3, C4, and C5. These jumpers have
to be placed on the left side of the jumper block, in order to be able
to use these pins for normal i/o.

This board is full of little "gotchas" like that. Have you gone through
the jumper options in detail ?
Sergeant82d



Joined: 01 Nov 2009
Posts: 55
Location: Central Oklahoma

View user's profile Send private message

PostPosted: Sun Nov 29, 2009 6:28 pm     Reply with quote

Nice catch... those three were correct, but I did have RC6 & 7 assigned (as normal) to the RS232 port... but since I'm not using them on the LCD it shouldn't matter... but I moved the jumpers for C6 & 7 down to the RB2 & 5 positions, just to see....

And for whatever reason (I removed, then re-installed the three jumpers you mentioned, and rebooted it, but no firmware change), the display is now more "active". I have vertical lines at about every fourth column, and the horizontal bars are scrolling down more identifiably - not a constant flickering, but a slow progression. Also, the pixels are not all dark, but are mostly light.
Sergeant82d



Joined: 01 Nov 2009
Posts: 55
Location: Central Oklahoma

View user's profile Send private message

PostPosted: Sun Nov 29, 2009 6:41 pm     Reply with quote

The LCD is definately getting "better" now... it appears to be almost properly initialized, but still nothing displayed... it's frustrating - I think I'm so close!

I put a couple of delays back in the while loop and turned on the LEDs on the board; I can see them flash when the new commands are sent.

Aaarrgghhh! <tearing at hair>

Thanks for your help so far,
Brad
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Nov 29, 2009 6:59 pm     Reply with quote

Quote:
The display is a 256 x 128 Graphics LCD.

#ifndef GLCD_WIDTH
#define GLCD_WIDTH 320
#endif

#ifndef GLCD_HEIGHT
#define GLCD_HEIGHT 240
#endif

Did you edit these settings in the driver file, to match your LCD's
resolution ?
Sergeant82d



Joined: 01 Nov 2009
Posts: 55
Location: Central Oklahoma

View user's profile Send private message

PostPosted: Sun Nov 29, 2009 7:05 pm     Reply with quote

Yes; sorry I didn't clarify that.

Code:

#ifndef GLCD_WIDTH
#define GLCD_WIDTH         256      //320
#endif

#ifndef GLCD_HEIGHT
#define GLCD_HEIGHT        128      //240
#endif

#ifndef GLCD_CHAR_WIDTH
#define GLCD_CHAR_WIDTH    8//5  //8
#endif

#ifndef GLCD_CHAR_HEIGHT
#define GLCD_CHAR_HEIGHT   8//7  //8
#endif

#ifndef GLCD_RST
#define GLCD_RST           PIN_C0
#endif

#ifndef GLCD_RD
#define GLCD_RD            PIN_C1
#endif

#ifndef GLCD_WR
#define GLCD_WR            PIN_C2
#endif

#ifndef GLCD_CS
#define GLCD_CS            PIN_C3
#endif

#ifndef GLCD_A0
#define GLCD_A0            PIN_C4
#endif
Sergeant82d



Joined: 01 Nov 2009
Posts: 55
Location: Central Oklahoma

View user's profile Send private message

Hardware?
PostPosted: Sun Nov 29, 2009 10:05 pm     Reply with quote

It's beginning to look like the problem is a hardware one... I swapped out displays with my spare (I bought two, a couple of years ago, thinking they'd sell out quickly).

I see a distorted and irresolute rectangle & circle, with blobs where my text should be... so the software is working and the wiring appears to be correct... I think.

The thing wouldn't work at all if the wiring was off, would it? I have double and triple checked my connections, though, so I really don't think that's it.

My circle's line is about 4 pixels thick and the vertical lines on the ends of my rectangles are also; the horizontal lines are fine.

However, it only displays for a few seconds after booting the PIC, then fades to garbage.

Of course, I don't get anything but an initialized screen on the first one, but I may have hurt that with excess voltage when originally hooking it up; this second one should be fine. Should be.

Anyone have any more recommendations, other than buying another display? I may regardless, to verify or deny a problem; I'd sure like to get this display going!

Thanks again,
Brad
Sergeant82d



Joined: 01 Nov 2009
Posts: 55
Location: Central Oklahoma

View user's profile Send private message

Almost got it working properly...
PostPosted: Mon Nov 30, 2009 8:53 pm     Reply with quote

After swapping out displays and increasing both the display voltage (up to -10.7, from -10), and adding delays (which I have subsequently removed now that it's mostly working), I have a display I can see.

I still have a problem, though - every eighth column is not working; it's cleared.

I have pulled data pins one by one with no change; are my displays just both screwed up? The software is working, the display is showing circles and rectangles... it's just not right.

Anybody have any more suggestions?

TIA

Code:

#include <18F4620.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP,BROWNOUT,PUT,NOPBADEN//H4,
//#use delay(clock=8M)
#use delay(clock=20M)
//#use delay(clock=32M,oscillator=8M)
#define FAST_GLCD    // Try commenting this out to see the differences
#define LARGE_LCD 1

#include "SED1335.c"
#include <graphics.c>

void main(){

   delay_ms(100);
   glcd_init(on);
   delay_ms(500);
   
   glcd_power(on);
   delay_ms(500);

while(true){
 
  glcd_circle(189, 64, 57, yes, on);
  glcd_circle(67, 64, 57, yes, on);
 
  glcd_rect(0, 0, 255, 127, no, on);
  glcd_rect(1, 1, 254, 126, no, on);
  glcd_rect(2, 2, 253, 125, no, on);
  glcd_rect(3, 3, 252, 124, no, on); 

   }
}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Nov 30, 2009 9:07 pm     Reply with quote

Your EasyPic3 board ships with an 8 MHz crystal, unless you have
changed it. Why then do you have the #use delay() statement set
for 20 MHz ?
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group