NXC - Reading temperature from TPA81

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
mightor
Site Admin
Posts: 1079
Joined: 25 Sep 2010, 15:02
Location: Rotterdam, Netherlands
Contact:

Re: NXC - Reading temperature from TPA81

Post by mightor »

I don't own this device, Tiago does. So that would mean that I was wrong in my post on the ROBOTC forums, although it worked fine for Elizabeth. I am not sure what you'd like me to say, though. If I had one of these I would gladly test it, however, I don't so, so there's no way for me to tell why this thing isn't working.

- Xander
| My Blog: I'd Rather Be Building Robots (http://botbench.com)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
docilio
Posts: 5
Joined: 16 Jan 2012, 10:00

Re: NXC - Reading temperature from TPA81

Post by docilio »

afanofosc wrote:The comment at the start of i2c_scanner.c says

Some guy name Xander on another site said this device requires pull-up resistors

http://www.robotc.net/forums/viewtopic. ... 203#p12203

That seems to contradict what was said above.
LOL, Xander is mightor...

Yes, I know that, but that sensor was brought from my store ( nxt4you.com ) and I've sent cables (without resistors) to her.

When we met on Istambul (on Robocup2011) her team won USA qualifications, using those sensors on NXT with RobotC.
Tiago Caldeira
www.nxt4you.com
RobocupJunior Rescue TC for 2012
RobocupJunior Rescue OC Co-Chair for Mexico2012
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: NXC - Reading temperature from TPA81

Post by afanofosc »

All of what you say strongly implies that he's got his wires crossed. Did you guys look at how he has the circuit connected in his picture? If it works when it is wired correctly with picaxe then it absolutely should work without problems with the standard or enhanced NBC/NXC firmware using NXC. If he is getting a bus error then almost certainly his circuit is wrong.

Does his wiring look right or not? I haven't seen either of you answer that question in this thread. If it looks right and he is still getting a bus error, what hardware changes should he try to fix that? I.e., what are the most likely non-obvious hardware problems that could cause an I2C device to have a bus error? What would you try changing when hooking a custom I2C device to your NXT if it doesn't work as it ought to with your programming language of choice?

John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
salgfrancisco
Posts: 10
Joined: 21 Oct 2011, 15:25

Re: NXC - Reading temperature from TPA81

Post by salgfrancisco »

Hello again! So, after a week or so I am back ( I had exams and I really needed to study ) and I can see docilio already has the TPA81 working.
I just checked my circuit using this table in this blog: http://www.stewartallen.org/2010/08/des ... t-sensors/ and it seems everything is properly connected. However, I will download robot-c tomorrow and try to run docilio's code. I will post the results as fast as I can.
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: NXC - Reading temperature from TPA81

Post by afanofosc »

I cannot think of any reason why your circuit could possibly work with RobotC if it does not work with the standard NXT firmware and/or the enhanced NBC/NXC firmware with NXT-G or NXC. If it works with RobotC it is guaranteed to work with NXC. If it doesn't work with NXC it isn't going to work with RobotC either.

I highly recommend that you read Sivan Toledo's I2C tutorial.

http://www.tau.ac.il/~stoledo/lego/i2c-8574/

He writes:

Code: Select all

After I wired the circuit and wrote the program to toggle the LEDs, I ran it and nothing happened. So I added code to display the error codes from the system calls, and discovered that the firmware was reporting error -35, a bus error, which can indicate a device failure. I started to check voltages in the circuit with a voltmeter, and eventually discovered that the chip was not getting the full supply voltage. I looked at it carefully and discovered that I didn't push it all the way into the breadboard.
John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 18 guests