Code overview
First, the code defines the chip select, the data input/output, and the clock on the ADC0832-N chip. The input and output ports were connected due to the fact that there would never be a time where neither input nor output are high-z. In addition it made wiring simpler. Chip select goes high before going low in order to start the conversion. Then, the data in sets the chip to single, because I am not comparing two values. Afterwards, on the third clock, the chip goes odd. On the falling edge, when the clock goes zero off of the third clock, the chip switches to input. Then the chip loops clock 8 times, while it reads the input. Then, it loops another 8 times while reading the reverse input in reverse, and confirms if the two readings are the same. After this, chip select goes high, severing the conversion, the chip goes output, and the voltage is gotten by multiplying the analog value by 5/255
Comments
Post a Comment