HaraldWien
New Member
Servus aus Wien!
(Greetings from Vienna)
I am a PICAXE-Beginner and i would understand how works this mystic Thing.
I try a handshake-Procedure between PICAXE-20M2 and the Temperature-Sensor DS18B20.
I know that "ow..."-Procedures (OneWire) exists on PICAXE-X-Line.
But i will try understand the Basic-functions on my PICAXE-20M2.
The test-circuit is ok, commands "readtemp" and "readtemp12" works well.
I show this page (15) in DS18B20-Datasheet:
And i wrote this PICAXE-Programm for my PICAXE-20M2:
[HR][/HR]
[HR][/HR]
When i am execute the Code between #rem and #endrem i get this Picture from my Oscilloskope:
So i think the pulses are ok: PICAXE send a 500us-Pulse and then after a pause 20us the DS18B20 answers with a 100us-Pulse.
But when i execute the normale Coding (with #rem #endrem is active) the "pulsin"-command can't get the answer-pulse from DS18B20.
Word w2 is value 0 and pin b.0 is value LOW after program ending.
Is there a friend they can say me why this is so?
Many greetings from sunny Vienna
Harald
(Greetings from Vienna)
I am a PICAXE-Beginner and i would understand how works this mystic Thing.
I try a handshake-Procedure between PICAXE-20M2 and the Temperature-Sensor DS18B20.
I know that "ow..."-Procedures (OneWire) exists on PICAXE-X-Line.
But i will try understand the Basic-functions on my PICAXE-20M2.
The test-circuit is ok, commands "readtemp" and "readtemp12" works well.
I show this page (15) in DS18B20-Datasheet:
And i wrote this PICAXE-Programm for my PICAXE-20M2:
[HR][/HR]
Code:
[color=Green]; Progr: p20M2 Test Temperatursenor DALLAS 18B20
; Datum: 2014-09-18
; Autor: HaraldWien
; ***********************************************************[/color]
[color=Navy]#picaxe [/color][color=Black]20m2
init:
[/color][color=Blue]let [/color][color=Purple]dirsB [/color][color=DarkCyan]= [/color][color=Navy]%11111111
[/color][color=Blue]let [/color][color=Purple]dirsC [/color][color=DarkCyan]= [/color][color=Navy]%00000000
[/color][color=Blue]pullup off[/color]
[color=Black]main:
[/color][color=Blue]if [/color][color=Purple]pinC.1 [/color][color=DarkCyan]= [/color][color=Navy]0 [/color][color=Blue]then
pause [/color][color=Navy]10
[/color][color=Blue]goto [/color][color=Black]main
[/color][color=Blue]end if[/color]
[color=Green];#rem
[/color][color=Blue]output c.3
high c.3
pulsout c.3[/color][color=Black],[/color][color=Navy]50
[/color][color=Blue]input c.3
pause [/color][color=Navy]100
[/color][color=Blue]goto [/color][color=Black]main[/color]
[color=Green];#endrem
[/color][color=Blue]low b.0
let [/color][color=Purple]w0 [/color][color=DarkCyan]= [/color][color=Navy]0
[/color][color=Blue]let [/color][color=Purple]w1 [/color][color=DarkCyan]= [/color][color=Navy]0
[/color][color=Blue]let [/color][color=Purple]w2 [/color][color=DarkCyan]= [/color][color=Navy]0
[/color][color=Blue]let [/color][color=Purple]w3 [/color][color=DarkCyan]= [/color][color=Navy]0
[/color][color=Blue]for [/color][color=Purple]b0 [/color][color=DarkCyan]= [/color][color=Navy]1 [/color][color=Blue]to [/color][color=Navy]4 [/color][color=Green]; die 4 Frequenzen
[/color][color=Blue]debug
pause [/color][color=Navy]1000
[/color][color=Blue]select case [/color][color=Purple]b0
[/color][color=Blue]case [/color][color=Navy]1
[/color][color=Blue]let [/color][color=Purple]b7 [/color][color=DarkCyan]= [/color][color=Navy]50
[/color][color=Blue]setfreq m4
case [/color][color=Navy]2
[/color][color=Blue]let [/color][color=Purple]b7 [/color][color=DarkCyan]= [/color][color=Navy]100
[/color][color=Blue]setfreq m8
case [/color][color=Navy]3
[/color][color=Blue]let [/color][color=Purple]b7 [/color][color=DarkCyan]= [/color][color=Navy]200
[/color][color=Blue]setfreq m16
else
let [/color][color=Purple]b7 [/color][color=DarkCyan]= [/color][color=Navy]400
[/color][color=Blue]setfreq m32
endselect
for [/color][color=Purple]b1 [/color][color=DarkCyan]= [/color][color=Navy]0 [/color][color=Blue]to [/color][color=Navy]1 [/color][color=Green]; Art der Pulserkennung f?r pulsin
[/color][color=Blue]for [/color][color=Purple]b2 [/color][color=DarkCyan]= [/color][color=Navy]0 [/color][color=Blue]to [/color][color=Navy]100 [/color][color=Green]; Pause zwischen pulsout und pulsin
[/color][color=Blue]output c.3
high c.3
pulsout c.3[/color][color=Black],[/color][color=Purple]b7
[/color][color=Blue]input c.3
pauseus [/color][color=Purple]b2
[/color][color=Blue]pulsin c.3[/color][color=Black],[/color][color=Purple]b1[/color][color=Black],[/color][color=Purple]w2
[/color][color=Blue]pause [/color][color=Navy]800
[/color][color=Blue]if [/color][color=Purple]w2 [/color][color=DarkCyan]<> [/color][color=Navy]0 [/color][color=Blue]then
high b.0
exit
end if
next
if [/color][color=Purple]w2 [/color][color=DarkCyan]<> [/color][color=Navy]0 [/color][color=Blue]then
exit
end if
next
if [/color][color=Purple]w2 [/color][color=DarkCyan]<> [/color][color=Navy]0 [/color][color=Blue]then
exit
end if
next
debug
pause [/color][color=Navy]1000
[/color][color=Blue]goto [/color][color=Black]main [/color]
When i am execute the Code between #rem and #endrem i get this Picture from my Oscilloskope:
So i think the pulses are ok: PICAXE send a 500us-Pulse and then after a pause 20us the DS18B20 answers with a 100us-Pulse.
But when i execute the normale Coding (with #rem #endrem is active) the "pulsin"-command can't get the answer-pulse from DS18B20.
Word w2 is value 0 and pin b.0 is value LOW after program ending.
Is there a friend they can say me why this is so?
Many greetings from sunny Vienna
Harald