Applying some Volts
On first pass, I could not get the script from the RTX Measure example that pokes a voltage onto the analog pins to load into the debugger. The debugger kept moaning that ain0 was not defined. But what was ain0 anyway? It didn't have a definition in the script. ain0 turned out to be a Virtual Target Register (VTREG), which is a register that is part of the simulator. A VTREG is specific to a particular MCU simulation and can be read or written to either by a script or directly from the debugger's command line. So the statement:
ain0 = voltssets analog input 0 on the MCU to the value of voltage.
I had been using a VTREG when I was poking the pin 2 of PORT0 in the button example. I just hadn't really thought about it.
Typing:
DIR VTREGgave me a list of all of the virtual target registers in the simulation, and for the LPC2148 I found that the analog inputs had been renamed AD< converter number >< channel number >. The weird thing, though, was that there was no AD00 and no AD05. There were, however, a full compliment of AD10..AD17 inputs for the second A/D converter. Odd?



0 Comments:
Post a Comment
<< Home