Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Nextion and Bascom

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

Bascom Member



Joined: 28 Jul 2006
Posts: 1133
Location: SYDNEY

australia.gif
PostPosted: Thu Nov 28, 2019 7:43 am    Post subject: Nextion and Bascom Reply with quote

Using the Nextion display with Bascom.

The displays handle all the graphics:
It is all stored in the flash on the display you design it on your PC
upload photos and graphics to the editor to be used on your display
upload to the display is done via RS232 or simpler by micro SD card
It handles the touch events for you

Communication to the avr is serial RS232

There is a limited instruction set that can be used to get the display to do some work
but its not well documented.

The first thing to do is to give the items on the screen useful names
because when you change pages the default ones get re-used
as an example the first touch button on a page gets named bt1
so every page you make will have a bt1 making it difficult to work out which page sent it

It can do a pop up page over the present one
it comes with examples of keyboards one is a number pad which pops up enabling numbers to be input.
It has a user password function.

The enhanced versions have more ram , flash , a RTC , general purpose IOs which can do PWM and faster cpu.
I have the enhanced version.

The size of buttons on the screen will need to be determined on the screen
for users to be able to work with big enough for a finger or stylus

This covers some of their functions more will follow as I learn them.

next post I will show a animated screen with the nextion code that does it

Regards Paul
Back to top
View user's profile
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1133
Location: SYDNEY

australia.gif
PostPosted: Thu Nov 28, 2019 11:39 am    Post subject: Reply with quote

Now here is the animation

Slider tool

https://youtu.be/tSEj0gExWAI



h0 , h1 , h2 , h3 are the sliders
va0 , va1 , va2 , va3 are local variables to the page
Note variables can be made global available to all pages
the code runs in a timer which forms a loop
the first 4 lines are setting the slider to the variable value
each slider can have a value from zero to 100
as we go through the loop we add 10 to the variable
the if statement tests if it is greater than 100
if it is then it is set to 1

The code that runs the slider is
Code:

h0.val=va0.val
h1.val=va0.val
h2.val=va1.val
h3.val=va3.val
va0.val=va0.val+10
if(va0.val>100) //Pay attention to the format, there must be brace before and behind it, and  the brace must take up ONE line
{
  va0.val=1
}
va1.val=va1.val-10
if(va1.val<1) //Pay attention to the format, there must be brace before and behind it, and  the brace must take up ONE line
{
  va1.val=100
}
if(va3.val>100)
{
  va3.val=1
}
if(va3.val<1)
{
  va3.val=100
}
if(va2.val>1)
{
  va3.val=va3.val-10
}
if(va2.val<2)
{
  va3.val=va3.val+10
}
 


Regards Paul
Back to top
View user's profile
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1133
Location: SYDNEY

australia.gif
PostPosted: Thu Nov 28, 2019 11:53 am    Post subject: Reply with quote

Now full animation with picture box added

https://youtu.be/irECmmy1-ds

Picture box code animation
Pictures are loaded into the editor and are assigned a number automatically in the order loaded
they can however be moved up and down in the order manually
the animation is done by using a timer loop to load images in succession
the same way an animated GIF works
p2 is picture 2 box and pictures 62 to 66 are loaded one after the other
as we go through the timer loop
the if statement takes us back to image 62 (the first of the series)
when we come to the last in the series
this all shows as the yellow dots moving through the circle
with four picture boxes

Regards Paul

Code:

p2.pic=va4.val
va4.val=va4.val+1
if(va4.val>66) //Pay attention to the format, there must be brace before and behind it, and  the brace must take up ONE line
{// brace before
  va4.val=62
}// brace behind
p3.pic=va6.val
va6.val=va6.val+1
if(va6.val>71) //Pay attention to the format, there must be brace before and behind it, and  the brace must take up ONE line
{
  va6.val=67
}
p4.pic=va7.val
va7.val=va7.val+1
if(va7.val>76) //Pay attention to the format, there must be brace before and behind it, and  the brace must take up ONE line
{
  va7.val=72
}
 
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM Project Blog 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