Jump to content
kenn

V7 Extra Simulator Plugins: Variable Psu Plugin Not Working

Recommended Posts

Hi guys,

 

In December I downloaded the installer (and purchased the licence) for the extra plugins pack for v7.05. Plugins appear to have installed without error, registered as expected, and most seem to function correctly.

 

The Variable PSU simulator shows up at the bottom of the plugin list, but when I attempt to select it, nothing happens except for the following message in the Build pane of the Output window: Abort building...

 

This happens every time I try to select Variable PSU, regardless of what project is loaded, or whether other plugins are already in use, or whether I'm in simulation mode or not.

 

 

* * *

 

As a side note - I wanted to use the Variable PSU as a voltage source for simulating input in a short PIC16F877A A/D program. Because the variable PSU isn't available, I brought up the Signal Generator plugin, and attempted to use it as a source of DC voltage on RA0. The plugin itself seemed ok, and when I connected the Digital Voltmeter plugin to the same pin and started the simulator, the voltmeter indicated the correct voltage set on the Signal Generator... but I never saw a non-zero value on the A/D registers. This is most likely a problem with my code, but I can't find a known-good, simple, single input A/D program written in sourceboost. I haven't given up looking, but if someone could share a very short test program just using RA0 of the '877 or '877A, I'd be grateful.

 

 

Thanks.

Share this post


Link to post
Share on other sites

Here are some code fragments from a little project I wrote some years ago to make a volt meter on an LCD display. I tried to highlight the main crud in red.

 

 

unsigned char SampleADC(void)

{

set_bit(adcon0,GO); // Start conversion

while(test_bit(adcon0,GO));

return(adresh); // Fetch high 8 bits of result

}

int main()

{

unsigned int i;

int voltage,whole,frac;

unsigned char Raw;

 

trisb = 0x00; // Porb B[7:0] is output

trisa = 0x01; // Port A[0] is input for A/D

adcon1 = 0x0e; // (left justified) 1 A/D channel

adcon0 = 0x81; // FOSC/32, channel=0, ADON=1

portb = 0xaa; /* turn on some lights */

RS232Init(RS232_20MHZ_BAUD_115000);

InitTimer();

InitTerminal();

 

RS232putch(TERM_CLEAR);

SetCursor(0,0);

DisplayString("Cheap Volt Meter");

 

for(i=0;0<1;i++){

SetCursor(0,1);

Raw = SampleADC();

voltage = ((200*(unsigned int)Raw)/255)*25;

whole = voltage/1000;

frac = (voltage - (whole*1000) + 5)/10;

sprintf3(Buf,"ADC=%d.%02dV Raw=0x%02x\n",whole,frac,Raw);

DisplayString(Buf);

sprintf1(Buf,"\tLoop=%u \n",i);

DisplayString(Buf);

DisplayBarGraph(voltage/84);

Waitms(10);

portb = i&0xff;

}

}

Share this post


Link to post
Share on other sites

Thanks alot, Ted. :) I'll give that a whirl ASAP. I'm also going to try the compiled apps on simple hardware, just in case the simulator is misbehaving on ADC.

 

Assuming you also have the v7 plugins, does the Variable PSU work for you?

Share this post


Link to post
Share on other sites

Update:

 

So, I wrote a minimalist "dimmer" app, where the ADC value is used to control a PWM LED dimmer, built it, and programmed it into a '877A... and it worked fine on the hardware - 10k pot across Vdd and Vss, wiper into PORTA.0... pot controls brightness.

 

I went back to the IDE, tried to simulate it using the Function Generator as source of DC input, and LED plugin, and 'watched' adcvalue... and it stayed at zero, apparently no adc happening, or simulated voltage isn't being applied. If anyone tries this also, please post your results.

 

The code is below. PORTA.0 is the ADC input, and PORTD.0 is the LED anode.

 

(Thanks again, Ted. You helped me convince myself that I hadn't lost my mojo ;) )

 

#include <system.h>


/***********************************************
Doubting Thomas' 1-ADC, 1-LED test
RC osc
kn Jan 2012
************************************************/

//Target PIC16F877A configuration word
#pragma DATA _CONFIG, _PWRTE_OFF & _BODEN_OFF & _WDT_OFF & _LVP_ON & _CPD_OFF & _DEBUG_OFF & _RC_OSC & _CP_OFF

//Set clock frequency -
#pragma CLOCK_FREQ	4000000

// "header"
void adc();
unsigned char adcvalue;

void main( void )
{
// 877 ports - all out, RA0 ADC

//Configure port A
trisa = 0x01;
//Configure port B
trisb = 0x00;
//Configure port C
trisc = 0x00;
//Configure port D
trisd = 0x00;
//Configure port E
trise = 0x00;

//Initialize port A
porta = 0x00;
//Initialize port B
portb = 0x00;
//Initialize port C
portc = 0x00;
//Initialize port D
portd = 0x00;
//Initialize port E
porte = 0x00;

trisa = 0x01; // Port A[0] is input for A/D
adcon1 = 0x0e; // (left justified) 1 A/D channel
adcon0 = 0x81; // FOSC/32, channel=0, ADON=1

//Endless loop
while( 1 ) {		
	adc();
	set_bit(portd,0);
	delay_us(adcvalue);
	clear_bit(portd,0);
	delay_us(256-adcvalue);
}	
}

void adc() {	
set_bit(adcon0, GO);// Start conversion
while(test_bit(adcon0,GO));
adcvalue=adresh;// Fetch high 8 bits of result
}

Edited by kenn

Share this post


Link to post
Share on other sites

...The Variable PSU simulator shows up at the bottom of the plugin list, but when I attempt to select it, nothing happens except for the following message in the Build pane of the Output window: Abort building...

 

I could not reproduce this problem. Not sure what can cause it. Check if there is a mismatch between IDE and plugin versions.

 

Another thing to try is to remove the Variable PSU dll from SourceBoost installation directory and check if the new last plugin in the menu still works. Than put the Variable PSU dll back, start IDE and check if the problem is still there.

 

Regards,

Pavel

Share this post


Link to post
Share on other sites

Hi Pavel,

 

Thanks for the feedback. I can confirm that I'm using v7.05 of the IDE, I downloaded and installed the v7 plugins (... and of course I bought the licence, on 17 Dec, 2011)

 

NOTE that your auto-response to the licence purchase mentioned that the licence is for 6.x plugins... I am assuming that you haven't yet changed the message <_<

 

Last night I tried a few things:

- retried Variable PSU - same result: "Abort Building..."

- removed Variable PSU dll, restarted IDE, tried to select last plugin - Stopwatch - got message "Abort Compilation..."

- removed Stopwatch dll, restarted, tried to select last plugin - Speed Tester - comes up OK

- returned Variable PSU dll, restarted IDE, tried to select Variable PSU - got message "Abort Compilation..."

 

To recap, both variable PSU and Stopwatch plugins seem broken. Can any other users confirm whether all the v7 plugins work for them?

 

I'm doing more with ADC these days, it would be a great help if the Variable PSU or the Function Generator were working as DC sources.

 

Thanks,

 

ken

Share this post


Link to post
Share on other sites

Kenn,

Update:

 

So, I wrote a minimalist "dimmer" app, where the ADC value is used to control a PWM LED dimmer, built it, and programmed it into a '877A... and it worked fine on the hardware - 10k pot across Vdd and Vss, wiper into PORTA.0... pot controls brightness.

 

I went back to the IDE, tried to simulate it using the Function Generator as source of DC input, and LED plugin, and 'watched' adcvalue... and it stayed at zero, apparently no adc happening, or simulated voltage isn't being applied. If anyone tries this also, please post your results.

....

Turns out the simulator is broken.

What's gone wrong is that RA0 and AN0 are being treated as different pins, so a connection to RA0 does not go to the ADC.

This item is now on our bugs list.

 

Regards

Dave

Share this post


Link to post
Share on other sites

Hi Dave,

 

Thanks for the fix. I only had time tonight for a quick test, but yes the ADC simulation now works. :)

Share this post


Link to post
Share on other sites

Your content will need to be approved by a moderator

Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoticons maximum 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...

×