• Channels
Part Inventory
Go
 
powered by:

 
  • Quick Poll
What Social Networking site do you use the most?



VOTE VIEW RESULTS
Previous Polls

Premium Content

New Signal Chain Technical Papers from Texas Instruments:

 

 

 

Tiny microcontroller provides 4-channel A/D conversion for a PC serial port


Contributing Author

October 22, 1998

Print
Reprints Comment Subscribe

Microchip’s PIC12C671 is a lowcost 8-pin microcontroller that has everything needed to perform a four-channel 8-bit analog-todigital conversion without external components. To create a plug-in four-channel analog-to-digital converter for a PC, the circuit in Figure 1 uses a PC’s serial port to power and communicate with the PIC12C671.

Pin 4 of the PC’s serial port supplies power to the microcontroller through a 5-V reference device. The PIC12C671’s VDD also serves as an A/D conversion reference voltage. The PC sends commands to the microcontroller through pin 7, and the device sends information back to the PC through pin 2. Figure 2 shows the details of the communication protocol.

Once the 12C671 powers up, it will count how many pulses are generated on the serial port’s pin 7 within 16 ms. If there’s one pulse, then channel 0 is selected for the A/D conversion. If the pulse count is 2, 3, or 4, channel 1, 2, or 3 will be selected. After the channel information is received, the microcontroller will start to perform the A/D conversion for the selected channel. Then the 8-bit A/D conversion data will be sent back to PC through the microcontroller's pin 2.

Since the PC may have a different serial port baud rate, it’s necessary to send a training pulse to the PC before starting transmission of A/D conversion data. The PC program contains a loop to accept the training pulse. The number of loop iterations that execute before the training pulse reception is completed determines the baud rate used for reception of the A/D conversion data from the microcontroller.

Listing 1 is the assembly program for PIC12C671 microcontroller and Listing 2 is the C program for the PC. The C program will read four inputs every second and will display the results on the PC screen.

Average (0 Ratings):

Subscribe
Subscribe to Electronic Design and start receiving more articles like this one
Filed Under:

Check for price and availability on Source ESB:

Go
powered by  
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here
Acceptable Use Policy

Sponsored Links