But in Microcontroller as 16F84A there is no such hardware communications modules. Serial communication can be established by software or Bit-Bang method. The standard RS232 protocol uses +12v to represent logic 0 and -12v to represent logic 1 . While TTL uses +5v to represent logic 1 and 0 V to represent logic 0.
An external IC is used as an interface between the Microcontroller and an RS232 enabled device ( PC for example ) .This IC MAX232 or HIN232 performs this level shifting function between the RS232 and TTL protocols.
This method enables connection of the Microcontroller directly to the PC. The web page clearly explains this method . The PIC 16f8A can withstand +12v and -12v when receiving data from PC . And for data transmission to PC 0v to +5v can be distinct by the PC as two different levels.
I really wanted to try this code in real world and built the simple circuit as shown in the web page. The designer recommends connecting a resistor for PIC protection .
Of course , you can find that it is a very simple circuit that provides another new usage for the PIC 16F84A.
So how can you use the serial data form the Microcontroller ?
You can write a simple software for the PC that reads from the PC's serial port ( com1 or com2 ) . Or you can simply open the famous program Hyper terminal that comes with all Microsoft windows versions under the menu Programs --> Accessories --> Communications --> HyperTerminal. Then you need to configure the right Com port , Baud rate and Flow control . As shown here
I used a serial connector from an old mouse to connect the circuit board to the PC .
Here is the real circuit board I built and the serial connector connected to it .
Here, we 'll use the serial communication protocol RS232 to adjust the Microcontroller which in turn controls a DC motor by the PWM signals.
By choosing the motor speeds and sending them to the Microcontroller, we are able to choose PWM signals duty cycles and sending them to the Microcontroller via RS232 protocol.
The ciruit between the Microcontroller and the PC is very simple. All you have to connect is the PIC16F84A ,the crystal oscillator and the RS232 9 pin female connector.
The Microcontroller is supplied by the 12V DC from RS232 pin 7 RTS. Do not be afraid of losing the PIC chip, it can withstand it without damage.
The PIC16F84A Tx pin 1 is connected directly to RS232 pin 2 Rx.
The PIC16F84A Rx pin 17 is connected to RS232 pin 3 Tx through 10k ohm resistor to adjust the input voltage to the PIC.
The motor driving part of the circuit has already been explained in the PWM DC motor control post. So I 'll use the same driving circuit.
The PWM signal comes from the PIC16F84A to the NPN 2N2222 transistor base. This transistor acts as an electronic switch.
The DC motor is driven by an external DC 9v battery.
If you like this blog you can support us by many ways:
2. Buy our book on Amazon Learn By Making.
3. Click on links of our sponsors without adding any extra cost on you if you make purchase from them. Actually, many of these offers are totally free.
Amazon.com - Read eBooks using the FREE Kindle Reading App on Most Devices
This is the well-know Amazon Kindle platform. If you sign up for the free reader from Amazon to read any book, we get commission.
There are many useful book for free on Amazon Kindle. Even you can find best sellers offered for free on Kindle format.
The best part is you can have the application on any platform. You can even read any book without installing any application by using Amazon Cloud-Reader on your browser.
Join Amazon Kindle Unlimited 30-Day Free Trial
You can join Amazon Kindle for 30 days free to have access to many paid book for free. You can cancel you subscription anytime.
Try Amazon Prime 30-Day Free Trial
The Amazon Prime is a special paid service from Amazon that offers good promotions and one-day free shipment for Amazon Shoppers. You can try this service for 30 days. You can cancel you subscription anytime.
Shop Amazon - Give the Gift of Amazon Prime
Try Audible and Get Two Free Audiobooks
Audible is the audio books website from Amazon. Many Kindle books are sold on Audible. You can try this service for free and get 2 free book. You can cancel you subscription anytime.
Shop Amazon - Create an Amazon Baby Registry
If you have a new baby borne or expecting one, you can create your free baby registry to easily save products and get offers and promotions on baby requirements.
Thank you for visiting our blog.