simulate iButton in VSM

jims

Senior Member
#1
I am trying to simulate using an iButton with VSM. Have put together the attached program and schematic. It appears that nothing happens when I run the code. I'm expecting to have the iButton return data. Can't see that there is any activity on the scope attached to C.0 9pin 10) of the PICAXE 20m2. Nothing going out or coming in.
Have successfully run a similar setup with a DS18B20 temp sensor and using the "readtemp" command and there is a good communication between the 20m2 and the DS18B20 sensor. I understand that this is a different setup with a different sensor. BUT!!!
It would sure help me if someone could look at my attached schematic and code.
Thanks in advance,
Jims


[ '#########################################################
'# Code to read a 1 wire device on PICAXE 20M2.
'# Read the device and show "family" code on OLED display.
'#########################################################


symbol device1=C.0 'Read iButton on C.0 (pin 10).
symbol oled= B.7 'OLED display is on B.7 (pin 11).
symbol family=b6 'b6 will contain iButton "family" code
symbol sw1=pinC.1 'C.1 (pin 9).


#picaxe 20m2
'setfreq m4

pause 30








main:
do
loop until sw1 is on
pause 100

readowsn C.0 ; Read the iButton serial number, etc. NOTE: "family" code will be in b6.


serout oled,N2400,(254,128," ") 'Clear OLED line 1

pause 30 'Mandatory pause

serout oled,N2400,(254,128,"FAMILY ",#family) 'Send data to OLED

pause 30 'Mandatory pause

pause 2000 ; Wait a while

goto main ; Repeat ]
 

Attachments

jims

Senior Member
#2
SORRY

Sorry about the way I submitted the code in my thread. I'll try to correct it here.
Code:
	'#########################################################
	'# Code to read a 1 wire device on PICAXE 20M2.
	'# Read the device and show "family" code on OLED display.
	'#########################################################


symbol device1=C.0	'Read iButton on C.0 (pin 10).
symbol oled= B.7 		'OLED display is on B.7 (pin 11).
symbol family=b6		'b6 will contain iButton "family" code
symbol sw1=pinC.1		'C.1 (pin 9).
 

#picaxe 20m2
'setfreq m4

pause 30




 
 


main:
 	 do 
	 loop until sw1 is on
	 pause 100
 
 	readowsn C.0		; Read the iButton serial number, etc. NOTE: "family" code will be in b6.
	
 	
	serout oled,N2400,(254,128,"                ")	'Clear OLED line 1 
	
	pause 30							'Mandatory pause
	
	serout oled,N2400,(254,128,"FAMILY  ",#family)	'Send data to OLED
	
	pause 30							'Mandatory pause
	
	pause 2000		; Wait a while
 
	goto main		; Repeat
Hope it's OK,
Jims
 

hippy

Technical Support
Staff member
#3
I took the provided 'readowsn.dsn' sample and changed that to use a 20M2 and pin C.0 and it all seemed to work okay for me. Scope trace looked as would be expected.

Doesn't explain what's not working, but does show it should.
 

Attachments

jims

Senior Member
#4
I took the provided 'readowsn.dsn' sample and changed that to use a 20M2 and pin C.0 and it all seemed to work okay for me. Scope trace looked as would be expected.

Doesn't explain what's not working, but does show it should.
Thanks, Hippy. You've done it again.
Your schematic has the necessary pull-up resistor on the C.0 line. I hadn't put a pull up on mine. Installed a 47K resistor and it works as I'd hoped it would. You folks are GREAT!
Thank you,
Jims
 

jims

Senior Member
#5
CORRECTION: The resistor is actually a 4K7; NOT a 47K.
Jims
Thanks, Hippy. You've done it again.
Your schematic has the necessary pull-up resistor on the C.0 line. I hadn't put a pull up on mine. Installed a 47K resistor and it works as I'd hoped it would. You folks are GREAT!
Thank you,
Jims
 
Top