No temperature readout

nick12ab

Senior Member
But the readi13061ng (a prog written in Liberty Basic) I get these characters instead of the temperature
What program?

This text and the other 5sec text but not readable
What's this?

I have this code working.
The code does appear to work in the simulator. (if the intended output is X.XX) But is T2400 the correct baud mode? As you haven't provided the schematic, no one knows.
 

MartinM57

Moderator
I would write a very simple PICAXE program to send a fixed strings/numbers to your liberty basic program to verify that the PICAXE->PC comms is working as expected...

e.g.

for b0 = 1 to 255
Serout 4, t2400, (#b0)
pause 500
next

What happens if you do that?
 

Depori

New Member
Hello
I've entered your code with the same result all sorts of characters something similar cb § 'or 6BT "or" § f5 and so on in semulator writes 1 2 3 4 5 6 and so on.
this drawing. whether you here more info to haveusbtemperatuur.png
 

Depori

New Member
Hello Hippy
No, not directly but via PICAXE USB prog cable
I have been a few days hopelessly testen.pic or PC are not broken.
In simulator prog everything works but not through program in liberty basic
 

hippy

Technical Support
Staff member
No, not directly but via PICAXE USB prog cable
Then, as nick12ab suggests, you need to use an N2400 baud rate.

You can check the output using Terminal under Programming Editor; does that work ?
 

Depori

New Member
N2400 I have not tested but do certainly do.
basic program was original in liberty but I have converted to. just basic.

' USB Thermometer
' ver 0.4 Richard De Pooter
'
'
'

com$="Com3" 'make XX = your com port number

' Open the serial port
print "Opening serial port..."
open com$; ":2400,n,8,1,ds0,cs0,rs" for random as #commPort



'
' GUI PART
'

' Do not print the main window
nomainwin



[setup.main.Window]

'-----Begin code for #main

WindowWidth = 250
WindowHeight = 150
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=int((DisplayHeight-WindowHeight)/2)


'-----Begin GUI objects code

statictext #main.statictext1, "Temperatuur:", 5, 52, 81, 20
statictext #main.statictext2, "00.00", 95, 17, 130, 65

'-----End GUI objects code

'-----Begin menu code

menu #main, "Help",_
"About", [About],_
"Exit" , [UserQuit]


'-----End menu code

open "USB Temperatuurmeter" for window_nf as #main
print #main, "font ms_sans_serif 10"
print #main.statictext2, "!font century_gothic 36 bold"


' Trap user's quit action
print #main, "trapclose [UserQuit]";


' Set the timer to reald the serial port
timer 500, [ReadSerial]

' Wait for user actions
[UserWait]
print "Wachten op data..."
wait

'
' User Actions part


[ReadSerial]
' Check serial buffer
if lof (#commPort) > 5 then
' We have something in the buffer - check it out
print "Haal data in buffer"
Response$ = input$ (#commPort, 7)
print "Haal Data: "; Response$
' Update the StaticText
print #main.statictext2, Response$
end if

' Wait again...
wait


[About]
' Print some info about the program
notice "Over" + chr$(13) + "USB Temperatuurmeter v0.4" + chr$(13) + "Copyright 2012, door Richard De Pooter"
wait


[UserQuit]
' Exit the application
confirm "Bent u zeker?"; answer$
if answer$ = "no" then wait
close #commPort
close #main
end
 

nick12ab

Senior Member
I'm not going to check that code, since the problem is probably only that you've used T2400 on the PICAXE not N2400.

Why have you not used code tags?
 

eclectic

Moderator
@Depori

I used your program with some changes. (***)

It outputs to an OLED using Serout n2400.

It also outputs to the P.E. Terminal window.

Code:
#picaxe08M
setfreq M4
#terminal 4800 ; switch on terminal screen; **********

; Serout output to OLED display ;********************
' USB Thermometer
' Version: 0.1 by steliosm
' based on original work done by Hippy
'
Symbol TReading = W0
Symbol Whole = B2
Symbol Fract = B3
Symbol SignBit = B4
Symbol Dig = B5
Symbol TempC_100 = W4

Serout 4, n2400, (254,1); clear screen *****
serout 4, n2400, (254,128) ; line 1 ***********

Main:

 high 1
 ReadTemp12 2,TReading
 Gosub Calculate

 ;Serout 4, n2400, (10,13) ;******

 pause 100
 low 1
 pause 2000 ‘wait 5 seconds ;****************

 
 Serout 4, n2400, (254,1); clear screen ***** 
 Serout 4, n2400, (254,128) ; first line ****

 
 Goto Main
 
 
Calculate:

 SignBit = TReading / 256 / 128
 If SignBit = 0 Then Positive
 ' it's negative
 TReading = TReading ^ $ffff + 1

Positive:
 TempC_100 =  TReading * 6 ' TC = value * 0.0625
 TReading = TReading * 25 / 100
 TempC_100 = TempC_100 + TReading
 GoSub DisplayTemp
 Return

DisplayTemp:

 Whole = TempC_100 / 100
 Fract = TempC_100 % 100
 If SignBit = 0 Then DisplayTemp_1 ' Positive temperature

 Serout 4, n2400, ("-") ; *****

DisplayTemp_1:

 Serout 4, n2400, (#Whole, ".") ;******
 Sertxd (#Whole, ".") ; *****

 
 ' be sure the fractional is two digits

 Dig = Fract / 10

 Serout 4, n2400, (#Dig);*****
 Sertxd (#Dig) ; *****

 
 Dig = Fract % 10

 Serout 4, n2400, (#Dig); ****
 Sertxd (#Dig, CR, LF) ;******

 Return
 

Paix

Senior Member
In the circuit diagram, the pin2 (leg 5) connection to the DS18B20 requires a 4k7 pull-up resistor.

I will leave comment about the serial communication arrangements to others, but it seems to need attention :)
 

eclectic

Moderator
In the circuit diagram, the pin2 (leg 5) connection to the DS18B20 requires a 4k7 pull-up resistor.

I will leave comment about the serial communication arrangements to others, but it seems to need attention :)
Ian.

I should have said that I used a 4k7 pullup, in my circuit post#11.

Thanks for the visuals. :)

e
 
Top