News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

print at

Started by Pepe, Mar 25, 2022, 12:18 AM

Previous topic - Next topic

Pepe

I am using print at in a graphics library, is it limited to variables of type byte?

Print At 280,22,"Hello"

It does not print in that position because a value greater than 255 masks it

F1_000087 equ $ ; in [Test.bas] Print At 280,22,"Hello"
    movlw 24
    movwf GEN,0
    movlw 22
    call __GLCD_Cursor_
    movlw 72
    call __Print_
    movlw 101
    call __Print_
    movlw 108
    call __Print_
    call __Print_
    movlw 111
    call __Print_

Or do I have to solve as follows?

LCD_Pos(22,280): Print "Hello"

F1_000080 equ $ ; in [TEST.BAS] Lcd_X = 22   :  Lcd_Y = 280
    clrf Lcd_XH,0
    movlw 22
    movwf Lcd_X,0
    movlw 1
    movwf Lcd_YH,0
    movlw 24
    movwf Lcd_Y,0
F1_000081 equ $ ; in [Test.bas] Print "Hello"
    movlw 72
    call __Print_
    movlw 101
    call __Print_
    movlw 108
    call __Print_
    call __Print_
    movlw 111
    call __Print_

atomix

I wanted to say about this restriction to Les, but you were ahead of me.

top204

#2
Place the declares:

Declare LCD_Type = Graphic        ' Inform the compiler that we're using a graphic LCD
Declare LCD_X_Res = 320            ' The X size of the LCD's display
Declare LCD_Y_Res = 240            ' The Y size of the LCD's display


This will then load system variables GEN2 and GEN2H with the X position and GEN with the Y position. For example:

Print At 40, 300, IHex4 wCount

Will produce the assembler code for Print At:

movlw 40
movwf GEN,0
movlw 1
movwf GEN2H,0
movlw 44
movwf GEN2,0
rcall __GLCD_Cursor_


I will need to add a piece in the 8-bit compiler to cater for Y positions greater than 8-bit. It is already in place on the Positron16 compiler for greater resolutions. The reason for minimising RAM usage was because the devices back then had a maximum of approx 400 bytes of RAM. It is only recently that RAM has increased on the 8-bit devices.

The LCD_X_Res and LCD_Y_Res declares were first introduced for the Toshiba graphic LCDs, back in the early 2000s, because they were the only ones at that time that had a greater resolution than 128x64. They are in the manual's Toshiba graphic LCD section.