Sign in

username:

password:



Not a member?

Search piclist



Search tips

Subscribe to piclist



piclist by Keywords

12F675 | 16F628 | 16F84 | 16f877 | 16F877A | 16F88 | 18F458 | ADC | AVR | Bootloader | CAN | CCS | CRC | EAGLE | EEPROM | ICD | ICSP | IDE | JDM | LED | Macros | Microchip | MPLAB | PCB-CAD | PIC10F | Pic12f675 | PIC16F84 | PIC16F84A | PIC16F877 | PIC18 | PIC18F452 | PicBasic | PICC | PICSTART | PWM | RS-485 | RS232 | SMT | SPI | UART | USART | USB | Wireless | Wisp628 | Xilinx

Discussion Groups

Discussion Groups | Piclist | Re: Controlling and simulating the analog outputs

A discussion group for the PICMicro microcontroller. Also called the Microchip PIC, this list is dedicated to the use and abuse of this fine, simple, microcontroller. Close to topic posts are welcome, ie. general electronics.

Controlling and simulating the analog outputs - Jason Hsu - May 25 0:56:14 2008


To get a digital output, you set its corresponding TRIS bit to '0',
set the ADCON configuration bits to an appropriate value (so that it
is digital and not analog), and then set the corresponding PORT bit to
'0' or '1'.

For an analog output, how do I set its output level, and how do I view
the analog output in MPLAB SIM to verify that I'm getting the right
output?
------------------------------------

to unsubscribe, go to http://www.yahoogroups.com and follow the instructions



(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Controlling and simulating the analog outputs - Eirik Karlsen - May 25 4:13:41 2008

Jason,
There is no generic analog output...
You must use the PWM to generate a 'digital' signal with a given mark/space ratio, then integrate that into
an analog voltage. The integrator can be as simple as a resistor followed by a capacitor to ground.
The output voltage will be something like the mark/space ratio, multiplied by the supply voltage.
But in many cases one will need to use a voltage follower after the integrator, or even an active integrator,
these will give you some output current without affecting the integrator (filter).

Look up PWM in the datasheet.

You can not directly verify the output voltage in SIM, not even the mark/space ratio in any simple way
(you risk having to wait over 1024 cycles for a period). You may set breakpoints to speed things up a
bit but a lot is up to you...and you still won't get MPLAB SIM to display a voltage.
These things are best tested at runtime on the target.

Jason Hsu wrote:

> To get a digital output, you set its corresponding TRIS bit to '0',
> set the ADCON configuration bits to an appropriate value (so that it
> is digital and not analog), and then set the corresponding PORT bit to
> '0' or '1'.
>
> For an analog output, how do I set its output level, and how do I view
> the analog output in MPLAB SIM to verify that I'm getting the right
> output?

--
*******************************************
VISIT MY HOME PAGE:

LAST UPDATED: 23/08/2003
*******************************************
Regards
Eirik Karlsen


(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )