I'm very interested to buy this powerful compiler, but I have some questions. I'm working with the free evaluation copy of the program and
I've some problem to compile a program with the dsPIC30F4011, while the dsPIC30F4013 works well. So I look inside the program directory and I found that the p30F4011def.dbas (in the DEFS directory) is completely different from the p30F4013def.dbas and other definition files: why?
If I buy the program, I will have the new unlocked and correct program or I buy only the licence?
Another question: in the Project setup, the clock value is the crystal frequency, or the real frequency after the PLL (computed by...me?) I note that the execution time (computed by the simulator) is determined thru the "clock" frequency and not the "clock x PLL" . But the compiler knows very well the PLL multiplication factor...(specified in the project properties).
Someone can answer to me?
Thanks
Ivano
Question about MikroBasic for dsPIC 1.0
Re: Question about MikroBasic for dsPIC 1.0
These are two completely different chips. What is the error message you get?perseus wrote:I've some problem to compile a program with the dsPIC30F4011, while the dsPIC30F4013 works well. So I look inside the program directory and I found that the p30F4011def.dbas (in the DEFS directory) is completely different from the p30F4013def.dbas and other definition files: why?
You will get a key which will unlock the program you have already downloaded. Later upgrades are free.If I buy the program, I will have the new unlocked and correct program or I buy only the licence?
You have to specify working frequncy of the chip (not divided by four). If for example, you use 10MHz crystal with p30F4013 and you enable EC_8xPLL option, then you have to setup 80MHz in compiler.Another question: in the Project setup, the clock value is the crystal frequency, or the real frequency after the PLL (computed by...me?) I note that the execution time (computed by the simulator) is determined thru the "clock" frequency and not the "clock x PLL" . But the compiler knows very well the PLL multiplication factor...(specified in the project properties).
For your information, the next release of mikroPascal and mikroBasic for dsPIC is just about to be released. We added DSP support so now you can use FFT, IFFT, FIR, IIR etc. Here is the example how FFT works in realtime on 4013:
The example compiles below 6Kbytes which means you can try it out without buying a licence.
This simple program is compiled with dsPIC30F4013 but not with dsPIC30F4011 (it generates a lot of errors,
in the p30F4011def.dbas). It can be that in my evaluation copy of the program there are some errors, 'cause the def sections are structurally too much different...look inside in the DEFS directory in the evaluation copy.
If I want to install the program in my desktop computer and in my notebook (of course I use them one at a time and not simultaneously) I have to buy two keys?
The answer is important for the right choose of the compiler...
Thanks a lot for the quick answers
Ivano
in the p30F4011def.dbas). It can be that in my evaluation copy of the program there are some errors, 'cause the def sections are structurally too much different...look inside in the DEFS directory in the evaluation copy.
If I want to install the program in my desktop computer and in my notebook (of course I use them one at a time and not simultaneously) I have to buy two keys?
The answer is important for the right choose of the compiler...
Thanks a lot for the quick answers
Ivano
The def file for 4011 should look like this:
Code: Select all
module p30F4011def
include "p30F4011"
include "system"
include "math"
include "math_double"
include "strings"
include "trigonometry"
include "delays"
include "uart_calc"
include "eeprom"
include "flash_mcu"
include "conv"
include "keypad4x4"
include "adc"
include "i2c"
include "spi_const"
include "spi1"
include "spi2"
include "mmc"
include "uart_consts"
include "uart1"
include "uart2"
include "soft_i2c"
include "soft_spi"
include "soft_uart"
include "lcd_consts"
include "lcd_4bit"
include "lcd_8bit" ' add here new libraries
include "images"
include "glcd30"
include "compact_flash"
include "ps2"
include "button"
include "pwm_calc"
include "pwm"
'include "mmc_fat16"
include "sound"
implements
end.
yes, you have toOkay, the file in my free demo is corrupted. I try to download it again but...you can try to check it, also.
Important: if I want to install the program in my desktop computer and in my notebook (of course I use them one at a time and not simultaneously) I have to buy two keys?
Anton
Another proud user of LV 24-33A Development System and mikroPascal PRO for dsPIC :)
PortA not working? Add CMCON := 7; PortD not working? Add ADCON1 := 6;
To paste code on the forum, please use the [b] Code [/b] button !! ;)
PortA not working? Add CMCON := 7; PortD not working? Add ADCON1 := 6;
To paste code on the forum, please use the [b] Code [/b] button !! ;)
Re: Question about MikroBasic for dsPIC 1.0
Now it is starting to look like some real fun...zristic wrote:For your information, the next release of mikroPascal and mikroBasic for dsPIC is just about to be released. We added DSP support so now you can use FFT, IFFT, FIR, IIR etc. Here is the example how FFT works in realtime on 4013:
The example compiles below 6Kbytes which means you can try it out without buying a licence.
What throughput frequency/sample size can you make it at?
Last edited by OT on 03 Nov 2005 05:35, edited 1 time in total.
I can confirm I have tested this now with a full licence of dsPIC Pascal, and it works. I even have additional fre licences installed on the C drives, which can be used with demo limit in case the laptop drive is left behind.However one solution that has been mentioned is to install the compiler on a portable laptop drive or a USB flash device (latter is slow). The licence is keyed to the media, thus it will travel with the portable drive.
Last edited by OT on 23 Nov 2005 08:46, edited 1 time in total.
Re: Question about MikroBasic for dsPIC 1.0
Here is the source code in mikroPascal:OT wrote:Now it is starting to look like some real fun...
What throughput frequency/sample size can you make it at?
Code: Select all
program FFTDemo;
uses FFTLib, BitReverseComplex, TwiddleFactors;
var Samples : array[512] of word; absolute $1800; // Y data space
Written : array[128] of word;
freq : word;
txt : string[5];
procedure InitAdc;
begin
ADPCFG := 0;
ADCON1 := $00E0; // internal counter ends conversion
ADCHS := 10; // connect RBxx/ANxx as CH10 input
ADCSSL := 0;
ADCON3 := $1F3F; // sample time = 31 Tad.
ADCON2 := 0;
ADCON1 := $83E0; // turn ADC ON, fractional result
TRISB.10 := 1;
end;
procedure Init;
var i: word;
begin
for i := 0 to 127 do
begin
Written[i] := 255;
end;
Glcd_Init(LATD.8, LATD.9, LATD.10, LATD.3, LATG.12, LATD.11, LATB);
Glcd_Set_Font(@FontSystem5x8, 5, 8, 32);
Glcd_Fill(0xAA);
Delay_ms(500);
Glcd_Fill(0x00); // clear screen
InitAdc;
txt := ' Hz';
Glcd_Write_Text(txt, 100, 0, 1);
end;
function Fract2Float(input: integer): real;
begin
if (input < 0) then
input := - input;
result := input/32768.;
end;
procedure WriteData;
var Re, Im, tmpw,
j, k, l, max : word;
Rer, Imr, tmpR : real;
begin
ADPCFG := $FFFF; // PORTB is digital
j := 2;
k := 0;
max := 0;
freq := 0;
while k <= 62 do
begin
re := Samples[j];
inc(j);
im := Samples[j];
inc(j);
Rer := Fract2Float(re);
Imr := Fract2Float(im);
tmpR := Rer * Rer;
Rer := tmpR;
tmpR := Imr * Imr;
Imr := tmpR;
tmpR := sqrt(Rer + Imr);
Rer := tmpR*512.;
re := Rer;
re := re and $FF;
if Re > 63 then
re := Written[k-1]; // k = 0?
if Re > max then
begin
max := re;
freq := k;
end;
tmpw := Written[k];
if tmpw <> Re then
begin
l := 64 - tmpw;
while l <= 63 do
begin
Glcd_Dot(k, l, 0);
inc(l);
end;
l := 64 - Re;
while l <= 63 do
begin
Glcd_Dot(k, l, 1);
inc(l);
end;
Written[k] := Re;
end;
inc(k);
end;
end;
function readadc: word;
begin
ADCON1.1 := 1; // start conversion
while ADCON1.0 = 0 do nop;
result := ADCBUF0;
end;
procedure SampleInput;
var i: integer;
begin
// We use PORTB for GLCD as well, so we have to set it to analogue input mode
ADPCFG := $0000;
TRISB.10 := 1;
i :=0;
while i <= 511 do
begin
Samples[i] := readadc;
inc(i);
Samples[i] := 0;
inc(i);
end;
end;
begin
Init;
while true do
begin
freq := 0;
SampleInput;
FFT(8, @TwiddleCoeff_256, Samples);
BitReverseComplex(8, Samples);
WriteData;
freq := freq * 100;
WordToStr(freq, txt);
Glcd_Write_Text(txt, 70, 0, 1);
end;
end.
The maximum frequency measured here is 6kHz, but this is not the limit, because the slowest sampling for ADC is used (Tack = 31Tad). Therefore, it should be possible to sample signals up to 20kHz.
The signal is sampled at 256 points and FFT returns 128 real/complex pairs. The pairs are used to calc amplitude as sqrt(Re^2 + Im^2).
The whole program fits in less than 6Kbytes of flash and runs in realtime without problems (P30f6014 has 144kbytes of flash!).
Re: Question about MikroBasic for dsPIC 1.0
Is the demo-limit 6K with dsBasic?zristic wrote:The example compiles below 6Kbytes which means you can try it out without buying a licence.
[color=darkred][b]xor[/b][/color]
[url=http://circuit-ed.com]CircuitED -[/url]
[url=http://circuit-ed.com]CircuitED -[/url]
Re: Question about MikroBasic for dsPIC 1.0
Yes, it is.xor wrote:Is the demo-limit 6K with dsBasic?