News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

Universal Graphic Library

Started by atomix, Mar 09, 2022, 05:05 PM

Previous topic - Next topic

Amateurtje

Quote from: atomix on Sep 18, 2023, 06:33 PMIn SPI operating mode, data is transferred very slowly. The only option is to use the 8-bit 8080 interface.

Hi Atomix,

Thanks for your answer. It is a good idea to go to that.
Is there is 3,5 inch or preferably 4 inch display that can be used with your script?

Secondly, I just ran into another problem. I introduced a gradient (LCD_Gradient(byte)) and only setting this, the complete screen goes goes crazy. Amongst others, for example the value of LCD_fontwidth is set to 0 when I introduce this in a completely different procedure.. Do you have any idea? It would be nice to use this gradient while it looks very nice.

trastikata

Not sure about the chip you are using, but wouldn't Data Enable (DE) after updating the area of interest in the graphic RAM prevent exactly that flickering?

Amateurtje

#162
Quote from: trastikata on Sep 18, 2023, 08:16 PMNot sure about the chip you are using, but wouldn't Data Enable (DE) after updating the area of interest in the graphic RAM prevent exactly that flickering?

My chip is the 18F46k22.
I do not understand what you mean with DE (data Enabled). I can not find that. Sorry.

I will try to reduce my script to a basic script to see if I can find it, or reduce it, to be able to give a better description.. For now, I think my first goal is to find another screen which I can use and make another pcb. I really have trouble finding a reasonable sized screen which has a PCB so I can mount it (like the screen with the red pcb). Besides of the speed (and this gradient) it is really nice how this all works....Big compliments..

And, like always, you get another idea after typing  here:
- Can we drive this screen? Is this a possible parallel screen we can use? This is based on the ili9486 and I think/see it is in the driver, isn't it? (just to be sure)
https://www.ebay.com/itm/295460317055?_trkparms=amclksrc%3DITM%26aid%3D1110006%26algo%3DHOMESPLICE.SIM%26ao%3D1%26asc%3D20201210111314%26meid%3Da2854edfc66642e2ae31873738da82a0%26pid%3D101195%26rk%3D4%26rkt%3D12%26sd%3D175065897602%26itm%3D295460317055%26pmt%3D1%26noa%3D0%26pg%3D4429486%26algv%3DSimplAMLv11WebTrimmedV3MskuWithLambda85KnnRecallV1V2V4ItemNrtInQueryAndCassiniVisualRankerAndBertRecallWithVMEV3CPCAuto%26brand%3DUnbranded&_trksid=p4429486.c101195.m1851&amdata=cksum%3A295460317055a2854edfc66642e2ae31873738da82a0%7Cenc%3AAQAIAAABYObhgc4Nk8%252BdtAwOww4FKLaj%252FQ5qqgDlQCuqZA43WcPFUWDERCUugbbOk7XQv0JXlBfqCg2xKF3WcPghxGMFw2oSlXvfExEaMYr7I7LmrHcP6czY1wIMt0ORyKiCWt95xldincyyBx3g%252BNDW%252B%252FhWUgTaBhK6xAm%252BJIbCOMehu%252BdwVNu6%252F6bQkbXubDhBuHsPpw9vaqkdBnUaX191bHETAVjK5G0H%252Bf%252FbfskX0C1v%252FiN3rPQgbd8R6OEhET6XIWDAIf8RdzGpATt4uhhFvD%252BsS310xJ0zSVnzlKds2ls%252FcR7UxPs8FeFYUrc4eBWnIbaE1Y4mYGe0o0V8QQq5ZzjifR1bLHsKizi5i146Df%252FHvzDz%252Fw9RUZDm4CqtpoHuFVkCrubLgRDu6nQFSwAQ2cyVcIv%252FKA0tdSi%252Buc6juzg%252BzIfnfP3wTF2XIw77DEde3r9g3mfEgVa3L9iqFFbb3jv2Z9w%253D%7Campid%3APL_CLK%7Cclp%3A4429486

trastikata

Quote from: Amateurtje on Sep 18, 2023, 08:31 PM
Quote from: trastikata on Sep 18, 2023, 08:16 PMNot sure about the chip you are using, but wouldn't Data Enable (DE) after updating the area of interest in the graphic RAM prevent exactly that flickering?

My chip is the 18F46k22.
I do not understand what you mean with DE (data Enabled). I can not find that. Sorry.

Some time ago I've written library, for ILI9341 I think it was, and I have a vague recollection that there was a Data Enable input, which allowed you first to update the GRAM and then update the LED drivers, thus displaying the new GRAM data. But I might be mixing things, I have to check again what I did at the time.

atomix

Yes, this screen should work.

Regarding the gradient, you can attach a file with an example.

atomix

New Release.

Fixed that very large font was not displayed correctly.
Fixed Font_Converter.mf
Added bigfont.bas example

atomix

#166
New Release.

Added driver for new display ST7796S (4.0 inch 320x480)

tnencon

Quote from: atomix on Oct 19, 2023, 02:04 PMNew Release.

Added driver for new display ST7796S (4.0 inch 320x480)
Do we need to make changes to the existing library for ST7789V2 (1.54 inch 240x240) SPI LCD?
Thank you Atomix

Oskar-svr

Hello Atomix, thank you very much for your contribution, could you upload the new update or where can I download them, greetings

Yasin

Hello. In this regard, updates are always made to the first page. So the files in the first message are always up-to-date.
Best regards.

Dompie

...normally yes, but now the link to the UGL download has disappeared from the first post (or am I really looking that bad?).

@atomix could you put the UGL link back in the first post?

Johan

Pepe

It's in the first post

Dompie

pffffffffffff, thank you, I finally found it. It's clear I need to go to the ophthalmologist.

Johan

tnencon

#173
Greetings Atomix, I want to change the background color depending on the ADC value in the program I wrote, but when I do not use the rectfill command, the background color remains black. Should I use a different command in the program or change my algorithm?
Thanks...

Device 18F27Q43
Declare Xtal = 64
Declare Create_Coff On
'***********************************************************************
Config_Start
FEXTOSC = OFF    'External Oscillator Selection->Oscillator not enabled
RSTOSC = HFINTOSC_64MHZ    'Reset Oscillator Selection->HFINTOSC with HFFRQ = 64 MHz and CDIV = 1:1
CLKOUTEN = OFF    ' Clock out Enable bit->CLKOUT function is disabled
PR1WAY = On    ' PRLOCKED One-Way Set Enable bit->PRLOCKED Bit can be cleared And Set only once
CSWEN = OFF    ' Clock Switch Enable bit->The NOSC And NDIV bits cannot be changed by user software
FCMEN = OFF    ' Fail-Safe Clock Monitor Enable bit->Fail-Safe Clock Monitor disabled

MCLRE = INTMCLR    ' MCLR Enable bit->If LVP = 0, MCLR Pin function is port defined function; If LVP =1, RE3 pin fuction is MCLR
PWRTS = PWRT_OFF    ' Power-up timer selection bits->PWRT is disabled
MVECEN = OFF    ' Multi-vector Enable bit->Interrupt contoller does not use vector table To prioritze interrupts
IVT1WAY = On    ' IVTLOCK Bit One-way Set Enable bit->IVTLOCKED Bit can be cleared And Set only once
LPBOREN = OFF    ' Low Power BOR Enable bit->Low-Power BOR disabled
BOREN = OFF    ' Brown-out Reset Enable bits->Brown-out Reset disabled

BORV = VBOR_2P85    ' Brown-out Reset Voltage Selection bits->Brown-out Reset Voltage (VBOR) Set To 2.8V
ZCD = OFF    ' ZCD Disable bit->ZCD module is disabled. ZCD can be enabled by setting the ZCDSEN Bit of ZCDCON
PPS1WAY = On    ' PPSLOCK Bit One-Way Set Enable bit->PPSLOCKED Bit can be cleared And Set only once; PPS registers remain locked after one clear/set cycle
STVREN = OFF    ' Stack Full/Underflow Reset Enable bit->Stack full/underflow will not cause Reset
LVP = On'OFF    ' Low Voltage Programming Enable bit->HV On MCLR/VPP must be used For programming
XINST = OFF    ' Extended Instruction Set Enable bit->Extended Instruction Set And Indexed Addressing Mode disabled

WDTCPS = WDTCPS_31    ' WDT Period selection bits->Divider ratio 1:65536; software control of WDTPS
WDTE = OFF    ' WDT operating mode->WDT Disabled; SWDTEN is ignored

WDTCWS = WDTCWS_7    ' WDT Window Select bits->window always open (100%); software control; keyed access not required
WDTCCS = SC    ' WDT Input clock selector->Software Control

BBSIZE = BBSIZE_512    ' Boot Block Size selection bits->Boot Block size is 512 words
BBEN = OFF    ' Boot Block Enable bit->Boot block disabled
SAFEN = OFF    ' Storage Area Flash Enable bit->SAF disabled
Debug = OFF    ' Background Debugger->Background Debugger disabled

WRTB = OFF    ' Boot Block Write Protection bit->Boot Block not Write protected
WRTC = OFF    ' Configuration Register Write Protection bit->Configuration registers not Write protected
WRTD = OFF    ' Data EEPROM Write Protection bit->Data EEPROM not Write protected
WRTSAF = OFF    ' SAF Write protection bit->SAF not Write Protected
WRTAPP = OFF    ' Application Block write protection bit->Application Block not write protected

Cp = OFF    ' PFM And Data EEPROM Code Protection bit->PFM And Data EEPROM Code protection disabled

Config_End
'***********************************************************************
OSCCON1 = $60
OSCCON3 = 0
OSCEN = 0
OSCFRQ = $08
OSCTUNE = 0
ACTCON = 0

LATA = 0
LATB = 0
LATC = 0

TRISA = 3
TRISB = $0F
TRISC = 0
PORTB = $FF

ANSELC = 0
ANSELB = 0
ANSELA = $03

WPUE = 0
WPUB = 0
WPUA = 0
WPUC = 0

RB1I2C = 0
RB2I2C = 0
RC3I2C = 0
RC4I2C = 0


ODCONE = 0
ODCONA = 0
ODCONB = 0
ODCONC = 0


SLRCONA = $FF
SLRCONB = $FF
SLRCONC = $FF


INLVLA = 0
INLVLB = 0
INLVLC = 0
INLVLE = 0

FVRCON = $8B

ADCON1 = 0
ADCON2 = 0
ADCON3 = 0
ADCON0 = $94
ADREF = $03
''==========================================================
Proc ADC_Read(Channel As Byte),Word
    ADPCH = Channel
    ADCON0bits_ADON = 1
          DelayUS 200
          'Start the conversion
          ADCON0bits_GO = 1
          While ADCON0bits_GO = 1 :      Wend        ' Poll the GO_DONE flag for completion of conversion
          ADCON0bits_ADON = 0                        ' Disable the ADC, to save power
          ADPCH = $3B                                'Set the ADC channel to AVss
          Result.LowByte = ADRESL
          Result.HighByte = ADRESH
EndProc
''==========================================================
Proc Switch_Read()
    Switch_1_Select = 0
    Switch_2_Select = 1
    DelayMS 1   
    Switch_1 = 15-(PORTB & %00001111)
    Switch_1_Select = 1
    Switch_2_Select = 0
    DelayMS 1   
    Switch_2 = 15-(PORTB & %00001111)
           
EndProc
''==========================================================
'------------------------------- Use Displays -------------------------------
$define LCD_USE_TFT_130_240_240

$define LCD_RST    PORTC.0
$define LCD_CS      PORTC.1
$define LCD_DC      PORTC.2
$define LCD_CLK    PORTC.3 
$define LCD_DAT    PORTC.4
$define LCD_CLK_HIGH        ' set for display 1.3 inches 240x240

'--------------------------------- Library ----------------------------------
Include "Lib\LCD\LCD_GFX.inc"
Include "Lib\LCD\Font\Std_5x8.inc"
Include "Lib\LCD\Font\SegoeUI_13x16.inc"
'----------------------------- Select Display -------------------------------
LCD_Select(LCD_TFT_130_240_240)
'==========================================================

LCD_Init()
Symbol Switch_1_Select = LATB.4
Symbol Switch_2_Select = LATB.5
Dim Switch_1 As Byte = 0
Dim Switch_2 As Byte = 0
Dim Sample_Count As Byte = 0
Dim Channel_No As Byte = 0
Dim ADC_Value As Word = 0
Dim Analog_Value[2] As Word = 0
Dim Temp As Dword = 0
Set LATC.5


    LCD_Rotation(0)
    LCD_Clear()
    LCD_Color = WHITE'GREY
'    LCD_RectFill(0,0,240,240)   
    Lcd_Zoom = 1
    LCD_Rotation(2)
    Lcd_Zoom = 4
    LCD_SetFont(Std_5x8)
MAIN:
    Switch_Read()
    For Channel_No = 0 To 1
        For Sample_Count = 0 To 49
            ADC_Value = ADC_Read(Channel_No)
            Temp = Temp + ADC_Value
        Next Sample_Count
        Analog_Value[Channel_No] = (Temp/50)
        Temp = 0
    Next Channel_No   
    Temp = 0
        If Analog_Value[0]<2000 Then LCD_Color = WHITE  'LCD_BackColor = WHITE     
        If Analog_Value[0]>1999 And Analog_Value[0]<3000 Then LCD_Color = GREEN 'LCD_BackColor = GREEN       
        If Analog_Value[0]>2999 And Analog_Value[0]<3750 Then LCD_Color = YELLOW 'LCD_BackColor = YELLOW
        If Analog_Value[0]>3749 Then LCD_Color = CYAN 'LCD_BackColor = CYAN
            LCD_BackColor = WHITE
        LCD_TextColor( BLACK,LCD_Color)
        LCD_RectFill(0,0,240,40)
        LCD_RectFill(0,168,240,70)
        Print At 1,40," AN0:",#Analog_Value[0],"    "
        Print At 1,72," AN1:",#Analog_Value[1],"    "
        Print At 1,104," SW-1:",Dec1 Switch_1,"    "
        Print At 1,136," SW-2:",Dec1 Switch_2,"    "       
 
GoTo MAIN

atomix


Your code does the job correctly without flickering.

Alternatively, if you first fill the entire background and then draw transparent text, the screen will flicker.

Dompie

.....and there is a newer version of the UGL library in the first post.
@atomix I presume not important changes.

Johan

atomix

Added example bigfont.bas

Teo

Hi atomix ,
Is it possible to display proportional fonts ?
Thanks in advance ,
Teo

atomix

Yes it is possible.

Just convert the font use Font_Converter.mf with the parameter - "1 - Proportional"


f1dyo

hello, good job; what syntax to plot a point at x,y coordinates? THANKS ...