CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

PIC connected to a PC through SMbus

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Patrik Berglund
Guest







PIC connected to a PC through SMbus
PostPosted: Wed Mar 12, 2003 11:03 am     Reply with quote

Hi!

Some circuits on a modern PC-motherboard communicates through SMbus. To keep it simple, I wan't to connect my 16F877 to this bus and read data from a winbond chip. I have read the 16F877 datasheet, but I didn't get much wiser.

I´m using PCW 2.660

Any good ideas?
___________________________
This message was ported from CCS's old forum
Original Post ID: 12572
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: PIC connected to a PC through SMbus
PostPosted: Wed Mar 12, 2003 1:10 pm     Reply with quote

:=Hi!
:=
:=Some circuits on a modern PC-motherboard communicates through SMbus. To keep it simple, I wan't to connect my 16F877 to this bus and read data from a winbond chip. I have read the 16F877 datasheet, but I didn't get much wiser.
:=
:=I´m using PCW 2.660
-----------------------------------------------------------

I haven't used a SMBus device, but it's very similar to i2c.
Here's an appnote which compares the two:
<a href="http://www.maxim-ic.com/appnotes.cfm/appnote_number/356/ln/en" TARGET="_blank">http://www.maxim-ic.com/appnotes.cfm/appnote_number/356/ln/en</a>

I suggest that you enable the SMBus levels, by setting the
CKE bit. Then use PIN_C4 for SDA and PIN_C3 for SCL.
Then use the built-in software i2c functions of the compiler.
(Your version of the compiler does not support hardware i2c).

Example:

<PRE>
#include <16F877.h>
#fuses HS, NOWDT, NOPROTECT,PUT,BROWNOUT, NOLVP
#use Delay(clock=8000000)
#use i2c(Master, SDA=PIN_C4, SCL=PIN_C3)
<BR>
#bit CKE_BIT = 0x94.6
<BR>
main()
{
CKE_BIT = 1; // Enable SMBus levels
<BR>
// Access your i2c device with the CCS i2c functions.
i2c_write(0xA0);
i2c_write(addr);
// etc.
<BR>
<BR>
while(1);
}
</PRE>
___________________________
This message was ported from CCS's old forum
Original Post ID: 12579
Patrik Berglund
Guest







Re: PIC connected to a PC through SMbus
PostPosted: Thu Mar 13, 2003 8:31 am     Reply with quote

:=:=Hi!
:=:=
:=:=Some circuits on a modern PC-motherboard communicates through SMbus. To keep it simple, I wan't to connect my 16F877 to this bus and read data from a winbond chip. I have read the 16F877 datasheet, but I didn't get much wiser.
:=:=
:=:=I´m using PCW 2.660
:=-----------------------------------------------------------
:=
:=I haven't used a SMBus device, but it's very similar to i2c.
:=Here's an appnote which compares the two:
:= <a href="http://www.maxim-ic.com/appnotes.cfm/appnote_number/356/ln/en" TARGET="_blank"> <a href="http://www.maxim-ic.com/appnotes.cfm/appnote_number/356/ln/en" TARGET="_blank">http://www.maxim-ic.com/appnotes.cfm/appnote_number/356/ln/en</a></a>
:=
:=I suggest that you enable the SMBus levels, by setting the
:=CKE bit. Then use PIN_C4 for SDA and PIN_C3 for SCL.
:=Then use the built-in software i2c functions of the compiler.
:=(Your version of the compiler does not support hardware i2c).
:=
:=Example:
:=
:=<PRE>
:=#include <16F877.h>
:=#fuses HS, NOWDT, NOPROTECT,PUT,BROWNOUT, NOLVP
:=#use Delay(clock=8000000)
:=#use i2c(Master, SDA=PIN_C4, SCL=PIN_C3)
:=<BR>
:=#bit CKE_BIT = 0x94.6
:=<BR>
:=main()
:={
:=CKE_BIT = 1; // Enable SMBus levels
:=<BR>
:=// Access your i2c device with the CCS i2c functions.
:=i2c_write(0xA0);
:=i2c_write(addr);
:=// etc.
:=<BR>
:=<BR>
:=while(1);
:=}
:=</PRE>

Thanks :)

Now i just got to figure out what adress the winbond chip uses. Btw, the SMbus is probably used by som integrated chips on the motherboard. Is there somthing I should think about before connecting the pic to the SMbus ?
___________________________
This message was ported from CCS's old forum
Original Post ID: 12616
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: PIC connected to a PC through SMbus
PostPosted: Thu Mar 13, 2003 1:05 pm     Reply with quote

:=:=:=Hi!
:=:=:=
:=:=:=Some circuits on a modern PC-motherboard communicates through SMbus. To keep it simple, I wan't to connect my 16F877 to this bus and read data from a winbond chip. I have read the 16F877 datasheet, but I didn't get much wiser.
:=:=:=
:=:=:=I´m using PCW 2.660
:=:=-----------------------------------------------------------
:=:=
:=
:=Now i just got to figure out what adress the winbond chip uses. Btw, the SMbus is probably used by som integrated chips on the motherboard. Is there somthing I should think about before connecting the pic to the SMbus ?
-------------------------------------------------------------

If you connect your PIC to an existing SMbus on the
PC motherboard, there could be a problem. That bus will
already have a "bus master" on it. It will likely have one
master, and several slave devices. If you try to put another
master (your PIC) on the bus, there could be bus "collisions".
(The motherboard master, and your PIC could try to use the
bus at the same time). The motherboard might not work with a
2nd master on the bus.
___________________________
This message was ported from CCS's old forum
Original Post ID: 12632
Patrik Berglund
Guest







Re: PIC connected to a PC through SMbus
PostPosted: Thu Mar 13, 2003 2:11 pm     Reply with quote

:=:=:=:=Hi!
:=:=:=:=
:=:=:=:=Some circuits on a modern PC-motherboard communicates through SMbus. To keep it simple, I wan't to connect my 16F877 to this bus and read data from a winbond chip. I have read the 16F877 datasheet, but I didn't get much wiser.
:=:=:=:=
:=:=:=:=I´m using PCW 2.660
:=:=:=-----------------------------------------------------------
:=:=:=
:=:=
:=:=Now i just got to figure out what adress the winbond chip uses. Btw, the SMbus is probably used by som integrated chips on the motherboard. Is there somthing I should think about before connecting the pic to the SMbus ?
:=-------------------------------------------------------------
:=
:=If you connect your PIC to an existing SMbus on the
:=PC motherboard, there could be a problem. That bus will
:=already have a "bus master" on it. It will likely have one
:=master, and several slave devices. If you try to put another
:=master (your PIC) on the bus, there could be bus "collisions".
:=(The motherboard master, and your PIC could try to use the
:=bus at the same time). The motherboard might not work with a
:=2nd master on the bus.


I thought the SMbus used arbitration ?
___________________________
This message was ported from CCS's old forum
Original Post ID: 12635
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: PIC connected to a PC through SMbus
PostPosted: Thu Mar 13, 2003 2:35 pm     Reply with quote

:=:=:=:=:=Hi!
:=:=:=:=:=
:=:=:=:=:=Some circuits on a modern PC-motherboard communicates through SMbus. To keep it simple, I wan't to connect my 16F877 to this bus and read data from a winbond chip. I have read the 16F877 datasheet, but I didn't get much wiser.
:=:=:=:=:=
:=:=:=:=:=I´m using PCW 2.660
:=:=:=:=-----------------------------------------------------------
:=:=:=:=
:=:=:=
:=:=:=Now i just got to figure out what adress the winbond chip uses. Btw, the SMbus is probably used by som integrated chips on the motherboard. Is there somthing I should think about before connecting the pic to the SMbus ?
:=:=-------------------------------------------------------------
:=:=
:=:=If you connect your PIC to an existing SMbus on the
:=:=PC motherboard, there could be a problem. That bus will
:=:=already have a "bus master" on it. It will likely have one
:=:=master, and several slave devices. If you try to put another
:=:=master (your PIC) on the bus, there could be bus "collisions".
:=:=(The motherboard master, and your PIC could try to use the
:=:=bus at the same time). The motherboard might not work with a
:=:=2nd master on the bus.
:=
:=
:=I thought the SMbus used arbitration ?
---------------------------------

The spec does say it uses arbitration. I haven't used
the bus before, so I just gave you some of my concerns I had,
without reading the spec.
<a href="http://www.smbus.org/specs/smbus110.pdf" TARGET="_blank">http://www.smbus.org/specs/smbus110.pdf</a>
___________________________
This message was ported from CCS's old forum
Original Post ID: 12636
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group