Hey,
i have a project that i am busy with and i was told to use CAN bus since i'll be using different circuit and each one has its own microcontroller. I have never used or came across CAN BUS, i tried to searching but the answers do not certisfy my questions. I want to know how to use and how to make one for my circuits.

What do your teacher want you to control? Think about your CAN BUS as some sort of network. The units on the network can communicate with each other. CAN was in the beginning an automotive system. But have found other areas for use later. The picture shows a typical CAN setup.

okay i do get that, so i want to know if i have to use a cable to connect my circuits together, do i need a specific programmed chip for that cable or it will be just all positives connected to the positive of my cable and negatives also to negative of the cable.I dont understand please help.
I have two circuits, the compressor circuit and an air reservoir circuit. For compressor circuit, using 4 compressors:
· 24 hours is the total hours allocated to these four compressors to share. Each compressor will run for 6 hours.
· When supplying power to the compressor circuit these compressors will start to run in sequence according to their numbering (e.g. compressor 1, 2, 3 etc.)
· A temperature sensor is placed on each compressor, so that no compressor will over heat. When a compressor reaches 45 degrees Celsius, it will turn off (even though 6 hours is not over) and swap to the next compressor. This is in case it gets too hot, but at a normal temperature the compressors will be able to run the full six hours each.
· If compressor 1 starts running, and within 3 hours the air tank is filled, the compressor will stop running. Whenever the tank is empty and requires air the same compressor will run again for the next 3 hours. After that it will have exhausted its 6 hours. The next compressor will start to run.
· In order for this compressor to know when to start running and to stop running, the compressor microcontroller will receive an instruction from the air reservoir microcontroller. It will either be the message that says HIGH (start the compressor) or LOW (stop the compressor).
For an air reservoir circuit, prssure switch for each compressor:
· Each pressure switch turns a compressor ON and OFF. (The pressure switches have to be set to certain specifications. In this case the pressure switches are set to 100KPa as maximum and 40KPa as minimum. When the pressure reaches maximum (100KPa), the switch turns its compressor OFF, if it falls below minimum (40KPa) it turns the compressor ON.)
· The pressure gauge is connected to the storage/air receiver tank to give us pressure readings whenever we want to check the pressure in the storage/ air receiver tank.
· On the operations and functions of a compressor circuit, 24 hours is the total time given to four compressors to run, and each compressor runs for six hours. Since pressure switches control compressors, 24 hours will be the total time allocated to these four pressure switches and each will run for six hours.
· The air reservoir microcontroller receives a message from one of the pressure switches, and then sends an instruction to the compressor microcontroller to turn the compressor ON or OFF.
· When filling up a tank, the first pressure switch will switch on the compressor and keep it ON until the tank reaches maximum and switch it OFF again. As long as six hours hasn’t passed, the same switch will still switch the same compressor on and off. The process will continue until six hours passes and then immediately the next pressure switch for the next compressor will take over.

CAN networking can be easily added to any device. There are two hardware pieces which may be integrated with the microcontroller. The simplest piece is the transceiver which adapts single-ended logic level signals to the "quasi-differential with respect to a common ground" CAN bus. The NXP(formerly Philips) Semiconductor PCA82C251 is an example of such a transceiver. It comes in an 8-pin SOIC. The second hardware piece is a CAN controller that performs the conversion of parallel data from the microprocessor to the serial data stream that the transceiver will transfer to and from the CAN bus. The CAN controller can be a stand alone peripheral like an SJA1000 or can be integrated into the micro controller like the Atmel T89C51CC01. You must write firmware in either case for either a Master/Slave operation or a peer-to-peer messaging protocol. You can choose from DeviceNet, CANOpen, CAN Kingdom and many others.

Does this mean i'll have to have those two hardware pieces(transceiver and CAN controller) on each board that i'm making? I do not understand ecxactly how CAN word, how does it differ from other BUSES? please help

Does this mean i'll have to have those two hardware pieces(transceiver and CAN controller) on each board that i'm making? I do not understand ecxactly how CAN word, how does it differ from other BUSES? please help

Click to expand...

In some fashion the answer is yes. In our case we used a microcontroller with a CAN controller. We still needed and external CAN transceiver because the CAN bus does not behave like a single ended logic level signal. In fact a CMOS gate with an input at Vcc/2 will make a dandy high frequency power consuming oscillator.

The CAN controller converts parallel data to serial data for transmission, and it converts serial data back to parallel data for reception. The transceiver converts logic level signals for receive (RxC) and transmit (TxC) to CAN bus levels CAN_H and CAN_L. It also allows a dominant bit to override a recessive bit. This is something normal logic gates cannot do. An open-drain or open collector output can do something similar but not at Vcc/2

CAN bus is not simple. There is a lot to learn before you can get it to work.
I started off with a PIC182580 datasheet but that just confused with more questions than answers.
It took me two weeks to get two boards to talk to each other.
You need a good book with programming examples to learn the basics.

CAN bus is not simple. There is a lot to learn before you can get it to work.
I started off with a PIC182580 datasheet but that just confused with more questions than answers.
It took me two weeks to get two boards to talk to each other.
You need a good book with programming examples to learn the basics.

Click to expand...

Actually that's not too bad. I assure you it took us just a bit longer because we had to layout, fabricate, and assemble the boards.