Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 09:27 29 Mar 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Scrolling Graph on ILI9341 to slow on armmite, picomite and upython

     Page 2 of 2    
Author Message
ztoti
Regular Member

Joined: 27/10/2011
Location: Canada
Posts: 65
Posted: 04:48am 08 Jan 2022
Copy link to clipboard 
Print this post

Hi Vampire05,
I like you video, could you please share the code. Thank you
 
Vampire05
Regular Member

Joined: 06/12/2020
Location: Germany
Posts: 88
Posted: 05:41pm 09 Jan 2022
Copy link to clipboard 
Print this post

Sorry for the late response! Here is the code:


CLS

Dim integer dat
Dim integer dat2
Dim integer buf(320)
Dim integer buf2(320)
SetPin 31, ain
SetPin 32, ain
SetPin 34, ain


SetPin gp0, dout
SetPin gp1, dout
SetPin gp2, din

SetPin gp18, din, pulldown
Text 100, 5, "Universal Plotter", lt


Line 30,50,30,222,2,RGB(yellow)
Line 30,220,320,220,2,RGB(yellow)
Text 27,225, "0"
Text 70,225, "50"
Text 120,225, "100"
Text 170,225, "150"
Text 220,225, "200"
Text 270,225, "250"

Text 30,215, "0" ,rm
Text 30,165, "50",rm
Text 30,115, "100",rm
Text 30,65, "150",rm



Do
Line 32, 165, 320, 165, 1, RGB(grey)
Line 32, 115, 320, 115, 1, RGB(grey)
Line 32, 65, 320, 65, 1, RGB(grey)

temp1

If Pin(gp18) = 1 Then
 shift_draw_buf
Else
 clear_aquire_buf
EndIf

p= Cint((Pin(32)*10000)/9)-370
If p <0  Then p=0
Pause p

Loop

Sub temp1()
 Pin(gp1) = 1
 Pause 200
 Pin(gp1) = 0

 Pin(gp0)=1: Pin(gp0)=0
 temp_raw = 0
 For i=12 To 1 Step -1
   Pin(gp0)=1

   b=1
   For j=2 To i
     b = b*2
   Next j
   so=Pin(gp2)
   temp_raw = temp_raw + (b*so)
   Pin(gp0)=0
 Next i
 Print " TEMP: ", temp_raw, temp_raw*0.25
 Pin(gp0) = 1
 Print Pin(gp2)
 Pin(gp0) = 0

 Pin(gp1)=1
End Sub


Sub clear_aquire_buf
 For i=32 To 320
   Pixel i, buf(i), RGB(black)
   Pixel i,buf2(i), RGB(black)
   buf(i) = 230 - Cint(Pin(31)*50)
   buf2(i) =230 - Cint(Pin(34)*50)
   Pixel i, buf(i), RGB(green)
   Pixel i, buf2(i), RGB(magenta)
 Next i
End Sub

Sub shift_draw_buf
 dat = 230 - Cint(Pin(31)*50)
 dat2 = 230 -Cint(Pin(34)*50)
 For i=32 To 320
  Pixel i, buf(i-1), RGB(black)
  Pixel i, buf2(i-1),RGB(black)
  buf(i-1) = buf(i)
  buf2(i-1)= buf2(i)
  Pixel i, buf(i),RGB(green)
  Pixel i, buf2(i),RGB(magenta)
 Next i
   buf(320)=dat
   buf2(320)=dat2
End Sub


It is very dirty at the moment! I have now added a second channel and support for type-k themperature sensors (max6675). the next thing i want to add is the current sensor ina219 and support for uart. Then i am able to plot / visualize different Data like voltage, current, power, temperature and UART Data. All on two channels! After that i will add printer support for cheap chinese Thermal printer to print the plots :-)
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 06:49pm 09 Jan 2022
Copy link to clipboard 
Print this post

@Vampire05

Just curious; have you made any other speed comparisons between upython and MMBasic?
 
Vampire05
Regular Member

Joined: 06/12/2020
Location: Germany
Posts: 88
Posted: 07:10pm 09 Jan 2022
Copy link to clipboard 
Print this post

no, I have not done that. I prefer mmbasic even if I have to do a lot with python professionally. When it didn't work in basic, I had the hope that micropython/circuitpython is faster. Since it was not faster there right away, I switched back to mmbasic.
Another option would have been a compiler language (bascom).
 
ztoti
Regular Member

Joined: 27/10/2011
Location: Canada
Posts: 65
Posted: 06:34pm 10 Jan 2022
Copy link to clipboard 
Print this post

@Vampire05,
Thank you very much.
 
Vampire05
Regular Member

Joined: 06/12/2020
Location: Germany
Posts: 88
Posted: 09:11pm 10 Jan 2022
Copy link to clipboard 
Print this post

You are welcome ;-)
 
     Page 2 of 2    
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024