hi,
i bought the EasyAVR5A with a glcd and a touchscreen. I read the values from the touchscreen in my own program yet but i'm just learning and would like to have a simple example to try it.
Has anyone got a very basic example for mikrobasic that uses the glcd and the touchscreen? Everything i find here is for pic. thanks
EasyAVR5A Touchscreen example
Hi,
we are currently writing new version of AVR compilers.
This is a big revision and we are changing compiler concept radically.
Large amount of bugs will be solved and it will be easier to write complex examples.
New compliers will include Touch panel examples.
Sorry for the inconvenience and thank you for your patience.
we are currently writing new version of AVR compilers.
This is a big revision and we are changing compiler concept radically.
Large amount of bugs will be solved and it will be easier to write complex examples.
New compliers will include Touch panel examples.
Sorry for the inconvenience and thank you for your patience.
Hello!
Here it is_
program testSUBS
dim x, y as char[5]
rx, ry as word
main:
ddrC = $24 ' configure RA0 and RA1 as analog pins,
' RA2 and RA5 as digital pins
portC = $24 ' configure RA2 and RA5 as ouputs
Glcd_Init(PORTD, 2, 3, 4, 5, 7, 6, PORTB) ' Glcd initialization
Glcd_Set_Font(font5x7,5,8,32)
Glcd_Fill(0)
Glcd_Write_Text("Test", 30, 5, 1)
label0:
PORTC.2 = 1 ' DRIVEA = 1 (LEFT drive on, RIGHT drive on, TOP drive off)
PORTC.5 = 0 ' DRIVEB = 0 (BOTTOM drive off)
ry = ADC_read(0) ' reading X value from RA0 (BOTTOM)
Delay_ms(50)
PORTC.2 = 0 ' DRIVEA = 0 (LEFT drive off, RIGHT drive off, TOP drive on)
PORTC.5 = 1 ' DRIVEB = 1 (BOTTOM drive on)
rx = ADC_read(1) ' reading Y value from RA1 (from LEFT)
Delay_ms(50)
wordToStr(rx, x)
wordToStr(ry, y)
if ((rx > 190) and (rx < 250) and (ry > 160) and (ry <180)) then
Glcd_Write_Text(x, 30, 6, 0)
Glcd_Write_Text(y, 30, 7, 0)
else
Glcd_Write_Text(x, 30, 6, 1)
Glcd_Write_Text(y, 30, 7, 1)
end if
Delay_ms(100)
goto label0
end.
this program for atmega8, but U can convert it to, for example, for mega16 by changing the ports.
I use easyAVR5 - on this board portA on mega16 used for data transfer between CPU and GLCD. But the portA is only ADC port in mega16. That's why I build this on mega8. In mega8 U must use the internal oscillator and connect pin OSC to portA6, NC on portA7.
easyAVR5 board is not a good idea with this pins of mega8. Ingeneers of mikroe may use a jumpers to connect this pins for external oscillator or to any other port (portB for example)
Here it is_
program testSUBS
dim x, y as char[5]
rx, ry as word
main:
ddrC = $24 ' configure RA0 and RA1 as analog pins,
' RA2 and RA5 as digital pins
portC = $24 ' configure RA2 and RA5 as ouputs
Glcd_Init(PORTD, 2, 3, 4, 5, 7, 6, PORTB) ' Glcd initialization
Glcd_Set_Font(font5x7,5,8,32)
Glcd_Fill(0)
Glcd_Write_Text("Test", 30, 5, 1)
label0:
PORTC.2 = 1 ' DRIVEA = 1 (LEFT drive on, RIGHT drive on, TOP drive off)
PORTC.5 = 0 ' DRIVEB = 0 (BOTTOM drive off)
ry = ADC_read(0) ' reading X value from RA0 (BOTTOM)
Delay_ms(50)
PORTC.2 = 0 ' DRIVEA = 0 (LEFT drive off, RIGHT drive off, TOP drive on)
PORTC.5 = 1 ' DRIVEB = 1 (BOTTOM drive on)
rx = ADC_read(1) ' reading Y value from RA1 (from LEFT)
Delay_ms(50)
wordToStr(rx, x)
wordToStr(ry, y)
if ((rx > 190) and (rx < 250) and (ry > 160) and (ry <180)) then
Glcd_Write_Text(x, 30, 6, 0)
Glcd_Write_Text(y, 30, 7, 0)
else
Glcd_Write_Text(x, 30, 6, 1)
Glcd_Write_Text(y, 30, 7, 1)
end if
Delay_ms(100)
goto label0
end.
this program for atmega8, but U can convert it to, for example, for mega16 by changing the ports.
I use easyAVR5 - on this board portA on mega16 used for data transfer between CPU and GLCD. But the portA is only ADC port in mega16. That's why I build this on mega8. In mega8 U must use the internal oscillator and connect pin OSC to portA6, NC on portA7.
easyAVR5 board is not a good idea with this pins of mega8. Ingeneers of mikroe may use a jumpers to connect this pins for external oscillator or to any other port (portB for example)
I check touchscreen resolution, but not pixels
Analog touchscreen is not a good idea to use with microcontrollers. Because very big noise on analog lines. I suggest U to use matrix touchscreen like a this one...
TS240128BMNO#
it for 240x128 display
But the big noise may be because the compiller is bad. Try to create code like this on BASCOM.
Analog touchscreen is not a good idea to use with microcontrollers. Because very big noise on analog lines. I suggest U to use matrix touchscreen like a this one...
TS240128BMNO#
it for 240x128 display
But the big noise may be because the compiller is bad. Try to create code like this on BASCOM.
Hi,
as promised we released a new compiler for AVR.
http://www.mikroe.com/forum/viewtopic.php?t=17514
Right now it is still in beta testing phase, but you are more than welcome to give our touch
panel example a try. We are confident you will be satisfied with results.
Regards
as promised we released a new compiler for AVR.
http://www.mikroe.com/forum/viewtopic.php?t=17514
Right now it is still in beta testing phase, but you are more than welcome to give our touch
panel example a try. We are confident you will be satisfied with results.
Regards
LibStock
http://www.libstock.com/
mikroSDK
https://www.mikroe.com/mikrosdk
mikroBUS
https://www.mikroe.com/mikrobus
http://www.libstock.com/
mikroSDK
https://www.mikroe.com/mikrosdk
mikroBUS
https://www.mikroe.com/mikrobus