GLCD(0108) Demo problems on 18F8722 - solved

Coding and general discussion relating to the compiler

Moderators: David Barker, Jerry Messina

Post Reply
MattH
Registered User
Registered User
Posts: 51
Joined: Mon Jan 01, 2007 8:03 pm
Location: Allentown, PA

GLCD(0108) Demo problems on 18F8722 - solved

Post by MattH » Tue Jan 02, 2007 2:40 am

Hi there,

I just d/l the compiler (SE) to do a evaluation and I can say it looks very
promising. I like the speed and the optimization compared to others.

The first demo I tried out from your sample folder was the GLCD-Demo.
Using a BIGPIC4, I was able to get the demo working in no time using
a 18F8520 w/10MHz (HS - no PLL). The same prg was working with 40MHz as well. The created HEX file was 1/3 compared to a 'different' software I used for comparison.
After switching to a 18F8722 (w/10MHz - no PLL) the display came up for about 10 seconds and went blank. The same happens with 40MHz PLL enabled. The prg loop's about 15 times before it dies.

Following the modified code for the BIGPIC4:

Code: Select all

// if device and clock are omitted, then the compiler defaults to 
// 18F452 @ 20MHz - they are just used here for clarity...
//Device = 18F8520
Device = 18F8722
Clock = 10
//
//(PORTJ, 0,   1,   2,  3,   5,  4, PORTH)  >>> modified for BIGPIC4
//       cs1, cs2, rs,  rw, rst, en
//

#option GLCD_DATA = PORTH        // data port
#option GLCD_RS = PORTJ.2        // RS pin
#option GLCD_EN = PORTJ.4        // EN pin
#option GLCD_RW = PORTJ.3        // RW pin
#option GLCD_CS1 = PORTJ.1       // chip select
#option GLCD_CS2 = PORTJ.0       // chip select
#option GLCD_INVERT_CS = true   // invert CS lines... 
Include "GLCD.bas"
Include "graphics.bas"
Include "Bitmaps.bas"

ADCON1 = $0F                          // PORTE as digital (GLCD)
CMCON  = CMCON Or $07                 // turn off comparators

GLCD.Cls
GLCD.SetImage(49,51,BtnOK)   
GLCD.SetImage(89,51,BtnCancel) 
While true
   GLCD.SetImage(4,2,BatteryImage, cmXOR)	
   DelayMS(500)
   GLCD.SetImage(4,2,BatteryImage, cmXOR)	
   DelayMS(500)
Wend   

I'm sure I missed something here...

Thanks, Matt
Last edited by MattH on Wed Jan 03, 2007 2:22 pm, edited 1 time in total.

xor
Posts: 286
Joined: Sun Nov 05, 2006 1:15 pm
Location: NYC
Contact:

Post by xor » Tue Jan 02, 2007 5:34 am

MEMCON is the only thing I can see that is immediately associated with the PORTH and PORTJ pins and is ready by default at startup for extended addressing capabilities.....which you don't need. Try doing the following, although the same startup feature exists with the '8520 which worked fine.....so no guarantees:

Code: Select all

MEMCON.7 = 1
Another tidbit of info, CMCON=7 is the default startup value for the '8722, but not so for the '8520.

MattH
Registered User
Registered User
Posts: 51
Joined: Mon Jan 01, 2007 8:03 pm
Location: Allentown, PA

Post by MattH » Tue Jan 02, 2007 7:42 pm

XOR,

Thanks for your advise but the problem is still the same.
The funny part is that the program loops almost exactly 15 times before
the screen turns off.
I tried my 'other' software demo which works just fine and stable.
So there is no problem on the hardware.

Matt

xor
Posts: 286
Joined: Sun Nov 05, 2006 1:15 pm
Location: NYC
Contact:

Post by xor » Wed Jan 03, 2007 3:53 am

To help narrow down the problem, is the While-Wend continuing to cycle after the GLCD goes blank? You can check this by toggling an LED on another port.

MattH
Registered User
Registered User
Posts: 51
Joined: Mon Jan 01, 2007 8:03 pm
Location: Allentown, PA

Post by MattH » Wed Jan 03, 2007 12:21 pm

Yup... I did that yesterday and the led keeps flashing.
I also changed the initial startup delay for the GLCD w/out any improvements.
Today I will change the display with a different brand (Hantronix), which
we using in one of our instruments for years.
If that doesn't improve anything, I'm going to change the delays inside of the driver.

Matt

MattH
Registered User
Registered User
Posts: 51
Joined: Mon Jan 01, 2007 8:03 pm
Location: Allentown, PA

Post by MattH » Wed Jan 03, 2007 2:24 pm

Well, after adding

Code: Select all

#option GLCD_RST = PORTJ.5        // RSTpin
the display works just fine. The interesting part is, it works on a 18F8520
w/out it.

Matt

xor
Posts: 286
Joined: Sun Nov 05, 2006 1:15 pm
Location: NYC
Contact:

Post by xor » Wed Jan 03, 2007 3:11 pm

Ooooh....a floating pin will get you with CMOS. Generally, they like to float high and take time doing it.

MattH
Registered User
Registered User
Posts: 51
Joined: Mon Jan 01, 2007 8:03 pm
Location: Allentown, PA

Post by MattH » Wed Jan 03, 2007 10:28 pm

I agree... I thought the RST has a pull-up on the bigpic4. I was wrong.
:shock:

Matt

Post Reply