this has been asked before. the lower boundary is 1 and not 0. Just as for text lcd where 1 is the minimum value for locate.
↧
BASCOM-AVR Old versions : A problem with glcdks108.lbx Library : REPLY
↧
Share your working BASCOM-AVR code here : ILI9341 with SW/HW SPI, 8/16 Bit parallel mode : REPLY
Hi, Netzman,
This works, now compiles ok , thank you !!! I will make the hardware and test in this weekend.
I have yet made the change in line 435. But in line 425 I was using "Compare_a_pwm=Clear_Up" .
When I changed to "Compare_pwm=Clear_up", the error was gone .....
But I don't understand why this works.....
The Timer2 have two output pins, what is the difference betwen the commands "Compare_pwm" and "Compare_a_pwm" ?
Or this is a bug in compiler ?
Thanks again !
Paulo
↧
↧
BASCOM-AVR : Fast ADC in free mode : REPLY
[quote:4d6001f050]Better describe what you want to achieve and why without ISR, than describing an unsuitable approach.[/quote:4d6001f050]
Ok, let me explain:
I have three wavetables at bottom of program.
HW SPI feeding DAC at 2,5kHz to 35kHz, driven by Timer1 interrupt.
One pot changes play speed (by changing T1 value), second pot is for table selection.
There is not enough time to ordinary single ADC conversion, every 28us must be new sample sent to DAC in worst case.
I need not sample ADCs in every program loop so I thought about such solution:
- set adcmux to ch3 (speed)
- after say 2-4 program loops (to be sure values in ADCL and ADCH are valid for ch3) read ADCL and ADCH
- set adcmux to ch5 (table select)
- repeat as above
No sample should be lost or delayed so Timer1 interrupt and SPI out are most important things.
↧
BASCOM-AVR : Fast ADC in free mode : REPLY
[quote:984377466f="Ruprecht"]- set adcmux to ch3 (speed)
- after say 2-4 program loops (to be sure values in ADCL and ADCH are valid for ch3) read ADCL and ADCH
- set adcmux to ch5 (table select)
- after say 2-4 program loops read ADCL and ADCH (ch5)[/quote:984377466f]
That will work, if the 2-4 loops are longer than 2 * 13.5 * ADC-prescaler clocks.
If ADC is read then, the result clearly belongs to the previously set MUX.
Be careful not to overwrite other bits in the ADMUX register.
Afair it should work to set the MUX with a dummy read of GetADC(chan).
GetADC() in single-mode does 2 ADC-reads and blocks program execution as long as a 2-times conversion takes, in free-run however it does not block, returns only the value of
ADC and sets MUX.
To have better control, I'd calculate the ADC-prescaler myself according the datasheet, so I'd know how many clocks my program-loops have to be.
In AUTO the ADC-prescaler is likely set (depending on main clock) to 256, so to be safe,, your program-loops should take 2 * 13.5 * 256 = 6912 cpu-clocks.
The factor 13.5 results out of ADC-clocks (after the ADC-prescaler) required for one conversion.
↧
Share your working BASCOM-AVR code here : ILI9341 with SW/HW SPI, 8/16 Bit parallel mode : REPLY
Good to hear!
I was also wondering about this, it seems like a bug to me.
If it is not working, you could set the corresponding registers by hand after the config statement (Mega328 manual p. 153).
Let me know if you have success!
Br,
Matthias
↧
↧
BASCOM-AVR : Fast ADC in free mode : REPLY
Really thank you, you brought me out of darkness... I hope :)
After some time with datasheet I think this setup will be correct:
[code:1:a5e4de2516]
'Setting MUX to ADC3 before starting first concersion:
ADMUX = &b0100_0011 '(7,6: AVcc + cap, 5: right adj., 4: reserved, 3-1: ADC3)
ADCSRA = &b1110_0111 '(7: AD enable, 6: AD start, 5: autotrig, 4: interrupt flag, 3: no interrupt, 2-0: prescaler = 128 (20MHz Xtal/128 = 156k ADC clock))
ADCSRB = &b0000_0000 '(7: reserved, 6: no comparator, 5-3: reserved, 2-0: free running mode)
'----in-main-loop------------------------------------------------------------------------
'Switching MUX to ADC3 in main loop:
ADMUX = &b0100_0011 '(7,6: AVcc + cap, 5: right adj., 4: reserved, 3-1: ADC3)
'then after some loops switch to ADC5:
ADMUX = &b0100_0101 '(7,6: AVcc + cap, 5: right adj., 4: reserved, 3-1: ADC5)
'and after some loops back to ADC3 and so on
[/code:1:a5e4de2516]
Or overlooked something?
Thank you
↧
BASCOM-AVR : Fast ADC in free mode : REPLY
[quote:3dbf1a36e1="Ruprecht"]Or overlooked something?[/quote:3dbf1a36e1]
Try to reduce the prescaler, if you attach pots you likely won't need 10bit resolution.
Prescaler 64 and main clock 20MHz gives you 312,5kHz ADC-clock, while it is above of 50-200kHz, which is described best in regards of resolution, it may be still suitable for manual inputs like pots.
I did not check your bit-notations for correctness, anyway I don't like this:
[code:1:3dbf1a36e1]ADMUX = &b0100_0011[/code:1:3dbf1a36e1]
as it's error prone, better is:
[code:1:3dbf1a36e1]ADMUX = Bits(REFS0, MUX1, MUX0)[/code:1:3dbf1a36e1]
because the meaning is obvious.
Changing the channel is usually done this way:
[code:1:3dbf1a36e1]ADMUX = ADMUX And NBits(MUX3, MUX2, MUX1, MUX0)
ADMUX = ADMUX Or channel[/code:1:3dbf1a36e1]
But as said, I believe you can simply use Bascom's built-in commands, configure the ADC with FREE and then use GetADC(), which is compiled differently by using FREE, it will work non-blocking then, it will set MUX and it will read ADC.
Pseudo-code, not tested:
[code:1:3dbf1a36e1]start:
ch2val = GetADC(chan1) ' dummy read, set MUX to chan1
Do
' wait for 1728 (2 * 13.5 * 64) cycles passing by
ch1val = GetADC(chan2) ' get converted value for previous MUX-setting (chan1) and set new MUX (chan2)
' wait for 1728 (2 * 13.5 * 64) cycles passing by
ch2val = GetADC(chan1) ' vice versa
Loop[/code:1:3dbf1a36e1]
↧
BASCOM-AVR : OLED Display : REPLY
hello
I found out if I configure Display type KS077 it works basicly. Disadvantage- Display is flickering. I implement some waitms instructions,this decreased the
flichering. If the code without waitms instructions,flickering is faster. My idea: modify the code,include the Lcd Lib because I will use the R/W instruction
to reduce the flickering. Good idea?
Thanks in advance
Best regards
Hubert
↧
BASCOM-AVR : big difference between waitms 48 and waitus 48000 : NEWTOPIC
Good evening,
I knew that the waitms and the waitus commands in Bascom are not very precise, but i have the following strange thing:
When I apply the waitms 48, the result is quitte spot on.
When I apply the waitus 48000, the result is more than 10 percent off (7,5 msec).
How is this possible? Is this normal? My clock frequency is 14,3183 MHz and the ucontroller is an Attiny2313.
Thanks for the answers!
Best regards Hendrik
[b:3e5a270a41][color=red:3e5a270a41](BASCOM-AVR version : 2.0.7.8 )[/b:3e5a270a41][/color:3e5a270a41]
↧
↧
BASCOM-AVR : big difference between waitms 48 and waitus 48000 : REPLY
waitus and waitms are calculated loops. The code differs based on the crystal frequency and parameter value.
WAITUS is intended for very small delays. It was not designed with the intention to delay for a long time. For those delays, use WAITMS or WAIT.
The problem with WAITUS is that in order to have a big delay, a lot of cycles/loops must be performed when you have a high clock frequency. A word register is used which is not suited for long delays with a high clock frequency.In fact it overflows with the values you use.
I added an error message in case the desired delay can not be created. While i could extend the code to use an extra register i do not think it is worth the effort.
↧
BASCOM-AVR : OLED Display : REPLY
but when do you get this flicker? when you write in a loop?
When you have code like:
CLS
LCD "TEST"
END
will it also flicker?
code like :
do
locate 1,1: lcd "test"
loop
will always flicker.
You can test with the WR pin defined (and connected). In that case, a different lib is used that uses the busy flag.
When using KS077 the extended function set is used. I did not found info about that in the PDF of the LCD.
↧
Share your working BASCOM-AVR code here : LinkSprite UART Camera and a TinySine SIM900 GSM/GPRS Module : REPLY
I have resolved the artifact problem of banding in my images. I moved the "Stop taking pictures" command to the Send_Picture Subroutine so it reads:
If Image_size = 1 Then
Wait 2
Elseif Image_size = 2 Then
Wait 5
Else
Wait 18
End If
Printbin &H56; &H00; &H36; &H01; &H03; ' stop taking pictures, response is "v6" 'Moved here for Rev A
I have attached a zip file that includes the electrical schematic. a data logging image of the process of transferring the JPEG file from the camera to the SIM900 and an example of what is sent to the terminal emulator to aid in debugging.
↧
Share your working BASCOM-AVR code here : NOKIA-3310/5110 LCD library : REPLY
[quote:831628f537="Mrshilov"]I talk about source code for included photo.[/quote:831628f537]
Hello.
I didn't use photo, only text and ATXMEGA128A3U. Maybe is something new about this problem?
Best regards.
Matjaz
↧
↧
BASCOM-AVR : compare pwm error?? : NEWTOPIC
I updated to 2.0.7.8 again thinking I would give it a second try. Maybe I shouldnt have after the update, I ran into this error:
Unknown CONFIG Parameter. Compare PWM
On this line:
Config Timer2 = Pwm , Prescale = 1 , Compare Pwm = Clear Down
Using an ATmega1284.
Any thoughts??
[b:1d4b25675c][color=red:1d4b25675c](BASCOM-AVR version : 2.0.7.8 )[/b:1d4b25675c][/color:1d4b25675c]
↧
BASCOM-AVR : compare pwm error?? : REPLY
Hi,
Try :-
Config Timer2 = Pwm , Prescale = 128 , Compare [b:a2bdbda5a9]A[/b:a2bdbda5a9] Pwm = Clear Down, Compare [b:a2bdbda5a9]B[/b:a2bdbda5a9] Pwm = Clear Down
Pwm2a = 0
Many AVR's have 2 pwm outputs per timer, so you need to tell Bascom which PWM Output you want to use (A or B)
Regards
Ian Dobson
↧
BASCOM-AVR : compare pwm error?? : REPLY
exact, and while add it, replace the space with underscores :, like : Compare_A_Pwm
↧
BASCOM-AVR : compare pwm error?? : REPLY
That worked. I guess on newer versions, your tightening the use of sloppy coding?
↧
↧
BASCOM-AVR : TFT with ILI9341 controller : REPLY
Hi, Daro,
Your new function don't set the color !
Try set the color information in display register BEFORE this :
Call Lcd_set_window(0 , 0 , Xx , Yy)
.
.
.
Paulo
↧
BASCOM-AVR : FT800 : REPLY
Hi Peter,
You are right. I now have a separate supply to the board and it is much much better. I now use VM800B display and it really works well.
I am also trying Xmega and so far could not succeed to save the calibration constants and start up without calibration. The calibration constant is set to 1 in the Ft800.inc file. I use the MK2 atmel programmer and studio 6. Would you be able to assist with this one? I have gone through all the routines "readtouchvariables" and "writetouchvariables" including flag "TC" and the "transmatrix()" variables and are able to print them but it looks like it doesn't save to EEPROM. I have also tried "config eeprom="mapped" " but with no change
Thanks in advanced
↧
BASCOM-AVR : FT800 : REPLY
this topic has some info about ft800 and xmega.
so use a virtual port pin for the CS line, or alter the lib as has been shown.
if you can not get it to work, you can write to support.
↧