Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

vport xtiny

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
SZTRAD

Bascom Member



Joined: 30 Dec 2019
Posts: 118

blank.gif
PostPosted: Fri Jan 08, 2021 12:49 pm    Post subject: vport xtiny Reply with quote

Hello Mark
config Vport not supported for xtiny?
Thank you for answer
Regards

(BASCOM-AVR version : 2.0.8.3 )
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5207
Location: Holland

blank.gif
PostPosted: Fri Jan 08, 2021 1:52 pm    Post subject: Reply with quote

from the help topic xtiny : The xmega Vports are different. They can change and map ports dynamically. In Xtiny they are static mapped.
There is a paragraph about ports in the xtiny. you best read it.
But in short there is no need for config vport because it is not possible to map these vports. The vports are fixed in xtiny.
So PORTA has many regs :
PORTA_OUT
with an alias for PORTA

Then PORT0 which is the VPORTA. PORT0 because i used that in Xmega. And VPORT to make it clear it is an virtual port that writes to PORTA.
That is i hope it is al clear Very Happy

Xtiny is a reduced xmega so some good features are missing.

_________________
Mark
Back to top
View user's profile Visit poster's website
SZTRAD

Bascom Member



Joined: 30 Dec 2019
Posts: 118

blank.gif
PostPosted: Fri Jan 08, 2021 3:17 pm    Post subject: Reply with quote

Thanks for the reply, but now I'm more confused. I'm sorry I sent that question to support as well.
For xtina, it doesn't matter which, there is only one paragraph in which they write about mapping to the register and a table where it says what where it is (before I ask so I read).
So you actually created in memory the place where you copied the input and output image, and if the program was addressed to a given port, operations were done in this artificial register. This should not be necessary for xtina and writing and reading should take place synchronously if I understand the catalog sheet correctly.

What I'm talking about with the nokia diplay library you just used the vport approach (I don't know why) when the display output was meaningless so I wanted to use the same procedure for xtina but I came across a compiler that won't allow me to write any.
When it's worst, I'll write the driver myself, but why, if it's already created and works for others.
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5207
Location: Holland

blank.gif
PostPosted: Fri Jan 08, 2021 3:46 pm    Post subject: Reply with quote

Quote:
Thanks for the reply, but now I'm more confused. I'm sorry I sent that question to support as well.

questions posted to the forum and support : at some stage one is ignored.
You should be more specific too. you asked about VPORT. And that is explained in both the data sheet and the bascom help.

ports : in AVR they have a low IO register address so one can use SBI/CBI instructions which do not take any register.
in xmega some ports have a high IO address which result in the fact that you can not use SBI/CBI. you can use OUT/IN with a register.
For some higher address it is even worse : here you need STS which take more space too.
So Atmel introduced virtual port registers at the low addresses. these registers map to say PORTA and allow to use the CBI/SBI instructions because the virtual port register has a low IO address.
In Xmega you could even chose for VPORTA which port it would map to. To PORTQ for example.
In Xtiny we have a similar situation. But with the difference (since there are so little ports) that we can not chose the port for a virtual port. It is fixed.


Quote:
What I'm talking about with the nokia diplay library you just used the vport approach (I don't know why) when the display output was meaningless

because sbi/cbi do not need a register. And IN/OUT require a register. This register is r23 but is often used so it would mess up a lib when the lib is not changed.
So the better option is to use the virtual port registers.

Quote:
use the same procedure for xtina but I came across a compiler that won't allow me to write any.

it is xtiny. and what does this mean? you came across a compiler ? and wont allow me to write any? all the options are there.
if your problem is the lib you should post about that.
i have no idea which lib you mean, which example , etc. please be more clear.
as always : show the code
no offense but if this is not clear i doubt writing your own driver will work.

_________________
Mark
Back to top
View user's profile Visit poster's website
SZTRAD

Bascom Member



Joined: 30 Dec 2019
Posts: 118

blank.gif
PostPosted: Sat Jan 09, 2021 3:54 pm    Post subject: Reply with quote

Thank you, Mark
I expressed myself in a wrong way . That's what the language does.
I need to build a simple device for children in extracurricular activities to try different measurements. I had about 30 displays left marked Nokia5110 and I wanted to use them. Unfortunately, the driver written by Mrshilov refuses to cooperate.
I'm using a sample with xtiny 1606 (3216 will be used) and the display shows different things just not what I want.
Code:

-------------------------------------------------------------------------------
'                         Nokia-3310 LCD Test
'                              BASCOM-AVR
'                             Mrshilov 2014
'===============================================================================
$regfile = "atxtiny1606.dat"
$crystal = 3333333
$hwstack = 32
$swstack = 250
$framesize = 250

'*******************************************************************************
$lib "glcd-Nokia3310.lib"

       Config Sysclock = 16_20mhz , Prescale = 6

Config Graphlcd = 128x64sed , Rst = Portb.1 , Cs1 = Portb.2 , A0 = Portb.3 , Si = Portb.4 , Sclk = Portb.5

' Rst & Cs1 is optional

'Const Negative_lcd = 1                                      'Inverting screen
'Const Rotate_lcd = 1                                        'Rotate screen to 180°


Dim I As Byte , N As Word , M As Byte
Dim Text As String * 8

'***************************** Program *****************************************
Initlcd
Cls

Setfont Font6x8
Lcdat 2 , 16 , "NOKIA-3310"
Lcdat 4 , 30 , "84x48"
Wait 5
Cls
wait 2

'Showpic 0 , 0 , Walker
'Wait 2
'Cls

Setfont Font6x8
Lcdat 3 , 1 , "--------------"
Lcdat 4 , 22 , "1 March"
Lcdat 5 , 1 , "   Saturday   " , 1
Lcdat 6 , 31 , "2014"
wait 10
Setfont Font12x16dig
I = 20

Do
Incr I
If I > 59 Then I = 20
Text = Str(i)
Lcdat 1 , 1 , "23:" ; Text
Waitms 500
Lcdat 1 , 1 , "23 " ; Text
If I.0 = 1 Then Showpic 66 , 1 , Ring Else Lcdat 1 , 66 , "  "
Waitms 500

'----------------------------------------------- Contrast regulation
'For m = 175 To 210
'   Glcdcmd 33 : Glcdcmd m
'   Waitms 100
'Next

'Glcdcmd 33 : Glcdcmd 200                                    'Normal Contrast

Loop
End

'===============================================================================
Ring:
$bgf "Ring.bgf"
Walker:
$bgf "Walker.bgf"
$include "font6x8.font"
$include "font12x16dig.font"


At night I got bored (the older ones can't sleep in any way) and I tried to pull the controller I have on other displays and it still works and shows what it has. I use standard Bascom features so it's easy to understand.
That's why I asked about Vport, but after the explanation, I understood that this is not the way.
So if anyone needs it, this program works with xtiny and shows what it has.
Code:

   '-------------------------------------------------------------------------------
'
'===============================================================================
$regfile = "atxtiny1606.dat"
$crystal = 20000000
$hwstack = 48
$swstack = 150
$framesize = 150

'*******************************************************************************
'LCD PCD8544 řízení
 'Nokia 5510

Config Sysclock = 16_20mhz , Prescale = 1

Config Portb = Output



' -------- konfigurace SPI

Config Spi = Soft , Din = Portb.0 , Dout = Portb.4 , Ss = None , Clock = Portb.5

' --------  pins LCD
'Sclk portb.5
'Sdin portb.4
'D / C portb.3
'Sce portb.2
'Reset portb.1

' ------- promenne
Dim x_poz As Byte , y_poz As Byte , Yy As Byte , Xx As Byte , zapis As Byte
dim zobrazit As String*84

' ------- Stałe dla ustawien LCD
Const Expcf8544prikaz = &H21                                         'extended command mode
Const Contrmid = &HC8                                       'LCD contract medium level(after Expcf8544prikaz)
Const Tempcomp2 = &H06                                      'temperature compensation (after Expcf8544prikaz)
Const Bias48 = &H13                                         'bias 1:48 for LCD (after Expcf8544prikaz)
Const Normcmd = &H20                                        'normal command mode
Const Lcdinv = &H0D                                         'inverted LCD screen(after Normcmd)
Const Lcdnorm = &H0C                                        'normal LCD screen(after Normcmd)
Const Lcdxaddr0 = &H80                                      'set X addr of RAM to 0(after Normcmd)
Const Lcdpdown = &H24                                       'LCD in power down mode
Const Lcdact = &H20                                         'LCD in active mode

' -------  procedury
Declare Sub pcf8544prikaz(byval prikaz As Byte)
Declare Sub pcf8544_inicializace
Declare Sub pcf8544_mazani
Declare Sub pcf8544_adresa(x_adr As Byte , y_adr As Byte)
Declare Sub pcf8544_lokace(byval x_lok As Byte , Byval y_lok As Byte)
Declare Sub pcf8544_zobrazeni(byval zobrazit As String)




' ------- zkouska zobrazeni ----------------------------

call pcf8544_inicializace





call pcf8544_mazani
call pcf8544_lokace (0 , 0)
call pcf8544_zobrazeni ("hhhbcdefghijklmnopqrstuvwxyz")
Wait 1

call pcf8544_lokace (0 , 2)
call pcf8544_zobrazeni ("ABCDEFGHIJKLMNPQRSTUVWXYZ")
Wait 1

call pcf8544_lokace (0 , 4)
call pcf8544_zobrazeni ("0123456789")
Wait 5

call pcf8544prikaz (Lcdinv)
Wait 5
call pcf8544prikaz (Lcdnorm)
Wait 1

End                                                         'end program


' ------ pcf8544prikaz -----
Sub pcf8544prikaz(byval prikaz As Byte)
Reset portb.3                                               'command mode
Spiout prikaz , 1
Set portb.3                                                 'data mode
End Sub

' ------ Tlcdinit ------
Sub pcf8544_inicializace
Spiinit
Reset portb.2                                               'LCD enable
Reset portb.1                                               'RESET LCD display
Set portb.1                                                 '
call pcf8544prikaz (Expcf8544prikaz)                                                 '
call pcf8544prikaz (Contrmid)                                               '"LCD commands constants"
call pcf8544prikaz (Tempcomp2)                                              '
call pcf8544prikaz (Bias48)                                                 '
call pcf8544prikaz (Normcmd)                                                '
call pcf8544prikaz (Lcdnorm)                                                '
call pcf8544_mazani                                                        '
End Sub

 ' -------- pcf8544_mazani -------
Sub pcf8544_mazani
Local data_ascii As Word
call pcf8544prikaz (Normcmd)
call pcf8544prikaz (Lcdnorm)
call pcf8544prikaz (Lcdxaddr0)
zapis = 0
For data_ascii = 0 To 503                                        '84x6  clear LCD
  Spiout zapis , 1
Next
End Sub

' -------- pcf8544_adresa(x_adr , y_adr) ---------
Sub pcf8544_adresa(x_adr As Byte , y_adr As Byte)
Reset portb.3                                               'command mode
zapis = y_adr + &H40                                         'sets 0-5 Y-addr of RAM
Spiout zapis , 1
zapis = x_adr * &H06                                         'sets 0-13 X-addr of RAM
zapis = zapis + &H80
Spiout zapis , 1
Set portb.3                                                 'data mode
End Sub

' --------- pcf8544_lokace(x_poz, y_poz) --------
Sub pcf8544_lokace(byval x_lok As Byte , Byval y_lok As Byte)
x_poz = x_lok
y_poz = y_lok
call pcf8544_adresa (x_poz , y_poz)
End Sub

' --------- pcf8544_zobrazeni --------
Sub pcf8544_zobrazeni(zobrazit As String*255)
Local pozice As Word , data_ascii As Word , znak As String *84
For Xx = 1 To Len(zobrazit)
 znak = Mid(zobrazit , Xx , 1)
 Select Case znak
  Case " " : pozice = 0
  Case "a" : pozice = 1
  Case "b" : pozice = 2
  Case "c" : pozice = 3
  Case "d" : pozice = 4
  Case "e" : pozice = 5
  Case "f" : pozice = 6
  Case "g" : pozice = 7
  Case "h" : pozice = 8
  Case "i" : pozice = 9
  Case "j" : pozice = 10
  Case "k" : pozice = 11
  Case "l" : pozice = 12
  Case "m" : pozice = 13
  Case "n" : pozice = 14
  Case "o" : pozice = 15
  Case "p" : pozice = 16
  Case "q" : pozice = 17
  Case "r" : pozice = 18
  Case "s" : pozice = 19
  Case "t" : pozice = 20
  Case "u" : pozice = 21
  Case "v" : pozice = 22
  Case "w" : pozice = 23
  Case "x" : pozice = 24
  Case "y" : pozice = 25
  Case "z" : pozice = 26
  Case "A" : pozice = 27
  Case "B" : pozice = 28
  Case "C" : pozice = 29
  Case "D" : pozice = 30
  Case "E" : pozice = 31
  Case "F" : pozice = 32
  Case "G" : pozice = 33
  Case "H" : pozice = 34
  Case "I" : pozice = 35
  Case "J" : pozice = 36
  Case "K" : pozice = 37
  Case "L" : pozice = 38
  Case "M" : pozice = 39
  Case "N" : pozice = 40
  Case "O" : pozice = 41
  Case "P" : pozice = 42
  Case "Q" : pozice = 43
  Case "R" : pozice = 44
  Case "S" : pozice = 45
  Case "T" : pozice = 46
  Case "U" : pozice = 47
  Case "V" : pozice = 48
  Case "W" : pozice = 49
  Case "X" : pozice = 50
  Case "Y" : pozice = 51
  Case "Z" : pozice = 52
  Case "0" : pozice = 53
  Case "1" : pozice = 54
  Case "2" : pozice = 55
  Case "3" : pozice = 56
  Case "4" : pozice = 57
  Case "5" : pozice = 58
  Case "6" : pozice = 59
  Case "7" : pozice = 60
  Case "8" : pozice = 61
  Case "9" : pozice = 62
  Case "š" : pozice = 63
  Case "ć" : pozice = 64
  Case "ę" : pozice = 65
  Case "ł" : pozice = 66
  Case "ń" : pozice = 67
  Case "ó" : pozice = 68
  Case "?" : pozice = 69
  Case "?" : pozice = 70
  Case "ż" : pozice = 71
  Case "Ł" : pozice = 72
  Case "?" : pozice = 73
  Case "?" : pozice = 74
  Case "Ż" : pozice = 75
  Case "^" : pozice = 76
  Case "[" : pozice = 77
  Case "]" : pozice = 78
  Case "{" : pozice = 79
  Case "}" : pozice = 80
  Case Else : Goto Exit_case
 End Select
 Restore Ascii
 Set portb.3
 pozice = pozice * 6
 If pozice <> 0 Then
  For data_ascii = 1 To pozice                                     'shift to character pointer
  Read zapis
  Next
 End If
  For Yy = 1 To 6                                           'printing character
  Read zapis : Spiout zapis , 1                               '6x8 bits
  Next
Exit_case:
Next
End Sub

'  ------- D A T A -------
Ascii:
Data &H00 , &H00 , &H00 , &H00 , &H00 , &H00 , &H30 , &H4A , &H4A , &H52 , &H7C , &H00 , &H3F , &H48 , &H44 , &H44
Data &H38 , &H00 , &H38 , &H44 , &H44 , &H44 , &H28 , &H00 , &H38 , &H44 , &H44 , &H48 , &H7F , &H00 , &H38 , &H54
Data &H54 , &H54 , &H18 , &H00 , &H00 , &H04 , &H7E , &H05 , &H00 , &H00 , &H0C , &H52 , &H52 , &H4A , &H3C , &H00
Data &H7F , &H08 , &H04 , &H04 , &H78 , &H00 , &H00 , &H44 , &H7D , &H40 , &H00 , &H00 , &H00 , &H40 , &H44 , &H3D
Data &H00 , &H00 , &H7F , &H20 , &H10 , &H28 , &H44 , &H00 , &H00 , &H41 , &H7F , &H40 , &H00 , &H00 , &H7C , &H04
Data &H18 , &H04 , &H7C , &H00 , &H7C , &H08 , &H04 , &H04 , &H78 , &H00 , &H38 , &H44 , &H44 , &H44 , &H38 , &H00
Data &H7C , &H14 , &H24 , &H24 , &H18 , &H00 , &H18 , &H24 , &H24 , &H14 , &H7C , &H00 , &H7C , &H04 , &H04 , &H08
Data &H00 , &H00 , &H08 , &H54 , &H54 , &H54 , &H20 , &H00 , &H04 , &H3F , &H44 , &H40 , &H00 , &H00 , &H3C , &H40
Data &H40 , &H40 , &H3C , &H00 , &H1C , &H20 , &H40 , &H20 , &H1C , &H00 , &H3C , &H40 , &H30 , &H40 , &H3C , &H00
Data &H44 , &H28 , &H10 , &H28 , &H44 , &H00 , &H0C , &H50 , &H50 , &H48 , &H3C , &H00 , &H44 , &H64 , &H54 , &H4C
Data &H44 , &H00 , &H7C , &H12 , &H11 , &H12 , &H7C , &H00 , &H7F , &H49 , &H49 , &H49 , &H36 , &H00 , &H3E , &H41
Data &H41 , &H41 , &H22 , &H00 , &H7F , &H41 , &H41 , &H41 , &H3E , &H00 , &H7F , &H49 , &H49 , &H49 , &H41 , &H00
Data &H7F , &H09 , &H09 , &H09 , &H01 , &H00 , &H3E , &H41 , &H49 , &H49 , &H3A , &H00 , &H7F , &H08 , &H08 , &H08
Data &H7F , &H00 , &H00 , &H41 , &H7F , &H41 , &H00 , &H00 , &H20 , &H41 , &H41 , &H41 , &H3F , &H00 , &H7F , &H08
Data &H14 , &H22 , &H41 , &H00 , &H7F , &H40 , &H40 , &H40 , &H40 , &H00 , &H7F , &H02 , &H04 , &H02 , &H7F , &H00
Data &H7F , &H04 , &H08 , &H10 , &H7F , &H00 , &H3E , &H41 , &H41 , &H41 , &H3E , &H00 , &H7F , &H09 , &H09 , &H09
Data &H06 , &H00 , &H3E , &H41 , &H51 , &H61 , &H7E , &H00 , &H7F , &H09 , &H19 , &H29 , &H46 , &H00 , &H06 , &H49
Data &H49 , &H49 , &H30 , &H00 , &H01 , &H01 , &H7F , &H01 , &H01 , &H00 , &H3F , &H40 , &H40 , &H40 , &H3F , &H00
Data &H1F , &H20 , &H40 , &H20 , &H1F , &H00 , &H7F , &H20 , &H10 , &H20 , &H7F , &H00 , &H63 , &H14 , &H08 , &H14
Data &H63 , &H00 , &H03 , &H04 , &H78 , &H04 , &H03 , &H00 , &H61 , &H51 , &H49 , &H45 , &H43 , &H00 , &H3E , &H51
Data &H49 , &H45 , &H3E , &H00 , &H00 , &H42 , &H7F , &H40 , &H00 , &H00 , &H42 , &H61 , &H51 , &H49 , &H46 , &H00
Data &H22 , &H41 , &H49 , &H49 , &H36 , &H00 , &H18 , &H14 , &H12 , &H7F , &H10 , &H00 , &H27 , &H45 , &H45 , &H45
Data &H39 , &H00 , &H3E , &H49 , &H49 , &H49 , &H32 , &H00 , &H61 , &H11 , &H09 , &H05 , &H03 , &H00 , &H36 , &H49
Data &H49 , &H49 , &H36 , &H00 , &H26 , &H49 , &H49 , &H49 , &H3E , &H00 , &H30 , &H4A , &H4A , &HD2 , &H7C , &H00
Data &H38 , &H44 , &H46 , &H45 , &H28 , &H00 , &H38 , &H54 , &H54 , &HD4 , &H18 , &H00 , &H00 , &H49 , &H7F , &H44
Data &H00 , &H00 , &H7C , &H08 , &H06 , &H05 , &H78 , &H00 , &H38 , &H44 , &H46 , &H45 , &H38 , &H00 , &H08 , &H54
Data &H56 , &H55 , &H20 , &H00 , &H44 , &H64 , &H56 , &H4D , &H44 , &H00 , &H44 , &H64 , &H55 , &H4C , &H44 , &H00
Data &H10 , &H7F , &H44 , &H42 , &H40 , &H00 , &H04 , &H4A , &H4B , &H4A , &H30 , &H00 , &H62 , &H56 , &H4B , &H46
Data &H42 , &H00 , &H61 , &H59 , &H49 , &H4D , &H43 , &H00 , &H7E , &H43 , &H41 , &H43 , &H7E , &H00 , &H00 , &H00
Data &H00 , &H7F , &H7F , &H00 , &H00 , &H00 , &H7F , &H7F , &H7F , &H00 , &H00 , &H7F , &H7F , &H7F , &H7F , &H00
Data &H7F , &H7F , &H7F , &H7F , &H7F , &H00


Also why the IDE warns of an error (see picture)
Thank you RS
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Page 1 of 1

 
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