Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 04:06 21 Nov 2025 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 : Bit of a TEMPR() tantrum...

     Page 1 of 2    
Author Message
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 02:26pm 07 Jun 2022
Copy link to clipboard 
Print this post

Works great on first run-through but after breaking-out and re-starting, I get "Error : Pin 21 is in use"

Am only able to run again after power-cycling the PicoMite.

Should I be doing some form of reset?





Craig
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3481
Posted: 02:38pm 07 Jun 2022
Copy link to clipboard 
Print this post

What's your code? Picomite? OPTION LIST?
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 02:50pm 07 Jun 2022
Copy link to clipboard 
Print this post

Yeah it's the PicoMite and the only OPTION is the CPUSPEED 250000K



do
   timer =0
   tempr start GP16
       
   do
       if timer > 3000 then exit do
   loop

   PRINT "Temperature: ",TEMPR(GP16)      
loop  
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10627
Posted: 03:07pm 07 Jun 2022
Copy link to clipboard 
Print this post

You are starting a background transaction that locks the pin used and then Ctrl-Cing out before completing the transaction with the tempr function. This is causing the problem. However, I suspect you are also running old firmware as this issue was circumvented in 5.05.04
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 8303
Posted: 03:07pm 07 Jun 2022
Copy link to clipboard 
Print this post

You may not need TEMPR START.

a=TEMPR(sensor_pin) should be ok.

I suspect TEMPR START will lock the pin until you use TEMPR STOP




EDIT:
Peter keeps beating me to replies like this. :)
Edited 2022-06-08 01:09 by Mixtel90
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 03:30pm 07 Jun 2022
Copy link to clipboard 
Print this post

Thanks guys..

I only pulled this PicoMite out of the drawer after smoking the other. Didn't think to check the F/W version and my manual must be out of date because I was looking for something like TEMPR STOP.








Craig
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 03:37pm 07 Jun 2022
Copy link to clipboard 
Print this post

Another question:

I stick the probe in my mug o' tea and every reading is valid. However, as it drops to room temp, I get the occasional "1000" reported. I'm guessing that the probe didn't have enough time or something(?)


Craig
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 03:58pm 07 Jun 2022
Copy link to clipboard 
Print this post

  matherp said  You are starting a background transaction that locks the pin used and then Ctrl-Cing out before completing the transaction with the tempr function. This is causing the problem. However, I suspect you are also running old firmware as this issue was circumvented in 5.05.04


Hmmm, 5.0703 and still have the problem. Even with this orderly exit:


do while inkey$<>"":loop

do
 timer =0
 tempr start GP16
       
 do
   if timer > 3000 then exit do
 loop
       
 PRINT "Temperature: ",TEMPR(GP16)

loop until inkey$<>""



Craig
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 8303
Posted: 04:56pm 07 Jun 2022
Copy link to clipboard 
Print this post


Do while Inkey$<>""
print "Temperature: ";tempr(gp16)
pause 3000
loop


Just using TEMPR() will block interrupts for 200ms. I assume that was what you are trying to avoid?

Returning 1000 indicates a read error.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10627
Posted: 05:09pm 07 Jun 2022
Copy link to clipboard 
Print this post

  Quote  Hmmm, 5.0703 and still have the problem


  Quote  However, I suspect you are also running old firmware as this issue was circumvented in 5.05.04
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3481
Posted: 05:11pm 07 Jun 2022
Copy link to clipboard 
Print this post

Works for me:
Const tpin=29
Do While Inkey$<>"":Loop

Do
Timer =0
TEMPR START tpin

Do
  If Timer > 3000 Then Exit
Loop

Print "Temperature: ",TEMPR(tpin)

Loop Until Inkey$<>""

> RUN
Temperature:     26.5
Temperature:     26.25
> RUN
Temperature:     25.75
Temperature:     25.5
Temperature:     25.5
> ?mm.ver
5.070503
>

PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 05:12pm 07 Jun 2022
Copy link to clipboard 
Print this post

  Mixtel90 said  

Do while Inkey$<>""
print "Temperature: ";tempr(gp16)
pause 3000
loop


Just using TEMPR() will block interrupts for 200ms. I assume that was what you are trying to avoid?

Returning 1000 indicates a read error.


Well, I found the following in the manual:

  Quote  
TEMPR START GP15
< do other tasks >
PRINT "Temperature: " TEMPR(GP15)


I am monitoring a pushbutton at the same time and would prefer it to be instantly responsive.

Not really a problem because nobody will be exiting the finished program....well not intentionally  


Craig
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3481
Posted: 05:22pm 07 Jun 2022
Copy link to clipboard 
Print this post

A bit under 200ms per TEMPR read for 5 reads:

> timer=0:?tempr(29),tempr(29),tempr(29),tempr(29),tempr(29),timer
25.5    25.5    25.5    21.25   21.25   848.905
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10627
Posted: 05:27pm 07 Jun 2022
Copy link to clipboard 
Print this post

This is how I would do it

TEMPR START gp2
SetTick 1000,myint
Do
'process whatever
Loop
'
Sub myint
Print TEMPR(gp2)
TEMPR START gp2
End Sub


This can be interrupted with crtl-C and restarted with no issue on 5.07.04
Edited 2022-06-08 03:28 by matherp
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 06:21pm 07 Jun 2022
Copy link to clipboard 
Print this post

  matherp said  This is how I would do it

TEMPR START gp2
SetTick 1000,myint
Do
'process whatever
Loop
'
Sub myint
Print TEMPR(gp2)
TEMPR START gp2
End Sub


This can be interrupted with crtl-C and restarted with no issue on 5.07.04



Yay    . Many thanks, Pete.






Craig
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 06:39am 08 Jun 2022
Copy link to clipboard 
Print this post

  lizby said  A bit under 200ms per TEMPR read for 5 reads:

> timer=0:?tempr(29),tempr(29),tempr(29),tempr(29),tempr(29),timer
25.5    25.5    25.5    21.25   21.25   848.905


I probably have some kind of syndrome  

Having to double-stab a button due to a slow scan-time would drive me nuts  


Hey, these waterproof sensors are pretty darned cool  






Craig
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3481
Posted: 01:58pm 08 Jun 2022
Copy link to clipboard 
Print this post

  Tinine said  Hey, these waterproof sensors are pretty darned cool  


They are. I've been using one to get the outside temperature for about 8 years.

But noting the topic on fakes/copies/rejects, just don't expect accuracy or consistency between sensors, since I doubt that you can be sure that any if these waterproof DS18B20s are genuine.

~
Edited 2022-06-09 00:00 by lizby
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 06:47pm 08 Jun 2022
Copy link to clipboard 
Print this post

  lizby said  
  Tinine said  Hey, these waterproof sensors are pretty darned cool  


They are. I've been using one to get the outside temperature for about 8 years.

But noting the topic on fakes/copies/rejects, just don't expect accuracy or consistency between sensors, since I doubt that you can be sure that any if these waterproof DS18B20s are genuine.

~


No kidding! I plan to calibrate which is a PITA I could do without  

Client has gotten really serious about these seat heaters...tried to price my way out of the job but that didn't work   Looks like my first order is 200 units and now they're already talking V2.0 to include "a fan"  

Do you get "1000" (bad reading) at the lower temperatures?




Craig
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 8303
Posted: 06:52pm 08 Jun 2022
Copy link to clipboard 
Print this post

According to the TEMPR() function in the 5.07.03 manual, yep.

(I really must print a newer one out...)
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 8303
Posted: 06:58pm 08 Jun 2022
Copy link to clipboard 
Print this post

I got one of these to play with for heatsink temperature monitoring, but it needs an analogue input.
https://www.bitsbox.co.uk/index.php?main_page=product_info&cPath=302_307&products_id=2095
Look at the price though. :)
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
     Page 1 of 2    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025