Jump to content
Sign in to follow this  
trossin

Plugin Driver Impedance Of 0 Ohms Does Not Seem To Work.

Recommended Posts

I've been bashing my head over this off and on for a few days now and by dumb luck got a plugin to start working by using 5 Ohms instead of 0 Ohms for the driver resistance. Here are the words from the plugin guide so I guess I should have known but it is not obvious.

 

void SetConnectionR( HANDLE hConnection, int ohm )

 

Set the externally applied voltage levels impedance. “0” means that pin voltage is exactly the external voltage value. “-1“ means infinite impedance so the pin voltage is whatever is generated inside the PIC. When driving a pin from outside use typically 5 to 50 ohm and when trying to read the voltage on a pin 10M ohm:

...

SetConnectionR( hConnection, 50 ); // for typical instrument drive

SetConnectionR( hConnection, 10000000 ); // for typical instrument input load

 

I tried implementing a bidirectional data bus (tri-state) such that when a signal named nMRD was zero my plugin would drive 8-bits onto port D and when nMWR was zero my plugin would read 8-bits from port D. When I used a value of zero for SetConnectionR, the plugin would never drive the port D while nMRD was zero. I changed to the plugin code to always drive port D with a certain value to try to debug the problem. What I found was that when the PIC had the port in input mode(TRISD=0xff), the LED block and the simulator would sense a value of 0xff. When I had the PIC in output mode (TRISD=0x00), my plugin would drive the bus. This is completely backward.

 

By trial and error changing this and that I finally found that changing SetConnectionR from 0 Ohms to 5 Ohms solved the problem and the plugin would now overdrive the bus all the time as expected. Putting my original code back but using 5 instead of zero made the plugin would correctly and drive the bus while nMRD was zero and sense the bus when nMWR was zero.

 

I was raised thinking that an ideal voltage source had a Thevenin resistance of 0 Ohms not 5 Ohms. Is this a bug in the plugin that should be explained in the documentation or am I reading the words wrong? I will admit that the docs do say use 5 to 50 but it would be nice if others did not have to stumble into this problem. It would be nice if 0 does not work that the plugin system would check for it and bump it up to 5 until the problem can be repaired.

 

The open plugin system which allows me to create custom plugins for my projects is of huge value to me. I'm just a hobbyist playing with PICs for fun and it saves me lots of time over trial and error hardware/software design. I would think that folks that are doing this for a living would jump all over this advantage. Why wait for your hardware when you can simulate, develop and refine your design in parallel.

 

I can create a tiny example to demonstate the problem if that will help. Otherwise, I can provide my current plugin and PIC project which I can light switch happy and sad mode by changing a 5 to a 0.

 

I'm using version 6.89 of SourceBoost IDE. The plugin code example that I based all my plugins on has a copyright of 2003-2004 but I could not find any version information. It looks like the same code that is on the web with files dated May 19th of 2004 so I believe I have the latest code.

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...