| Author |
Message |
|
squiggy
Rookie
Joined: Fri Apr 20, 2007 3:22 am Posts: 36
|
these are some basic functions.
first the header
then a test program
to read an input the PCF8574A pins must first be set high. The input will drive them low.
The read function does this using a mask. So if you just want to read the first four pins, you would call var = readPCF8574A(0x0F) etc.
if you want to use the PCF8574A's outputs use the writePCF8574A function. The bits in the byte message corrispnd to the io pins on the PCF8574A
It's actually really simple.
As I said in my previous post, the addressing needs to be set on the board. Pulling all the adress pins(pads) low will give you the defualt address of Ox70.
|
| Wed Jun 04, 2008 12:08 am |
|
 |
|
mightor
Moderator
Joined: Wed Mar 05, 2008 8:14 am Posts: 2864 Location: Rotterdam, The Netherlands
|
Hey thanks for that! I will be sure to play with it once the I2C bugs have been ironed out of the Betas.
Regards,
Xander
_________________| Some people, when confronted with a problem, think, "I know, I'll use threads," | and then two they hav erpoblesms. (@nedbat)| My Blog: I'd Rather Be Building Robots| ROBOTC 3rd Party Driver Suite: [ Project Page]
|
| Wed Jun 04, 2008 12:33 am |
|
 |
|
docilio
Expert
Joined: Sun Sep 09, 2007 10:12 am Posts: 116
|
thanks squiggy, thanks all
I will now test it with the 1.38B1... and i hope that it works...
Any other sugestion?
|
| Tue Jun 10, 2008 4:24 am |
|
 |
|
squiggy
Rookie
Joined: Fri Apr 20, 2007 3:22 am Posts: 36
|
if it doesn't work let us know.
I haven't down loaded the beta, so I can can't test it, but the code is good with the current release.
|
| Thu Jun 12, 2008 2:36 pm |
|
 |
|
mightor
Moderator
Joined: Wed Mar 05, 2008 8:14 am Posts: 2864 Location: Rotterdam, The Netherlands
|
Hey there,
I tried it but it is not working. I am not sure if this is because I am not understanding the addressing pads or what? I didn't do anything with them, left all the little pads, A0-A2 alone. What address would it be using then?
Regards,
Xander
_________________| Some people, when confronted with a problem, think, "I know, I'll use threads," | and then two they hav erpoblesms. (@nedbat)| My Blog: I'd Rather Be Building Robots| ROBOTC 3rd Party Driver Suite: [ Project Page]
|
| Wed Jun 18, 2008 3:09 pm |
|
 |
|
docilio
Expert
Joined: Sun Sep 09, 2007 10:12 am Posts: 116
|
Don't work also here...
i connected a0 to a2 on ground (000)
|
| Wed Jun 18, 2008 3:36 pm |
|
 |
|
mightor
Moderator
Joined: Wed Mar 05, 2008 8:14 am Posts: 2864 Location: Rotterdam, The Netherlands
|
OK, I got it working without shorting any of the pads. I was trying to use write() but that didn't work. Probably because I wasn't quite sure what I was doing yet. Anyway, I hooked up a microswitch to a breadboard and got that working with the read program. Hurray!
Thanks for the program
Regards,
Xander
_________________| Some people, when confronted with a problem, think, "I know, I'll use threads," | and then two they hav erpoblesms. (@nedbat)| My Blog: I'd Rather Be Building Robots| ROBOTC 3rd Party Driver Suite: [ Project Page]
|
| Wed Jun 18, 2008 3:39 pm |
|
 |
|
docilio
Expert
Joined: Sun Sep 09, 2007 10:12 am Posts: 116
|
nothing working here... and example of assembly and code?
Just testing
|
| Wed Jun 18, 2008 5:27 pm |
|
 |
|
squiggy
Rookie
Joined: Fri Apr 20, 2007 3:22 am Posts: 36
|
the pads set the address.
They must either be dropped low, connected to ground, or pulled high, connected to 5volts power.
I would suggest grounding them.
They are the three sets of three pads on the back of the circut board near the jack connector dingus.
The pad nearest the edge is ground, middle is the pin, and the inner most is 5 volts.
Just use a little solder to jump the jap between the ground and pin pad.
That will give you an address of 0x70
I can post a picture if that doesn't make sense.
|
| Wed Jun 18, 2008 6:52 pm |
|
 |
|
squiggy
Rookie
Joined: Fri Apr 20, 2007 3:22 am Posts: 36
|
Actualy, if someone's not using the mind sensors boards little me explain a little more.
Pins A0-A2 are the addressing pins.
The base address of the the PCF8574A is 0x70. The PCF8574 is different, you'd have to look at it's data sheet to see what it is. Mindsensors data sheet is for the PCF8574 but they give you the PCF8574A. You have to look at the chip to see wich one you have. I spent four days trying to get mine to work before I fugured that out.
Anyway, if all the addressing pins (A0-A2) are connected to ground you get the base address of 0x70. If you connect A0 to 5 volts, it changes the address to 0x72. Connecting A1 to 5 volts changes it to 0x74. A1 and A@ to 5 volts gives you 0x76.
Its just a binary setting. It skips odd numbers because of the way I2C communications are structured. The address is passed in the comand byte and the lowest bit of that byte is the command operation, read or write. Then seven highest bits are the address device address.
What chip do you have, docilio?
Are you using the mindsensors board?
|
| Wed Jun 18, 2008 7:10 pm |
|
 |
|
docilio
Expert
Joined: Sun Sep 09, 2007 10:12 am Posts: 116
|
Sorry, it seams similar to what i got, a picture would be nice.
I only want to understand how to get info about anything conected on the circuit, with an robotc example
|
| Wed Jun 18, 2008 7:22 pm |
|
 |
|
squiggy
Rookie
Joined: Fri Apr 20, 2007 3:22 am Posts: 36
|
Let me ask you again are you using the mindsensors PCF8574?
I just want to make sure. =)
I'll post a picture tonight when I get home
|
| Wed Jun 18, 2008 8:02 pm |
|
 |
|
docilio
Expert
Joined: Sun Sep 09, 2007 10:12 am Posts: 116
|
that's the one... tomorrow i test it... thanks
|
| Wed Jun 18, 2008 8:38 pm |
|
 |
|
squiggy
Rookie
Joined: Fri Apr 20, 2007 3:22 am Posts: 36
|
Here's a picture, hope it's not too large
http://home.comcast.net/~squig/pics/pcf8574-nx.jpg
The sample I posted in this thread should work. There's a header and then a sample program.
Are you trying to output or input?
|
| Wed Jun 18, 2008 11:42 pm |
|
 |
|
mightor
Moderator
Joined: Wed Mar 05, 2008 8:14 am Posts: 2864 Location: Rotterdam, The Netherlands
|
Thanks for the picture. I noticed that those pins are connected with a very narrow strip already. Do I need to add the solder on top of that or will the default suffice?
Regards,
Xander
_________________| Some people, when confronted with a problem, think, "I know, I'll use threads," | and then two they hav erpoblesms. (@nedbat)| My Blog: I'd Rather Be Building Robots| ROBOTC 3rd Party Driver Suite: [ Project Page]
|
| Thu Jun 19, 2008 12:42 am |
|
|
Who is online |
Users browsing this forum: No registered users and 4 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|