The popular BASIC compiler for AVR microcontrollers has been expanded with a very useful command. Instead of using the inaccurate GetRC0 command, you’re now able to establish R-C values by means of two port pins.When a microcontroller has no analogue/digital converter, you need to resort to tricks if you want to measure the value of a resistor or a capacitor in an R-C network. For this purpose, BASCOM AVR has the command GetRC available. With reference to Figure 1, the R-C network connected to port line D4 should have a 100-nF capacitor while the value of the resistor to be measured is between 0 and 10 k?.GetRC arranges for the capacitor to be charged in one go, and discharged in small steps until the Low state is reached. The number steps are counted and stored in a ‘word’ variable (Listing 1).
Discussion (0 comments)