Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 22:00 17 May 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 : Shelling Out..?

Author Message
Zonker

Guru

Joined: 18/08/2012
Location: United States
Posts: 761
Posted: 04:43pm 23 Jan 2017
Copy link to clipboard 
Print this post

Evening Gent's...

I wanted to check this with everyone, because it's probably something stupid I am doing.. But, maybe not.... I finally got some playtime in Sunday with the new beta code (v5.3B10) and was starting to build a simple setup screen for the RTC...

The Car facts:

I am running on an E-100 board with the RTC module installed in back. I have a SDD1963 based 4.3" LCD, passing all tests, touched calibrated with click sound, SD card pushed in and confirmed working...


' RTC Setup Test

Const time_display_box=1
Const yer_val_box=2
Const yer_label_box=3
Const mth_val_box=4
Const mth_label_box=5
Const day_val_box=6
Const day_label_box=7
Const hrs_val_box=8
Const hrs_label_box=9
Const min_val_box=10
Const min_label_box=11

'Dim old_date As string length 10
'Dim old_time As string length 10
'Dim not_touched =1

CLS

GUI setup 1
GUI displaybox time_display_box,0,0,300,20,RGB(yellow),RGB(black)
CtrlVal(time_display_box)="test"

Font 5
GUI numberbox yer_val_box,20,30,100,50,RGB(yellow),RGB(blue)
CtrlVal(yer_val_box)=Val(Mid$(Date$,7,4)) ' extract year data

Font 1
GUI interrupt pen_down,pen_up
SetTick 1000,check_time

Do

Loop

Sub check_time
'Do
'refresh_line=GetScanLine()
'Print refresh_line
'Loop While refresh_line<50
Print Time$
'Print refresh_line
CtrlVal(time_display_box)=Time$
End Sub

Sub MM.KEYPRESS ref As integer, caption As string
Print caption
If ref=yer_val_box And caption="Ent" Then
If Val(CtrlVal(yer_val_box))>4000 Then CtrlVal(yer_val_box)="4000"
If Val(CtrlVal(yer_val_box))<0 Then CtrlVal(yer_val_box)="0"
EndIf
EndIf
End Sub

Sub pen_down
Print "down"
End Sub

Sub pen_up
Print "up"
End Sub


This where I got so far...

Now, when I run this, I get whats expected on the time_display_box object...

I touched a blank area of the screen to generate a few pen "down-up" events..
So far, so good...
Then I touch the yer_val_box and enter the new year data.. I hit the "Ent" button and get what I expect back into yer_val_box...

But then I notice the interrupts are no longer working...
Humm... Now, it took a few tries and head scratching, but, I finally noticed it..





In this "snip" pix, notice the "command prompt" ..
Yep, the program is still runing ok, but, the firmware has returned, and (not shown here), you can type commands and the firmware answers back, AND the yer_val_box is still active and working too..! However, the rest of the INT subs are no longer active... Not sure whats going on here..

The program should stay trapped in the Do loop...

I can continue building, but was wondering if anyone else have seen this behavior..?

But, maybe it's just something stupid I am doing..!

BTW - What is the correct numbers to enter for the GETSCANLINE function..?

Thanks for any feedback on this stuff..!!

 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1664
Posted: 05:14pm 23 Jan 2017
Copy link to clipboard 
Print this post

Think I found that the GUI will continue to run in the background even after the main code is terminated.

A while back I played with that though, but have experienced something similar.

Phil
 
Zonker

Guru

Joined: 18/08/2012
Location: United States
Posts: 761
Posted: 05:19pm 23 Jan 2017
Copy link to clipboard 
Print this post

But... I didn't press control C..!! It just "shells out" on it's own...

The only thing that gets things back to working, is to type "edit"..

Then, the GUI stops and after exiting, things are back to normal...

 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 844
Posted: 05:25pm 23 Jan 2017
Copy link to clipboard 
Print this post

Is there a stray END IF in there?



Sub MM.KEYPRESS ref As integer, caption As string
Print caption
If ref=yer_val_box And caption="Ent" Then
If Val(CtrlVal(yer_val_box))>4000 Then CtrlVal(yer_val_box)="4000"
If Val(CtrlVal(yer_val_box))<0 Then CtrlVal(yer_val_box)="0"
EndIf
EndIf
End Sub


Latest F4 Latest H7
 
Zonker

Guru

Joined: 18/08/2012
Location: United States
Posts: 761
Posted: 05:35pm 23 Jan 2017
Copy link to clipboard 
Print this post

oops... Will try it..

Nope, acts the same way... Humm...

It shells out after I press the first key on the number entry pad...

Well, will keep playing... Getting late here... Time for some rack...

Thanks for the feedback..!


 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5923
Posted: 06:30pm 23 Jan 2017
Copy link to clipboard 
Print this post

I can repeat the error on a Explore64 with 5.3beta3

When I bring up the keypad I can move between the ALT and normal screens.
If I press on "CAN" caption gets the value of "Ent". That doesn't seem right.

After printing the value of caption, the program exits with the following error:
  Quote  
15:07:39
Ent
[35] Loop
Error: FOR with misplaced = or TO
>

There are NO FOR's in the program at all.

If I press a number on the keypad, the main program exits to the command prompt without any error message.

Jim
VK7JH
MMedit   MMBasic Help
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1664
Posted: 06:40pm 23 Jan 2017
Copy link to clipboard 
Print this post

MM.KEYPRESS?

Is that a new internal variable or Sub name?

Haven't heard of it & don't get any search hits in either the 5.2 manuals or in the forum.

Phil.

Edit:-

Just found it in the 5.3 Beta manual.Edited by Phil23 2017-01-25
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1664
Posted: 06:51pm 23 Jan 2017
Copy link to clipboard 
Print this post

Don't have 5.3 loaded here to play with by wondering if Sub pen_up is breaking you out of MM.KEYPRESS?
 
StoveMan
Regular Member

Joined: 29/03/2013
Location: United States
Posts: 51
Posted: 07:39pm 23 Jan 2017
Copy link to clipboard 
Print this post

Do we still need Ireturn from interrupt routine or will end sub work?
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9081
Posted: 07:52pm 23 Jan 2017
Copy link to clipboard 
Print this post

End Sub works.

This sounds like a little bug that needs squishing to me....
Smoke makes things work. When the smoke gets out, it stops!
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5923
Posted: 08:03pm 23 Jan 2017
Copy link to clipboard 
Print this post

I loaded the pump control demo program from the manual.
It runs OK
I added this to the end:
  Quote  SUB MM.KEYPRESS ref AS INTEGER, caption AS STRING
IF ref = nbr_hi AND caption = "Ent" THEN
IF VAL(CtrlVal(nbr_hi)) > 20 THEN CtrlVal(nbr_hi) = "20"
ENDIF
END SUB


The main program now exits like in Zonker's program and the GUI elements keep running.

The MM.KEYPRESS sub still runs as if it's a library function.

Jim
VK7JH
MMedit   MMBasic Help
 
Print this page


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

© JAQ Software 2024