|
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 KingdomPosts: 1646 |
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 StatesPosts: 3481 |
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 KingdomPosts: 1646 |
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 KingdomPosts: 10627 |
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 KingdomPosts: 8303 |
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 KingdomPosts: 1646 |
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 KingdomPosts: 1646 |
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 KingdomPosts: 1646 |
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 KingdomPosts: 8303 |
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 KingdomPosts: 10627 |
|
||||
| lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3481 |
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 KingdomPosts: 1646 |
Well, I found the following in the manual: 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 StatesPosts: 3481 |
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 KingdomPosts: 10627 |
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 KingdomPosts: 1646 |
Yay . Many thanks, Pete.Craig |
||||
| Tinine Guru Joined: 30/03/2016 Location: United KingdomPosts: 1646 |
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 StatesPosts: 3481 |
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 KingdomPosts: 1646 |
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 KingdomPosts: 8303 |
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 KingdomPosts: 8303 |
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 |
|||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |