Circuit simulators with microcontroller code - diyAudio
Go Back   Home > Forums > General Interest > Everything Else
Home Forums Rules Articles diyAudio Store Gallery Wiki Blogs Register Donations FAQ Calendar Search Today's Posts Mark Forums Read

Everything Else Anything related to audio / video / electronics etc) BUT remember- we have many new forums where your thread may now fit! .... Parts, Equipment & Tools, Construction Tips, Software Tools......

Please consider donating to help us continue to serve you.

Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
Thread Tools Search this Thread
Old 3rd February 2006, 11:47 PM   #1
diyAudio Member
Join Date: Sep 2005
Default Circuit simulators with microcontroller code

Okay, I'm looking for any circuit simulation programs (like PSPICE) that also have microcontroller models in them where you can load your hex code into the microcontroller part, and then simulate your entire circuit in real time. Does such a thing exist yet?

I know that some microcontroller companies sell emulators and simulators with "plugin" modules, but I've found that the plugins are somewhat limited in variety.

  Reply With Quote
Old 4th February 2006, 12:23 AM   #2
diyAudio Member
Join Date: Jan 2006
Location: montreal, quebec
Typically, microcontroller simulator and circuit/device-level simulators are quite distinct from one another because they operate at different levels of abstraction. If you wanted something that did (and combined) both you'd likely need a copy of a chip's logic and circuit-level layout, which are kept secret...Otherwise, it'd be simple for a competitor to copy a design.

I'm guessing that you want to write assembler to control the I/O's on a chip that you're connecting to some custom hardware. If so, it's probably a lot easier to write a software program that emulates the chip's output (and dumps it to a file) and then use that file as input into a circuit-level simulator.

If you don't mind me asking, what are you trying to do?

D. Carney
  Reply With Quote
Old 4th February 2006, 02:19 AM   #3
diyAudio Member
I_Forgot's Avatar
Join Date: Jan 2005
Location: Phoenix, Az.
I have an old copy of Electronics Workbench that allows mixed mode simulation of digital and analog stuff in the same circuit, but it can't simulate a microcontroller.

If you are using a spice type simulator to simulate something like a microcontroller you run into a major problem. Spice is a time domain simulator and its purpose is to capture details of events that occur in very short time periods. If you are running the microcontroller clock at 10 MHz, spice is going to worry about the transitions of the clock and calculate voltages and currents in extreme detail at each clock transition.

When you combine the microcontroller circuit with an analog circult, which typically has things happening much slower than the microcontroller, the simulation time will be very long because spice is using short time steps to get all the detail on what's happening with the digital circuits.

The simulation gets long, the data files get huge, and you get tired of waiting.

  Reply With Quote
Old 4th February 2006, 03:52 AM   #4
diyAudio Member
Join Date: Sep 2005
I'm trying to simulate a remote volume control circuit for an audio amp:

left channel volume up/down
right channel up/down
both channels up/down

So I need seven buttons for all of these features, and I'm using three PIC16F627A chips, along with an encoder and decoder chip from Holtek.

You should be able to turn the volume up or down via remote control, or by buttons on the amp unit iself. The volume control is a DS1666 digital pot from Maxim. I've found a few microcontroller simulators with pluggins for things like extra memory, but none for an encoder or decoder or a digital potentiometer.
  Reply With Quote
Old 4th February 2006, 04:06 AM   #5
diyAudio Member
I_Forgot's Avatar
Join Date: Jan 2005
Location: Phoenix, Az.
The IDE that's free from Microchip will simulate the code as far as the I/O ports. You just need to compare the uC output to the digital pot with the timing diagram of the pot chip. Do the same with the timing diagram of the IR receiver chip (you could actually decode the IR using the uC and eliminate the IR receiver chip if you wanted to).

Why do you need three uCs just to control volume?

I made a digital attenuator that used an NS attenuator chip. I used buttons for volume up and down and mute. The code required 110 bytes including the 3-wire bit banging routine to drive the attenuator chip and ramped mute/unmute.

  Reply With Quote
Old 4th February 2006, 09:22 PM   #6
diyAudio Member
Join Date: Sep 2005
I_F, that sounds neat! I'm pretty new to uC's, and this is my first "big" project.

uC1 ==> acts as a "parallel to serial" encoder for the remote control. Without this, the HT-12A encoder chip itself can take up to four inputs at a time, but I need seven. Adding the uC in the remote allows me to insert a pseudo "transmit enable" pin because the HT-12A does not have a separate transmit enable pin in itself (I can explain more on this if you want).

uC2 ==> the serial to parallel decoder for the receiver end, does the opposite of uC1.

uC3 ==> on the receiver side, it takes all button inputs and interfaces the logic to the two potentiometers (the pots use an increment/decrement protocol, not SPI or IIC).

I'm also using PIC16F627A's, so the number of input pins for each is limited.
  Reply With Quote


Hide this!Advertise here!
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
CD-ROM controller Source code and Circuit diagram here....... nFORCE Digital Source 24 19th November 2008 11:21 AM
Problem witht [code]blah[/code] ? elseif Forum Problems 1 17th August 2008 12:30 AM
Simulators and convergence rtarbell Everything Else 6 15th June 2006 08:04 PM
Simulators and clipping rtarbell Everything Else 3 16th November 2005 11:33 PM
Aleph P microcontroller code Kovax Pass Labs 2 27th August 2002 08:21 PM

New To Site? Need Help?

All times are GMT. The time now is 04:29 PM.

vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Copyright 1999-2017 diyAudio

Content Relevant URLs by vBSEO 3.3.2