Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

NOKIA-3310/5110 LCD library
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> Share your working BASCOM-AVR code here
View previous topic :: View next topic  
Author Message
karlos

Bascom Member



Joined: 03 Apr 2015
Posts: 107

PostPosted: Fri Jun 03, 2016 9:50 am    Post subject: Reply with quote

Mr Mrshilov
Also i did not test that changing tempreture value, or bias value in the program is more practical in different tempreture environment!
if you know about it, please guide me, because it is the most problem of me with working with lcds. my most pcb sent to environment with tempreture range of 40 to 55 degree centigrade and it cause so many problem for me.

Regards
Back to top
View user's profile
Mrshilov

Bascom LCD Guru



Joined: 24 Jan 2009
Posts: 314
Location: Russia

russia.gif
PostPosted: Fri Jun 03, 2016 10:27 am    Post subject: Reply with quote

No problem. In new version of lib it is possible to define "Contrast_lcd" as variable instead of constant.
Code:
Dim Contrast_lcd As Byte : Contrast_lcd = 60                'Contrast 0 to 127, if not defined - 72

And also use it in program. See your modified example in attach.
Back to top
View user's profile
Mrshilov

Bascom LCD Guru



Joined: 24 Jan 2009
Posts: 314
Location: Russia

russia.gif
PostPosted: Fri Jun 03, 2016 10:58 am    Post subject: Reply with quote



Last edited by Mrshilov on Fri Jun 03, 2016 11:12 am; edited 1 time in total
Back to top
View user's profile
Mrshilov

Bascom LCD Guru



Joined: 24 Jan 2009
Posts: 314
Location: Russia

russia.gif
PostPosted: Fri Jun 03, 2016 11:11 am    Post subject: Reply with quote

I don't test it in different temperature. But as we see in datasheet, controller PCD8544 used in 3310/5110 display has temperature compensation register (see section 7.8 in attachment). It regulate Vlcd voltage to maintain optimum contrast. Possible values is 4...7. During Initlcd it set to default 6:
Code:
 ldi r24,&H06                           ; Temperature setting
    rcall _gwrite_cmd

You may try to change it to 4...7 and check contrast in different environment temperatures. It may be done in program after Lcdinit:
Code:
Initlcd
Glcdcmd 33 : Glcdcmd 4
Cls


If it not helps, the only way I see is to use temp measure unit (like DS18B20) and regulate contrast depending of it's measure result.
Back to top
View user's profile
karlos

Bascom Member



Joined: 03 Apr 2015
Posts: 107

PostPosted: Fri Jun 03, 2016 11:59 am    Post subject: Reply with quote

Mrshilov wrote:
No problem. In new version of lib it is possible to define "Contrast_lcd" as variable instead of constant.
Code:
Dim Contrast_lcd As Byte : Contrast_lcd = 60                'Contrast 0 to 127, if not defined - 72

And also use it in program. See your modified example in attach.


thank you

the library did not attached, it did not changed?
Back to top
View user's profile
Mrshilov

Bascom LCD Guru



Joined: 24 Jan 2009
Posts: 314
Location: Russia

russia.gif
PostPosted: Fri Jun 03, 2016 12:07 pm    Post subject: Reply with quote

Lib not changed.
Back to top
View user's profile
karlos

Bascom Member



Joined: 03 Apr 2015
Posts: 107

PostPosted: Wed Jun 08, 2016 2:36 pm    Post subject: Reply with quote

Mr Mrshilov

does the library support Xmega ?

thanks
Back to top
View user's profile
Mrshilov

Bascom LCD Guru



Joined: 24 Jan 2009
Posts: 314
Location: Russia

russia.gif
PostPosted: Wed Jun 08, 2016 7:12 pm    Post subject: Reply with quote

Yes, but you must use virtual port. For example:
Code:
Config Vport0 = D
Config Graphlcd = 128x64sed , Rst = Port0.1 , Cs1 = Port0.1 , A0 = Port0.3 , Si = Port0.4 , Sclk = Port0.5
Back to top
View user's profile
karlos

Bascom Member



Joined: 03 Apr 2015
Posts: 107

PostPosted: Wed Jun 08, 2016 7:57 pm    Post subject: Reply with quote

and also is it possible to not use cs and rst in this mode?

thanks
Back to top
View user's profile
Mrshilov

Bascom LCD Guru



Joined: 24 Jan 2009
Posts: 314
Location: Russia

russia.gif
PostPosted: Wed Jun 08, 2016 8:41 pm    Post subject: Reply with quote

Of course.
Back to top
View user's profile
karlos

Bascom Member



Joined: 03 Apr 2015
Posts: 107

PostPosted: Wed Jun 08, 2016 8:56 pm    Post subject: Reply with quote

i test the library on xmega32a4 and also some other lcds,it is very strange that some times lcd start to work and some times not working, and all other lcds are too!

i search bascom help and found :

Quote:
The XMEGA has a built in internal oscillator that runs at a relative slow speed. If your code sets the speed to 32 MHz and you also include the $crystal=32000000 directive, you will notice a delay in the start of the code. This is caused by the fact that the delay routines are calculated with the 32 Mhz frequency, but the actual oscillator speed is 1 or 2 MHz.

There are 2 solutions possible.

- you can use $crystal=1000000 and then after you have set up the clock speed with CONFIG OSC, you can use another $CRYSTAL directive with the new speed.

- you use $INITMICRO and put the CONFIG OSC in the _INIT_MICRO code. This will ensure that the micro will run at the specified speed early as possible.


and do it,but problem exist yet!

the code:

Code:
$regfile = "xm32a4udef.dat"
$crystal = 32000000
$hwstack = 256
$swstack = 256
$framesize = 256
'-------------------------------------------------------------------------------
$lib "xmega.lib" : $external _xmegafix_clear : $external _xmegafix_rol_r1014
Config Osc = Disabled , 32mhzosc = Enabled , 32khzosc = Enabled
Bitwait Osc_status.1 , Set
Bitwait Osc_status.2 , Set
Osc_dfllctrl = &B00000000
Set Dfllrc32m_ctrl.0
Osc_pllctrl = &B10_0_01000
Set Osc_ctrl.4
Bitwait Osc_status.4 , Set
Config Sysclock = Pll , Prescalea = 1 , Prescalebc = 1_2
Waitms 2
'-------------------------------------------------------------------------------
Config Vport0 = D
$lib "glcd-Nokia3310.lib"
Config Graphlcd = 128x64sed , A0 = Port0.2 , Si = Port0.1 , Sclk = Port0.0
Initlcd

Config Portd.0 = Output
Config Portd.1 = Output
Config Portd.2 = Output
Setfont Font6x8

Do

Cls
Lcdat 1 , 1 , "--------------"
Lcdat 2 , 1 , "--------------"
Wait 1

Cls
Lcdat 1 , 1 , "**************"
Lcdat 2 , 1 , "**************"
Wait 1

Loop
End
$include "font6x8.font"
'-------------------------------------------------------------------------------
 


what do you think about my problem?

Regards
Back to top
View user's profile
Mrshilov

Bascom LCD Guru



Joined: 24 Jan 2009
Posts: 314
Location: Russia

russia.gif
PostPosted: Wed Jun 08, 2016 9:19 pm    Post subject: Reply with quote

Try to use Reset pin.
Back to top
View user's profile
karlos

Bascom Member



Joined: 03 Apr 2015
Posts: 107

PostPosted: Wed Jun 08, 2016 9:25 pm    Post subject: Reply with quote

i dont put reset pin connected to micro,i connect it directly to vcc, and now i can not change the pcb. is there any other way?

thanks
Back to top
View user's profile
Mrshilov

Bascom LCD Guru



Joined: 24 Jan 2009
Posts: 314
Location: Russia

russia.gif
PostPosted: Wed Jun 08, 2016 9:48 pm    Post subject: Reply with quote

If Reset pin connect to Vcc directly, LCD may not start. It must be connect to Vcc with resistor 10k and with capacitor 1mk to GND.
Try to add delay 100ms before Lcdinit.
Back to top
View user's profile
karlos

Bascom Member



Joined: 03 Apr 2015
Posts: 107

PostPosted: Thu Jun 09, 2016 6:30 am    Post subject: Reply with quote

i use 10k and 1mf but the resault is same.
also for sure i connect the reset pin to micro and use it in program and the resault is same.
also i use a 2x16 character lcd and the resault is same.

some times program start and some times it dont start!

and when i delete every lcd command from my program, it start immediately!
i am sure that it is not related to library and it is related to problem of some instruction that related to lcd, with the registers of xmega!

may be Mark know about it and could help me.

thanks
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> Share your working BASCOM-AVR code here All times are GMT + 1 Hour
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
Page 6 of 8

 
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
You cannot attach files in this forum
You cannot download files in this forum