![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
Hi all.
Im creating a temp sensor project. I want to have 2 devices (both pic based), 1 as the master, and 1 as the slave. The number of slaves is going to be variable, but im just starting off with 1. Im using c18 with Pic18f4550s, and wish to use I2c bus to allow master to talk to slaves. I intend to make the project scalable, by allowing more functions to be added to each slave at a later date. i need to come up with some sort of "language" that all devices can use to speak to each other. For instance I want to be able to query a slave devices capabilities, and then react based on the slaves response. Does anyone have any thoughts on constructing such a language, that will allow for structures of information to be sent serially? It would be nice to have some sort of struct to serial and serial to struct conversion routines, but i need something quick to implement Many thanks
__________________
Chris Last edited by HerbertMunch; 7th June 2008 at 10:53 AM. |
|
|
|
|
|
|
(permalink) |
|
Do you need a multi processor design ?
Could you use dallas 1 wire sensors ? You did not say what language you were using. Take a look at tpl: serialization for C programs It should do what you want. I am not sure about the size of the library. Let us know if it will work.
__________________
search engine for electronic partsJunebug USB PIC programmer kit., USB Bit Wacker, Homepage The 15 Minute Printed Circuit Board! (+drill time) |
|
|
|
|
|
|
(permalink) |
|
hi mate,
I want to do it that way so that i can delegate processing work and reduce the amount of wires needed (i.e it would take the same amount of wires travelling to the main unit to do 10+ sensors as it would 1. 4 wires total for many sensors) I looked at that page about serialisation, but it doesnt mention pics. Thanks.
__________________
Chris Last edited by HerbertMunch; 7th June 2008 at 06:37 PM. |
|
|
|
|
|
|
(permalink) |
|
When you initiate the slaves, you could load the buffer with a config setting like..
Psuedo code: slaveconfig(1) = b'abcdefgh' a = 1 ;temp sensor present/not present b = 1 ;eeprom present/not present c = 0 ;humidity sensor present/not present etc. Then have the master read each slaves buffer at startup to discover their capabilities. Not sure about how you would do that without first knowing the slaves address first tho. |
|
|
|
|
|
|
(permalink) | ||
|
Chris,
FWIW the 1 wire bus is a serial multidrop bus. You can hang quite a few (forget the number) of sensors on a single twisted pair. Quote:
Quote:
__________________
search engine for electronic partsJunebug USB PIC programmer kit., USB Bit Wacker, Homepage The 15 Minute Printed Circuit Board! (+drill time) |
|||
|
|
|
|
|
(permalink) |
|
Ok, thankyou very much both of you for your thoughts
__________________
Chris |
|
|
|
|
|
|
(permalink) |
|
You might check out DF4OR's Icom CI-V pages. CI-V is a TTL level serial protocol (short distances) using standard RS-232 async' baud rates on a bi-directional one wire bus. It's used on several different Icom Amateur Radio products and add-on communications products.
Mike |
|
|
|
|
|
|
(permalink) |
|
ok thanks mike
__________________
Chris |
|
|
|
|
|
|
(permalink) |
|
You're welcome.
I thought it was an interesting protocol model with its two byte <preamble>, <to> and <from> address bytes, <cmd> and <data> bytes, and an <end-of-packet> byte. Unfortunately it also limits you to using data which does not include the <preamble> or <end-of-packet> bytes. Regards, Mike |
|
|
|
|
| Bookmarks |
| Tags |
| i2c pic serial c18 |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| Help with PIC-PIC communication | RIP_Polaris | Micro Controllers | 6 | 6th December 2007 12:21 PM |
| PIC communication | Electronics4you | General Electronics Chat | 3 | 22nd February 2007 04:57 PM |
| PC to PC communication, | raxith | General Electronics Chat | 1 | 17th February 2006 01:07 PM |
| PIC to PC communication. | ANUPAMA | Micro Controllers | 1 | 14th May 2004 01:20 PM |
| PIC to PC communication. | ANUPAMA | Micro Controllers | 8 | 7th May 2004 08:51 AM |