Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Tools
Old 28th June 2004, 12:44 AM   #1
Default I²C and RS232 on the same PIC

Ok friends, first of all, sorry for my bad english, it's not my primary language.

I have an average knowledge of analogic eletronic, but just a little of digital, and need some help on a project. I have to READ and WRITE data from a Real Time Clock (in case, a DS1307) using a PC. I've tryed to do it without a uC, but can't make it work so I decided to use one.

I want run an application (that part - send and receive data from the RS232 on the PC side isn't a problem) on my PC that will send via RS232 a command to the PIC saying:"Write the date/Time XXXXXXXX on the RTC", and the PIC will WRITE it via I²C to the RTC.
Or I will say "Read the Date/Time of the RTC" and the PIC will read it and send it to my application via RS232.
From my researches i found out that a PIC16F628 would be the right choice. Am I right?


It is possible to do that? HOW?
If someone can help me with the code and connections, send me some links, tips, anything would help.
I have seen som examples on how to read/write on I²C EPROMS, and was thiking if I can use a similar schematic, but the main problem than it's the uC code.... please, if some of you have the time to help, i'll apreciate a lot.

i have just found this link:
CODE:
http://web.ukonline.co.uk/j.winpenny/pic/i2c.txt
SCHEMATICS:
http://web.ukonline.co.uk/j.winpenny/pic/e2test2.gif

looks like what i need, but not sure about the RS232 part... looks like it is not implemented on the CODE...any idea?

thanks
l30 is offline  
Old 28th June 2004, 12:55 AM   #2
Default

Nigel's site has scematics and code to do RS232 on a 'F628
www.winpicprog.co.uk
Exo is offline  
Old 3rd July 2004, 04:14 AM   #3
Default

This might be what you are looking for??

App Note 206: Using a PC's RS-232 Serial Port To Communicate with 2-Wire Devices
http://www.maxim-ic.com/appnotes.cfm...te_number/1096

the document is a "how-to" for using a cheap PIC to be a translator between PC and SMBus / I2C ... they even include a windows interface program (with code) and a pre-compiled HEX (with source) for a PIC16FL628

-----
just fyi here is a run down of my serial interface project on a PIC18F series!

pic 18F452 that is currently utilizing 4 serial buses:

Serial output to a serial LCD using a general purpose pin
Dallas 1-Wire I/O using a single general purpose pin
I2C Master Mode I/O using the pic's hardware MSSP ports (2 pins)
RS232 via a max232n using the pic's hardware USART ports (2 pins)

there is an occasional glitch with the rs232 when I try to write to the LCD and the RS232 at the same time, haven't quite figured that out

I'm using Proton PicBasic Plus ... there is a free version on their website that might fit your needs.
glmclell is offline  
Reply

Tags
i²c, pic, rs232

Thread Tools
Display Modes




All times are GMT. The time now is 02:47 PM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker