I'm so confused, both do the same function, converting the analog to digital, but what's the difference?
...both does the same functions that converts the analog to digital...
That would be incorrect.
A modem will modulate (the
mo in modem) an analog carrier to encode digital information on it, and demodulate (the
dem in modem) an analog carrier to convert the encoded information back to digital information.
A CSU/DSU connects two different types of digital signals. A CSU/DSU is actually two different devices, the CSU and the DSU, which may be in separate boxes. In the old days, These were separate pieces of equipment. Today, they are almost always in a single box (e.g., a DSL "modem"), or a single interface module for the DTE (e.g. a T1/E1 WIC for a Cisco ISR). The DSU (Data Service Unit) is what connects to your DTE (Data Terminal Equipment), and converts your DTE serial communications to frames which the CSU can understand, and vice versa. The CSU (Channel Service Unit) is what connects to the communication circuit, and places the frames from the DSU onto the communications circuit, and vice versa.
The purpose of both units is to convert a signal from a form used for local transmission to a form used for long distance transmission.
In the old days modems worked by modulating signals onto a carrier and demodulating them at the other end. Interfaces for dedicated data lines generally used digital line coding schemes that didn't involve modulating a carrier. Hence the different terms.
However technology marches on and the technical line isn't nearly as clear cut nowadays. Voiceband modems moved away from modulating carriers and towards multi-level digital coding schemes. High rate dedicated lines may use transmission schemes that inovlve modulating multiple carriers to best use the bandwidth/noise profile of the line.
The convention nowadays seems to be that "Modem" is used for devices that work on lines not primerally intended for data service (cable TV lines, phone lines). The term CSU/DSU is used in conjunction with T1 lines. The terms "transciever" or "media converter" are used for fiber lines.
A modem also called as modulator and demodulator, is a device that modulates one or more carrier wave signals to encode digital information for transmission and demodulates signals to decode the transmitted information. The goal is to produce a signal that can be transmitted easily and decoded to reproduce the original digital data. Modems can be used with any means of transmitting analog signals, from light emitting diodes to radio. A common type of modem is one that turns the digital data of a computer into modulated electrical signal for transmission over telephone lines and demodulated by another modem at the receiver side to recover the digital data.
A CSU/DSU (Channel Service Unit/Data Service Unit) is a hardware device about the size of an external modem that converts a digital data frame from the communications technology used on a local area network (LAN) into a frame appropriate to a wide-area network (WAN) and vice versa. For example, if you have a Web business from your own home and have leased a digital line (perhaps a T-1 or fractional T-1 line) to a phone company or a gateway at an Internet service provider, you have a CSU/DSU at your end and the phone company or gateway host has a CSU/DSU at its end.