==
Thank-you MWS and Laborratte. Your help/suggestions/advice are terrific.
It will take a little time for me to implement these latest "hints". While I was familiar with the LCD Memory Data Access Control register and its behavior, I simply used it in the way the LCD routines were initially set up. I will look at the settings to see if I can easily change (hopefully without fully re-writing) the subroutines in order to eliminate the need to write the X-Y location for each pixel. I think this will further speed up the LCD refresh rate.
The other "hints" are things I did not know but will also implement. I will post my Sub when complete.
PS: the current setting for the LCD Memory Access Control register (&H36) is &B0_0_0_000_XX. I think if I change it to &B0_0_1_000_XX, the existing routine should work ... but this routine does not set the Window prior to starting to write pixels.
From datasheet 9.10:
[quote:515ad55d2f]In vertical addressing mode (MV=1), the Y-address increments after each byte, after the last Y-address (Y=YE), Y wraps
around to YS and X increments to address the next column. In horizontal addressing mode (V=0), the X-address
increments after each byte, after the last X-address (X=XE), X wraps around to XS and Y increments to address the next
row. After the every last address (X=XE and Y=YE) the address pointers wrap around to address (X=XS and Y=YS).[/quote:515ad55d2f]
E
↧
BASCOM-AVR : Help convert Basic to assembler : REPLY
↧
BASCOM-AVR : Help convert Basic to assembler : REPLY
Hi MWS and Laboratte,
a short update on the comments you both made:
[quote:cf1f281b79]MWS Wrote:
In this case you are lucky, because r17 is not used. Pushing r17 would make sense here. Be sure every push is pop'd, as otherwise the stack corrupts.
[/quote:cf1f281b79]
Its OK to have good luck ... but I noticed in the MMC-XMEGA.lib in the MCS folder the following snippet.
[code:1:cf1f281b79]_mmc_reset:
*BASIC: Set Mmc_cs ' Set CS HIGH
ldi r17,10 ; Clock Counter, 80 pulses with CS high
_mmc_reset_0:
rcall _Byte2SPI_255
dec r17 ; send 80 clock pulses
Brne _MMC_Reset_0
*BASIC: Reset Mmc_cs ' Reset Cs to LOW
ldi r16,64 ; Send CMD0
rcall _Byte2SPI
rcall _Byte2SPI_0
rcall _Byte2SPI_0
rcall _Byte2SPI_0
rcall _Byte2SPI_0
ldi r16,149 ; first command needs proper CRC Byte
rcall _Byte2SPI
[/code:1:cf1f281b79]
Since there were no !PUSH/!POP around the MMC PORT commands, I used the same approach in my assembler code. Please let me know if I misinterpreted the issue.
[quote:cf1f281b79]Laboratte Wrote:
The display controller is able to count up the address counter. Check the correct settings (vertical or horizontal adressing mode), set your start pixel address and send a chunk of data.[/quote:cf1f281b79]
You are correct that the LCD has this ability. I wrote this Sub to test it.
[code:1:cf1f281b79]'*******************************************************************************
' LCD Text
'*******************************************************************************
Declare Sub Lcd_text2(byval Xoffset As Byte , Byval Yoffset As Byte , Byval Fontset As Byte , Byval Forecolor As Word , Byval Backcolor As Word )
Sub Lcd_text2(byval Xoffset As Byte , Byval Yoffset As Byte , Byval Fontset As Byte , Byval Forecolor As Word , Byval Backcolor As Word )
Local Temp As Word 'Dim local the variables
Local A As Word , Pixels As Byte , Carcount As Byte
Local Row As Byte , Col_b As Byte , Blocksize As Byte , Dummy As Byte
Local Columns As Byte , Columncount As Byte , Rowcount As Byte
Local Xpos As Byte , Ypos As Byte , Pixelcount As Byte , Row_b As Byte
Select Case Fontset
Case 1 : Restore Font6x10
Case 2 : Restore Font12x16
End Select
Read Row : Read Columns : Read Blocksize : Read Dummy 'Read the first 4 bytes from the font file
!sts {fnt_start}, R8
!sts {fnt_start + 1}, R9
Row_b = Row * 8 : Decr Row_b 'Row is always 8 pixels high = 1 byte, so working with row in steps of 8.
Col_b = Xoffset
For Carcount = 1 To Len(ss) 'Loop for the numbers of caracters that must be displayed
Temp = B_ovr(carcount) - 32 'Font files start with caracter 32
Temp = Temp * Blocksize
Fnt_w = Fnt_start + Temp
!lds R8, {fnt_w}
!lds R9, {fnt_w + 1}
Rampz = 1
Col_b = Col_b + Columns
' SET Window for the Character to be put on LCD
Call Lcd_write_command(&H2a) 'column set x
Call Lcd_write_data(&H00)
Call Lcd_write_data(xoffset) 'start
Call Lcd_write_data(&H00)
Call Lcd_write_data(col_b) 'end
Call Lcd_write_command(&H2b) 'row set y
Call Lcd_write_data(&H00)
Call Lcd_write_data(yoffset) 'Start
Call Lcd_write_data(&H00)
Call Lcd_write_data(row_b) 'end
Call Lcd_write_command(&H2c) 'write to ram
For Columncount = 1 To Columns 'Loop for numbers of Colums
For Rowcount = 1 To Row
Read Pixels
For Pixelcount = 0 To 7 'Loop for 8 pixels to be set or not
If Pixels.pixelcount = 1 Then Pixel = Forecolor Else Pixel = Backcolor
Lcd_cs = 0
Lcd_dc = 1
Spiout Colh , 1
Spiout Coll , 1
Lcd_cs = 1
Next
Next
Next
Next Carcount
End Sub[/code:1:cf1f281b79]
This Sub sets the window for the character correctly, but I could not find a setting of the LCD Memory Access Control Register &H36 that would display the pixels correctly. It seems as if the LCD insists on incrementing the memory position Horizontally while the FONT files store the character pixels vertically.
Any help here would be greatly appreciated.
E
↧
↧
Share your working BASCOM-AVR code here : Library for ST7735R display : REPLY
Thank-you for posting. I will test tomorrow.
Do you think this will work on Xmega?
E
↧
BASCOM-AVR : Help convert Basic to assembler : REPLY
If you know the compiler good enough, then you can do that. It is not likely, that the compiler uses r17 in this context.
However, I wanted to make you aware that intermixing Basic and assembler needs attention.
If you know the compiler already good enough, you're save.
For your example about Set/Reset Mmc_cs:
If the Port register of the Mmc_cs pin is located in the lower IO-RANGE, up to an address of 31, then the compiler translates [b:03ef10431c]Set Mmc_cs[/b:03ef10431c] into [b:03ef10431c]SBI [address], [bit][/b:03ef10431c], which is completely harmless in this context, as this opcode does not use a register.
In case of an hardware address of 32 and up, it is translated like that:
[code:1:03ef10431c]LDS rXX, [address]
ORI rXX, [bit^2]
STS [address], rXX[/code:1:03ef10431c]
If the register you use is different to rXX, which is likely r19 or r22, then it's save.
Set/Reset is a simple command, if you use more complex Basic commands, you need to take more care.
That's the reason I avoid Basic within assembler, as more if it is simple to do it completely in assembler.
↧
BASCOM-AVR : compiler : NEWTOPIC
i wrote a small file wen i want to compile it, no erors.
it compile and run it but get a message " no obj or dbg file found"
[b:a6043afb8b][color=red:a6043afb8b](BASCOM-AVR version : 2.0.7.8 )[/b:a6043afb8b][/color:a6043afb8b]
↧
↧
BASCOM-AVR : compiler : REPLY
- check compiler output options if those files are checked
- check if your code contains directives : $regfile, $hwstack,$swstack,$framesize. if not add them.
- optional, download 2080 full setup.
↧
BASCOM-AVR : compiler : REPLY
this is the file timer, copy of avr timer.exe dobson
$regfile = "m1284pdef.dat" ' specify the used micro
$crystal = 8000000 ' used crystal frequency
$baud = 9600 ' use baud rate
$hwstack = 32 ' default use 32 for the hardware stack
$swstack = 40 ' default use 10 for the SW stack
$framesize = 40 ' default use 40 for the frame space
Config Lcdpin = Pin , Db4 = Porta.4 , Db5 = Porta.5 , Db6 = Porta.6 , Db7 = Porta.7 , E = Portc.7 , Rs = Portc.6
dim a as integer
dim b as integer
dim c as integer
dim r as integer
const Timer1Reload = 6942
config timer1=timer,prescale = 1024
load timer1 , Timer1Reload
on ovf1 Timer1_ISR
start timer1
enable ovf1
enable interrupts
b=2
c=4
a=1
do
lcd "dit is een poging"
r= b * c
lcd r
loop until a=11
Timer1_ISR:
load timer1, Timer1Reload
lcd "*"
return
end
↧
Share your working BASCOM-AVR code here : Library for ST7735R display : REPLY
Yes, it must work on Xmega:
[code:1:9ce858afbd]$regfile = "xm256a3budef.dat"
$crystal = 32000000
$hwstack = 64
$swstack = 64
$framesize = 64
Config Osc = Disabled , 32mhzosc = Enabled
Config Sysclock = 32mhz , Prescalea = 1 , Prescalebc = 1_1
'------------------------------- Setup -----------------------------------------
$lib "glcd-ST7735R.lib"
Config Vport0 = D
Config Graphlcd = Color , Cs1 = Port0.7 , Si = Port0.6 , Sclk = Port0.5 , Cs1 = Port0.4, Rst = Port0.3[/code:1:9ce858afbd]
I can't test it - Proteus don't support Xmega.
↧
BASCOM-AVR : Help convert Basic to assembler : REPLY
[quote:1d08fe6c2a="enniom"]
It seems as if the LCD insists on incrementing the memory position Horizontally while the FONT files store the character pixels vertically.
[/quote:1d08fe6c2a]
If I remember correctly the Bascom color fonts store the pixels horizontally.
↧
↧
Share your working BASCOM-AVR code here : Library for ST7735R display : REPLY
Hello Mrshilov
Thank you for sharing. Even while you could not test it, i am sure it will work. You are the LCD expert :D
↧
BASCOM-AVR : compiler : REPLY
that looks ok to me. make sure the folder is not write protected.
try to run in admin mode to see if it makes a difference.
↧
BASCOM-AVR : Help convert Basic to assembler : REPLY
Hi MWS: I will follow your advice.
Evert: Thanks for the help. I'll look into it and modify the code as necessary.
E
↧
BASCOM-AVR : compiler : REPLY
it's OK but , i just copy the hole file in a new file and its ok!
are tmers working in the simulator i see nothing on lcd ???
↧
↧
BASCOM-AVR : compiler : REPLY
to optimise the simulator you can use
$sim see the help
jp :wink:
↧
Share your working BASCOM-AVR code here : Wireless Thermometer : REPLY
Someone ask me if transmitter code will fit into Tiny13 and this is the answear :D
I must do some optimisations and everything work fine.
This is nice that we can work on variables passed by reference like that:
[code:1:600c9ea72f]'-[MANCHESTER]- '1 become "01" and 0 become "10" so longest break in TX is "1001"
Function Code(byref Temp As Byte) As Word 'we use target variable instead local
Multip = 8
Do
Shift Code , Left , 2
Decr Multip
If Temp.multip = 1 Then
Code = Code + 1 '01
Else
Code = Code + 2 '10
End If
Loop Until Multip = 0
End Function[/code:1:600c9ea72f]
[b:600c9ea72f]NOTE[/b:600c9ea72f] Attiny13 internal voltage reference is 1,1V so for 3,3V supply resistor R2 should have 20K and for 5V 35,5K
↧
BASCOM-8051 : Compatible with Silicon Labs C8051F? : NEWTOPIC
Seeing how the C8051F family is supposedly 8051 compatible, is BASCOM-8051 compatible as well?
↧
BASCOM-AVR : How to change Config SPI=Hard parameters On-The-Fly for Noss : NEWTOPIC
Hello Forum,
I'm using the Hardware SPI in a M2560 controller and have two SPI devices that need different configuration parameters:
[code:1:d7ac94d463]
Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = Low , Phase = 0 , Clockrate = 128 , Noss = 1 , Spiin = 0
[/code:1:d7ac94d463]
and
[code:1:d7ac94d463]
Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = Low , Phase = 0 , Clockrate = 4 , Noss = 0 , Spiin = &HB0
[/code:1:d7ac94d463]
The Clockrate is change on register SPCR & SPCR, isn't a problem for me. But how can I change the "Noss" and the Spiin On-The-Fly?
I will use in this form :http://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&t=9111&highlight=ads7843
many thanks
MAT
[b:d7ac94d463][color=red:d7ac94d463](BASCOM-AVR version : 2.0.7.8 )[/b:d7ac94d463][/color:d7ac94d463]
↧
↧
BASCOM-AVR : How to change Config SPI=Hard parameters On-The-Fly for Noss : REPLY
[quote:2cbf954b4a="mat-sche"]But how can I change the "Noss" and the Spiin On-The-Fly?[/quote:2cbf954b4a]
I would guess both options are hard-coded into Bascom's SPI functions, as they are not part of hardware's SPI unit.
You can't change it then, you can try to work around or switch to XMega, as there it's configurable.
A workaround for the SS-pin could be to configure Noss = 0 and connect a pullup-resistor.
Switching the SS-pin to input will disable SS control then.
When Bascom's SPI-function drives the SS-(port)pin low at start of the SPI-function, nothing will happen, because of the input status, neither it will matter, if it is driven high again at the end.
And because SS is pulled high through the resistor, SPI will keep working in master mode.
Switching to output will re-enable SS-control.
It means however that you have no manual control over the SS-pin, i.e. to set it high or low on demand, you only can disable it.
For Spiin = &HB0 you can substitute with SPIMove, but you need to provide an array of bytes filled with &HB0 as big as the data you want to receive. Depending on the amount of data to receive, this may be quiet a waste.
It would be much cleaner to write a custom SPI-function, which works as desired.
↧
BASCOM-AVR : How to change Config SPI=Hard parameters On-The-Fly for Noss : REPLY
Why not setup NOSS=1, and configure SS pin as Output.
Then TO can drive CS pin for first device with original SS pin and second with another uC pin.
Most device don care about Spiin so I would take a try setup this &HB0 and check if first device aprove it.
↧
BASCOM-AVR : How to change Config SPI=Hard parameters On-The-Fly for Noss : REPLY
Hello,
thanks for your answer and information!
The background is I try to use a RFM12 and a touch controller ADS7843 on the same SPI-Interface.
The next way is to comunicate over SPI and RFM12, the ADS I try to use over shiftin - shift out.
regards MAT
↧