chip to computer serial communication is similar to chip to chip communication technique , except you need a special computer which helps you to connect your chip to computer . Since computer works on Giga Hertz speed but microcontroller is on Mega-Hertz . So we need to set up a protocal between these two different speed computer . RS232 cable shown in figure below is a standard component approved by the Electronic Industries Association(EIA) . There is a chip inside this cable which makes PC to work with the speed of microcontroller .
Figure shows a RS232 cable DB9 which is popular today's microcontroller . connect this cable to the USB and connector to the microcontroller pin (since this is male connector in cable we need female DB-9 connector so that it is easy to assemble as shown in figure below . Pin out description of RS232 DB-9 cable is shown in below connect these pins
Pin Description of RS232 DB-9
|1||DCD (data carrier detect)|
|2||RxD (Received data)|
|3||TxD (Transmitted data)|
|4||DTR (data terminal ready)|
|5||GND: Ground pin|
|6||DSR (data set ready)|
|7||RTS (request to send)|
|8||CTS (clear to send)|
|9||RI (ring indicator)|
- DTR (data terminal ready): When terminal is turned on, it sends out signal DTR to indicate that it is ready for communication.
- DSR (data set ready): When DCE is turned on and has gone through the self-test, it assert DSR to indicate that it is ready to communicate.
- RTS (request to send): When the DTE device has byte to transmit, it assert RTS to signal the modem that it has a byte of data to transmit.
- CTS (clear to send): When the modem has room for storing the data it is to receive, it sends out signal CTS to DTE to indicate that it can receive the data now.
- DCD (data carrier detect): The modem asserts signal DCD to inform the DTE that a valid carrier has been detected and that contact between it and the other modem is established.
- RI (ring indicator): An output from the modem and an input to a PC indicates that the telephone is ringing. It goes on and off in synchronous with the ringing sound.
- RxD (Received data): The RxD pin is the Data Receive pin. This is the pin where the receiver receives data.
- TxD (Transmitted data): The TxD pin is the Data Transmit pin. This is the pin through which data is transmitted to the receiver.
- GND: Ground pin.
Programming chip to transmit data to computer
Since we have microcontroller to transmit data to the computer , we only need write the code to transmit data in microcontroller and you will get a software terminal when you buy a cable and in software you need to initialize variable so that it can receive data from the microcontroller . And if you want to send data from window you need to write code for chip as chip is a receiver and need to initialize some transmitting data to the microcontroller . You can search those terminals (softwares) in google . if you are new to this serial communication please refer our previous chapter of serial communication because can be used as previous section.