18F8640 GLCD problem

General discussion relating to the library modules supplied with the compiler

Moderators: David Barker, Jerry Messina

Post Reply
xnederlandx
Posts: 33
Joined: Wed Jul 01, 2009 5:55 am

18F8640 GLCD problem

Post by xnederlandx » Mon Jul 06, 2009 3:34 am

I'm having problems again :x

I have my program working with my 18F4431 on the EasyPIC 5 Board.

Because I was low on program space, I decided to replace it with a 18F4680.

I changed the "device =" which specifies the device.

Strangely... GLCD now has lines through it. Where used to be some text, there are now lines through the text. These lines are about 3 pixels high, and are blue (not on).

I put the 18F4431 back, and the program works as normal, no lines through GLCD

I then put a new 18F4680 into the slot, and had the same problem.
Last edited by xnederlandx on Mon Jul 06, 2009 6:25 am, edited 2 times in total.

xnederlandx
Posts: 33
Joined: Wed Jul 01, 2009 5:55 am

Post by xnederlandx » Mon Jul 06, 2009 3:55 am

Some photos of the problem.

May help with diagnosis. Will upload program next.
Image
Image

xnederlandx
Posts: 33
Joined: Wed Jul 01, 2009 5:55 am

Post by xnederlandx » Mon Jul 06, 2009 3:58 am

Code: Select all

Device = 18F4680                            '
Clock = 32                                  ' PIC 18F4431 Config with external 8 Mhz Resonator
Config OSC = HSPLL                          '


#option GLCD_data = PORTD                   '
#option GLCD_RS = PORTB.2                   ' GLCD PIN CONFIGURATION
#option GLCD_EN = PORTB.4                   '
#option GLCD_RW = PORTB.3                   ' AS PER EASYPIC5 SCHEMATIC
#option GLCD_CS1 = PORTB.1                  '
#option GLCD_CS2 = PORTB.0                  '                                                                 
#option GLCD_RST = PORTB.5                  '
#option GLCD_invert_cs = true               '
#Option GLCD_INIT_DELAY = 100               '
#option GLCD_MODEL = KS0108                 '


Include "glcd.bas"                          'Load GLCD Library
Include "graphics"                          'Load Graphics Library
Include "USART.bas"                         'Load USART Library.
Include "tahoma.bas"                        'Load Tahoma Font
Include "arial_L.bas"                        'Load Custom Arial Large Font
Include "Convert.bas"                       'Load Conversion Library.
Include "Math.bas"                          'Load Mathematics Library Calculations).
The Configuration. Will post more of software apon request, but I don't think it's my program.

edit:

Just if anyones interested - USART etc and all the other libries are working fine.


Thanks in Advance

xnederlandx
Posts: 33
Joined: Wed Jul 01, 2009 5:55 am

Post by xnederlandx » Mon Jul 06, 2009 6:05 am

I've gone back to basics, with just simple commands on the GLCD.

Circles... Squares... Text .... etc.

They all have little chunks cut out of them, and the location depends on where I place it on the Y axis.

Maybe it has something to do with the line function?

User avatar
Steven
BETA Tester
Posts: 406
Joined: Tue Oct 03, 2006 8:32 pm
Location: Cumbria, UK

Post by Steven » Mon Jul 06, 2009 6:30 am

You could look at the ports you have used in the PIC's datasheet to make sure that none are set as analogue by default. If they are you will need to make them digital.

xnederlandx
Posts: 33
Joined: Wed Jul 01, 2009 5:55 am

Post by xnederlandx » Mon Jul 06, 2009 6:31 am

Thankyou for the quick reply.

How can I set them to digital?

If I have set them to output, do I still need to set them as digital?

Francis
Registered User
Registered User
Posts: 314
Joined: Sun Mar 25, 2007 9:40 am
Location: Devon

Post by Francis » Mon Jul 06, 2009 9:03 am

If its inlcuded in the utils.bas you can use SetAlldigital.

Otherwise read the PIC data sheet, look for things like ANSEL, ADCOn and CMCON.
Then just set the bits to make the port.pins digital.

xnederlandx
Posts: 33
Joined: Wed Jul 01, 2009 5:55 am

Post by xnederlandx » Mon Jul 06, 2009 9:17 pm

:D :D :D

Thankyou very much. The utils.setalldigital worked perfectly!!

Thanks again. :D

xnederlandx
Posts: 33
Joined: Wed Jul 01, 2009 5:55 am

Post by xnederlandx » Tue Jul 07, 2009 6:37 am

Just one more question.

If I have 2 Microcontrollers (18F2525 and 18F4680 (or equivalent)) running on the same power supply, what circuit do I need for them to communicate via usart?

Any Pull-up (/down) resistors etc?

Or do I need a MAX232?
Or can I just connect the RX to the TX pin of the other Microcontroller?

Thanks again.

Francis
Registered User
Registered User
Posts: 314
Joined: Sun Mar 25, 2007 9:40 am
Location: Devon

Post by Francis » Tue Jul 07, 2009 9:42 am

MAX232 (or equiv) simply inverts and level shifts.
Your PICs will both be running at same Vsupply.

For prototyping use a small res for 'safety'. No pull ups/downs/offs required.

xnederlandx
Posts: 33
Joined: Wed Jul 01, 2009 5:55 am

Post by xnederlandx » Wed Jul 08, 2009 1:54 am

So something like 50 Ohms?

I am sticking this on a PCB, so will it matter if I use a resistor or not?

Also, what if I have both PIC's running off a different 5V Regulator?

Francis
Registered User
Registered User
Posts: 314
Joined: Sun Mar 25, 2007 9:40 am
Location: Devon

Post by Francis » Wed Jul 08, 2009 11:09 am

Always best to breadboard before commiting to PCB.

50ohms? Odd value but OK.

I assume you mean each PIC running from a different 5V regulator?
I assume commoned grounds?
I assume each regulator has a common Vin? So you don't have to worry about parasitic power issues?
If not, and parasitic powering between PICs is an issue, then you should consider making the resistor a much higher value.

If doing a s/sided PCB and routing complicated a resistor (even if not needed) can act as a useful 'link'.

Post Reply