PalaniKasi
Posts: 52
Joined: Mon Dec 14, 2015 1:51 pm

How to controll DS2413 two GPIOS

Thu Jun 23, 2016 9:15 am

Hey guys,
I'm interfacing DS2413 chip for controlling two GPIOs through one wire...I was struggling with writing data and getting output.since it has a family code 3A.In the /sys/bus/w1/devices/3a-0000000181f8b folder there are four files are available.
driver
id
name
power
rw
subsystem
uevent
my question is where to write instruction and how to get output....Thanks in advance...


Regards,
Palanikasi

PalaniKasi
Posts: 52
Joined: Mon Dec 14, 2015 1:51 pm

Re: How to controll DS2413 two GPIOS

Fri Jun 24, 2016 4:46 am

This is my simple code for setting PIOA pin in 2413..But when i check with multimeter the pin voltage is zero only...

Code: Select all

import os
import time
os.system('modprobe w1-gpio)
os.system('modprobe w1-therm')
temp_sensor="/sys/bus/w1/devices/3a-000000181f8b/rw"
def data():
      f=open(temp_sensor,'w')
      f.wite("/x5A")
      f.write("/x01")
      f.close()
data()

SonOfAMotherlessGoat
Posts: 690
Joined: Tue Jun 16, 2015 6:01 am

Re: How to controll DS2413 two GPIOS

Fri Jun 24, 2016 4:50 am

Do you have more code that you reference? You've assigned 'f' to an object opening another object named 'temp_sensor' but it doesn't look like you've specified what 'temp_sensor' is.

Edit: Ah, Stealth Edit! Now it's there.
Account Inactive

SonOfAMotherlessGoat
Posts: 690
Joined: Tue Jun 16, 2015 6:01 am

Re: How to controll DS2413 two GPIOS

Fri Jun 24, 2016 4:56 am

I would suggest following Dougie's advice over on the thread at viewtopic.php?f=44&t=92700
Account Inactive

PalaniKasi
Posts: 52
Joined: Mon Dec 14, 2015 1:51 pm

Re: How to controll DS2413 two GPIOS

Fri Jun 24, 2016 5:02 am

That temp_sensor define the path of my rw file which is present inside the driver.i'm writing FE followed by FA for setting pin to high based on the datasheet....But its not at all showing any voltage at the PIO pins

SonOfAMotherlessGoat
Posts: 690
Joined: Tue Jun 16, 2015 6:01 am

Re: How to controll DS2413 two GPIOS

Fri Jun 24, 2016 5:11 am

Can you post a link to the datasheet, the one from Max has a different set of hex codes?
Account Inactive


SonOfAMotherlessGoat
Posts: 690
Joined: Tue Jun 16, 2015 6:01 am

Re: How to controll DS2413 two GPIOS

Fri Jun 24, 2016 5:25 am

Thanks, just looking over the code, you're missing a terminating apostrophe:

Code: Select all

os.system('modprobe w1-gpio)

os.system('modprobe w1-gpio')
but that's probably not the problem.
Account Inactive

PalaniKasi
Posts: 52
Joined: Mon Dec 14, 2015 1:51 pm

Re: How to controll DS2413 two GPIOS

Fri Jun 24, 2016 5:29 am

Actually those two lines are not required...

SonOfAMotherlessGoat
Posts: 690
Joined: Tue Jun 16, 2015 6:01 am

Re: How to controll DS2413 two GPIOS

Fri Jun 24, 2016 6:12 am

I'm assuming that the code you posted isn't the code you are running then, as Python wouldn't get past that closing apostrophe.

Sorry, got sidetracked, reading the PDF.
Account Inactive

Return to “Advanced users”