Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Nextion and Bascom
Goto page Previous  1, 2, 3, 4  Next
 
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: 1198
Location: SYDNEY

australia.gif
PostPosted: Wed Apr 01, 2020 10:14 am    Post subject: Reply with quote

Thank you Mark
I thought it would be simple but I am very low in ASM
Could it be made into a bascom function.
Nexwave Very Happy

I think bascom and nextion make good partners
as bascom has a soft com port it can be used with the Arduino's with one com port

Nextion now has a CRC function I need to learn how to use it

Regards Paul & keep safe
Back to top
View user's profile
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1198
Location: SYDNEY

australia.gif
PostPosted: Sat May 02, 2020 1:06 pm    Post subject: Reply with quote

Need to use array greater than 255 so how to with marks code
Worked it out I needed the extended printbin Very Happy
Regards Paul
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5093
Location: Holland

blank.gif
PostPosted: Mon May 04, 2020 10:21 am    Post subject: Reply with quote

this is the size :

! ldi r24,10 ; size of array
! ldi r25,0

i will post a function later.

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

Administrator



Joined: 09 Apr 2004
Posts: 5093
Location: Holland

blank.gif
PostPosted: Mon May 04, 2020 11:37 am    Post subject: Reply with quote

Code:
'size of array in r24 and r25
Sub Copydown(ar() As Byte , Byreg R24 As Word)
   $asm
      Loadadr Ar(1) , Z                                     ; load address into r30 r31
      add r30,r24                                           ; add size
      adc r31,r25
      sbiw r30,1                                            ; adjust
_copydown:
      ld r23, -z                                            ; load byte
      std z+1,r23                                           ; save
      sbiw r24,1                                            ; adjust size counter
      brne _copydown                                        ; till it is zero
   $end Asm
End Sub


call it like :

Code:
Dim Ar(255) As Byte , J As Byte

Ar(1) = 1
Ar(2) = 2
Ar(3) = 3
Ar(4) = 4
Ar(5) = 5

Copydown Ar(1) , 255
For J = 1 To 10
  Print J ; "-" ; Ar(j)
Next

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

Bascom Member



Joined: 28 Jul 2006
Posts: 1198
Location: SYDNEY

australia.gif
PostPosted: Mon May 04, 2020 11:42 am    Post subject: Reply with quote

Thankyou Mark
I worked out the size of array part but because the light bulb was slow to come on
in my head about printbin needing the =extended to print more than 255 elements
I thought I had it wrong.


Regards Paul
Back to top
View user's profile
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1198
Location: SYDNEY

australia.gif
PostPosted: Mon May 04, 2020 11:52 am    Post subject: Reply with quote

Note for wave tool.

When using the Nextion wave for stored data a lot of ram is needed or an SD card
so the M1284p with 16k of ram is my choice.
The 7 inch screen will need up to 800 bytes to store 1 trace
so if 4 were used 3200 bytes.
The data is lost when you change to another screen so it has to be stored.

Regards Paul
Back to top
View user's profile
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1198
Location: SYDNEY

australia.gif
PostPosted: Thu May 07, 2020 1:08 pm    Post subject: Reply with quote

Ok I am learning some asm it may not be well written
but as it works, it means I am learning to use it
all suggestions to improve are welcome as then I learn more.

Regards Paul

Code:



Sub W_one(byval M As Byte , Byval J As Byte)
Arx = J

   !push r23
   !push r24
   !push r25
   !push r26
   !push r27
   !push r30
   !push r22

Loadadr Wave1(1) , X
!lds r22,{arx}
!cpi r22,1
!breq gogo
Loadadr Wave2(1) , X
!lds r22,{arx}
!cpi r22,2
!breq gogo
Loadadr Wave3(1) , X
!lds r22,{arx}
!cpi r22,3
!breq gogo
Loadadr Wave4(1) , X
!lds r22,{arx}
!cpi r22,4
!brne gone
Gogo:



'Loadadr Wave1(1) , X                                        'first location
! ldi r24,188 ; size of array
! ldi r25,2
!add r26,r24                ; add size
!adc r27,r25
!movw r30,r26               ; copy to Z
!sbiw r30,1 ; adjust
!lp1000:
!ld r23,-z  ; load byte
!st -x,r23
!sbiw r24,1
!brne lp1000

 Gone:

   !pop r22
   !pop r30
   !pop r27
   !pop r26
   !pop r25
   !pop r24
   !pop r23

   Select Case Arx

     Case 1
       Wave1(1) = M

     Case 2
       Wave2(1) = M

     Case 3
       Wave3(1) = M

     Case 4
       Wave4(1) = M






   End Select

'Wave1(1) = M


End Sub

 
Back to top
View user's profile
Kasch

Bascom Member



Joined: 18 Jun 2005
Posts: 47

PostPosted: Sun Oct 04, 2020 3:52 pm    Post subject: Reply with quote

Hello,

i tryed my first step with nexition 7" display, but no sucess Sad

1284P-Evaloution Board with definitifly rx/tx-function
5V ---> Red-Cabel Nextion
GND ---> Black-Cabel Nextion
RX yellow-Cabel ----> tx-1284P
TX Blue-Cable ---> rx-1284P

Software is from JP his example from Board, "updated" to 1284p-AVR. But nothing happend. Only the nextion-intro is running.

What do I wrong? Is a RS232-Chip needed? I do not thing so, ttl-level should realized from display, right?

I do many RX/TX-Things with my 1284p-Board, no problems. also the 4 wire connected to the board is checked. No cross over or something like this....

Kind regards
Back to top
View user's profile
Duval JP

Bascom Member



Joined: 22 Jun 2004
Posts: 946
Location: France

france.gif
PostPosted: Sun Oct 04, 2020 6:33 pm    Post subject: Reply with quote

Hi,
Yes you do a good connections but
Did you write a program in the nextion :

https://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&t=14537&highlight=nextion+works

you have to see the .pps file how to write .MHI and .TFT file to the SDcard ?

did you adjust the speed of bauds ?

and add the oops file too Embarassed

Nextion work well with Bascom
I add the 3 kind of display Basic, intelligent and enhanced and all are working well

I'm here to help you

JP

_________________
pleasure to learn, to teach, to create
Back to top
View user's profile Visit poster's website
Duval JP

Bascom Member



Joined: 22 Jun 2004
Posts: 946
Location: France

france.gif
PostPosted: Sun Oct 04, 2020 7:16 pm    Post subject: Reply with quote

here my M1284P
I use the focamax from nextion as regulator for Pw supply and I use it too for second serial com port to debug my program
PD2 and PD3 are second serial port


Quote:
'*****************************************************************
'* CONFIG BUFFERED USART FOR USB *
'*****************************************************************
Config Com1 = 115200 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0
Echo Off
Config Serialin0 = Buffered , Size = 30 'RX from Terminal
Open "COM1:" For Binary As #1
Const Usb = 1
'M2560-------------------------------------
' RXD0= yellow to PE0 tx0
' TXD0= Blue to PE1 rx0
'M1284------------------------------------
' RXD0= yellow to PD0
' TXD0=yellow to PD1


'---serial port-------------------------------------------------------------------------------------------------------------
Const Nex = 2
'Config Com2 = 19200 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0 '34800 modif le 12-02-2020
Config Com2 = 115200 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0 '19200 modif pour ecran intelligent
Open "COM2:" For Binary As #2
Config Serialin1 = Buffered , Size = 50
Config Serialout1 = Buffered , Size = 30


jp Wink

_________________
pleasure to learn, to teach, to create
Back to top
View user's profile Visit poster's website
Kasch

Bascom Member



Joined: 18 Jun 2005
Posts: 47

PostPosted: Sun Oct 04, 2020 8:42 pm    Post subject: Reply with quote

Thank you for fast reply Smile
you use com2
Code:
Config Com2 = 115200 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0 '19200 modif pour ecran intelligent
Open "COM2:" For Binary As #2


Pin D2/D3

i have Com1, Pin D0/D1. if i change it in
Code:

Config Com1 = 115200 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0 '19200 modif pour ecran intelligent
Open "COM1:" For Binary As #1
 

i got error : external routine not found in nextion.inc

For Binary As #2 send no error...but #2 is com2,or?

Thank you
Back to top
View user's profile
Duval JP

Bascom Member



Joined: 22 Jun 2004
Posts: 946
Location: France

france.gif
PostPosted: Mon Oct 05, 2020 11:32 am    Post subject: Reply with quote

I did a small hello word program with nextion

it works
JP

_________________
pleasure to learn, to teach, to create
Back to top
View user's profile Visit poster's website
Kasch

Bascom Member



Joined: 18 Jun 2005
Posts: 47

PostPosted: Sat Oct 10, 2020 7:29 pm    Post subject: Reply with quote

Hello JP,

thank you for the code.
Now is weekend and I can try, but no sucess Sad
I connected blue and yellow according your code.
compiling and sending to 1284p, but no reaction on display.
i have no smartcard or anything like this, thats why i skip firststep.pdf

but "hello world" should be displaying on screen, right?

what should i do? try other baud-rates?
thank you
Back to top
View user's profile
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1198
Location: SYDNEY

australia.gif
PostPosted: Sun Oct 11, 2020 1:50 am    Post subject: Reply with quote

Kasch wrote:
Hello JP,


i have no smartcard or anything like this, thats why i skip firststep.pdf

but "hello world" should be displaying on screen, right?

what should i do? try other baud-rates?
thank you


You have to do the first steps Nextion display is built with the nextion editor!
The 1284p just sends text to the display it does not create the graphics
this is done with the nextion editor on your computer.
If you do not have a mini SD card then you need a 5 volt serial port on your computer
to upload to the nextion display.
IMPORTANT! it must not be RS232 this will damage display!!
Best to get a mini SD card it is much faster and you will not accidentally damage the display.
Back to top
View user's profile
Kasch

Bascom Member



Joined: 18 Jun 2005
Posts: 47

PostPosted: Sun Oct 11, 2020 2:23 am    Post subject: Reply with quote

On the example-code from JP is also a "Hello World"- commando. but nothing happend. i need no pictures at the moment..

without sd-card no using of display possible?
and how can I connect the display with an pc? usb-ttl-converter?
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
Goto page Previous  1, 2, 3, 4  Next
Page 2 of 4

 
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