News:

;) This forum is the property of Proton software developers

Main Menu

Universal Graphic Library

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

Previous topic - Next topic

atomix

I'm talking about files Proteus Design.

Pepe

Thanks yasin but as I said the problem was the compiler version, in proton it generates a different code than in positron that makes scribbles appear on the screen.

JohnB

Sounds like you should invest in a the latest compiler!
JohnB

joesaliba

Atomix,

Want to try it on an ST7735 display 128 x 160.

Any particular settings to try?

Joe

Pepe

Don't use it yet because it doesn't accept drawing lines with negative values

atomix

#25
New Release.

Added Displays:
- ST7735  128x160
- ST7789  240x240
- ILI9481  320x480
- ILI9486  320x480
- HX8357D  320x480

Added Interface:
- 8080 MCU 8-bit bus

Modified "Font_Converter.mf" to convert files from native format "GLCD FONT CREATOR"

Added new photos of displays.

Pepe

#26
Atomix
I send you a sample so you can check what is wrong.
The second screen correctly shows the lines using the ST7735_132x162.inc library modified by me.

joesaliba

What I am looking now is to make a compass on an ST7735 128 x 160. I have seen this where they use multiple images and then use the relative image according to direction. This is loaded from an SD card.

As Pepe said, does the last version accept negative numbers?

Regards

Joe

atomix

#28
The new version of the library is fixed.

Pepe

Atomix I don't understand why it says that its library works with lines with negative value if in its library the input parameters are words without sign and it keeps drawing a point instead of a line.

Probe this code

Device = 18F26K22
Declare Xtal = 64
$define LCD_Opt_Disable

Include "Lib\OSC.inc"
$define LCD_USE_TFT_096_80_160

$define LCD_RST    PORTC.1
$define LCD_CS     PORTC.0
$define LCD_DC     PORTC.2
$define LCD_CLK    PORTC.4
$define LCD_DAT    PORTC.3

Include "Lib\LCD\LCD_GFX.inc"

LCD_Init()
Lcd_Width = 132
Lcd_Height = 162
   
       
LCD_Clear()
   
LCD_Color = WHITE

LCD_Line(-108, 78,236,78)
LCD_Line(-108, 82,236,82)

'===================================================================================================
'===================================================================================================
'*******************************
'* Internal Fuse Configuration *
'*******************************
'>>>Int. Fuse configuration<<<

'---------------------------------------------------------------------------------------------------
'**** Added by Fuse Configurator ****
' Use the Fuses Tab to change these settings

Config_Start
  FOSC = INTIO67    ;Internal oscillator bloc
  PLLCFG = On        ;Oscillator multiplied by
  PRICLKEN = On      ;Primary clock enable
  FCMEN = OFF        ;Fail-Safe Clock Monitor disable
  IESO = OFF        ;Oscillator Switchover mode disable
  PWRTEN = On        ;Power up timer enable
  BOREN = OFF        ;Brown-out Reset disabled in hardware and softwar
  BORV = 190        ;VBOR set to 1.90 V nomina
  WDTEN = OFF        ;Watch dog timer is always disabled. SWDTEN has no effect
  WDTPS = 32768      ;1:3276
  CCP2MX = PORTC1    ;CCP2 input/output is multiplexed with RC
  PBADEN = OFF      ;PORTB<5:0> pins are configured as digital I/O on Rese
  CCP3MX = PORTB5    ;P3A/CCP3 input/output is multiplexed with RB
  HFOFST = OFF      ;HFINTOSC output and ready status are delayed by the oscillator stable statu
  T3CMX = PORTC0    ;T3CKI is on RC
  P2BMX = PORTB5    ;P2B is on RB
  MCLRE = INTMCLR    ;RE3 input pin enabled; MCLR disable
  STVREN = On        ;Stack full/underflow will cause Rese
  LVP = OFF          ;Single-Supply ICSP disable
  XINST = OFF        ;Instruction set extension and Indexed Addressing mode disabled (Legacy mode
  Debug = OFF        ;Disable
  Cp0 = OFF          ;Block 0 (000800-003FFFh) not code-protecte
  CP1 = OFF          ;Block 1 (004000-007FFFh) not code-protecte
  CP2 = OFF          ;Block 2 (008000-00BFFFh) not code-protecte
  CP3 = OFF          ;Block 3 (00C000-00FFFFh) not code-protecte
  CPB = OFF          ;Boot block (000000-0007FFh) not code-protecte
  CPD = OFF          ;Data EEPROM not code-protecte
  WRT0 = OFF        ;Block 0 (000800-003FFFh) not write-protecte
  WRT1 = OFF        ;Block 1 (004000-007FFFh) not write-protecte
  WRT2 = OFF        ;Block 2 (008000-00BFFFh) not write-protecte
  WRT3 = OFF        ;Block 3 (00C000-00FFFFh) not write-protecte
  WRTC = OFF        ;Configuration registers (300000-3000FFh) not write-protecte
  WRTB = OFF        ;Boot Block (000000-0007FFh) not write-protecte
  WRTD = OFF        ;Data EEPROM not write-protecte
  EBTR0 = OFF        ;Block 0 (000800-003FFFh) not protected from table reads executed in other block
  EBTR1 = OFF        ;Block 1 (004000-007FFFh) not protected from table reads executed in other block
  EBTR2 = OFF        ;Block 2 (008000-00BFFFh) not protected from table reads executed in other block
  EBTR3 = OFF        ;Block 3 (00C000-00FFFFh) not protected from table reads executed in other block
  EBTRB = OFF        ;Boot Block (000000-0007FFh) not protected from table reads executed in other block
Config_End

'**** End of Fuse Configurator Settings ****
'------------------------------------------------------------------------------------

atomix

You must download the updated library in the first post.

Pepe

I have already downloaded it before asking the question and in Lcd_def it declares
Dim Lcd_X As Word Access
Dim Lcd_Y As Word Access
which is the type that the line parameters take

atomix

#32
Everything should work well with a new library, then you are doing something wrong.

For you, specifically show a fragment of the code where the work with variables is compared SWord and Word.

Pepe

#33
Atomix could try the following coordinates

with the universal library

LCD_Line(-108,78,236,78) good
LCD_Line(-30,-40,160,200)bad
LCD_Line(180,-80,0,170)  good

with the ST7735 library modified by me

ST7735_Line(-108,78,236,78,clWhite)  good
ST7735_Line(-30,-40,160,200,clWhite) good
ST7735_Line(180,-80,0,170,clWhite)  good

I don't think I'm doing something wrong

atomix

New Release.

Fixed work with negative values.

Added more examples.

Thanks to Pepe.

Yasin

Hi @Atomiks. I have a question for the Nokia 5110 display. As far as I understand, the procedure I should use to upload images is "LCD_Bitmap". But I could not show the image that I created the data for. I guess I don't know the point. How should I do?
Best regards.

Pepe

#36
Atomix thanks for solving the problem with the drawing of lines but now it prints the variables wrong
I show you the images with the previous library and the last one using the same source program.

joesaliba

As negative values is solved I will give it a try.


Regards

Joe

atomix

#38
New Release.

Fixed print.
Added more examples.
Increased performance (3 times) in Software SPI (for color displays) mode when pouring White or Black color.

To Yasin:  See minimal.bas (Bitmap_17x17 - Created using the GLCD Font Creator program, then converted font_converter.mf and manually corrected)

top204

#39
A good method of software SPI is to use the Carry flag to read the bit data to transmit. For example:

Proc SPI_Write8(pData As PRODL)
    Dim bIndex As PRODH

    For bIndex = 7 DownTo 0             ' Create a loop for 8-bits
        PinClear MOSI_Pin               ' Default to the MOSI pin low
        Rol pData                       ' Shift the MSB into the Carry flag
        If STATUSbits_C = 1 Then        ' Is the Carry flag set?
            PinSet MOSI_Pin             ' Yes. So set the MOSI pin high
        EndIf
        PinSet SCK_Pin                  ' Set the Clock line high
        DelayCs 1                       ' A small delay between clock cycles
        PinClear SCK_Pin                ' Pull the Clock line low
    Next
EndProc

The above procedure is for Mode 0 SPI. If using an LSB protocol, use the Ror command. The use of the PRODL and PRODH SFRs as aliases makes sure they are RAM bankless, thus making the procedure even more efficient and a lot faster, where-ever it is placed or called from. Also a downward For-Next loop is extremely efficient.