Yahoo Answers is shutting down on 4 May 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Anonymous
Anonymous asked in Science & MathematicsEngineering · 2 weeks ago

Please write a subroutine to take in one sample from the ADC?

Fancy ADC Interface Code, Built-in Ports

Please write a subroutine to take in one sample from the ADC, assuming it is wired to the 8051’s built-in ports, as in x1. This subroutine should restore any registers that it messes up. Because the MAX1261 is a fancy multi-channel ADC, there are a few additional tasks to deal with in your subroutine, but you may assume that all relevant initialization etc. have been done for you in the (hypothetical) main routine.The subroutine should do the following tasks: Start the ADC conversion: To start the ADC you must write a configuration byte by setting the appropriate bits on P0 and pulling the ADC’s WR* pin low for at least one 8051 clock cycle. The three LSBs of R0 (which you may assume will be set by the main program before calling your subroutine) should be used to set the 3 LSBs of the config byte to determine which channel is sampled. In addition to setting the three LSBs, please ensure that the remaining 5-bits are configured according to the highlighted modes in Table 1, below. Wait for the INT* pin on the MAX 1261 to be asserted, indicating a sample is ready Read all 12-bits of the sample, storing it in R6 (LSBs) and the 4 least significant bits of R7 (HSBs). To read a sample, pull the RD* pin on the MAX1261 LOW and set the HBEN pin to select whether to read the lower 8-bits (HBEN low) or the 4 most significant bits (HBEN high) via the datalines connected to P0.

Attachment image
There are no answers yet.
Be the first to answer this question.