dsPIC/PIC24 observations/issues

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

User avatar
petesmart
Valued Contributor
Valued Contributor
Posts: 395
Joined: Thu May 06, 2010 11:42 am
Location: Sydney, Australia
Has thanked: 190 times
Been thanked: 140 times
Contact:

dsPIC/PIC24 observations/issues

Postby petesmart » Thu Jul 14, 2011 7:49 am

Hi Team,

Have just received my parcel of goodies from matirx, one of which was FCv4 for dsPIC.

1) first issue is that I cant licence the product. Jayne has passed on my PM to David to sought out for me.

2) Auto detect in the chip config screen does not work... respose is that the usb cable is not connected, howemer i can programme the dsPIC30F2011 (on EB064) ok. 1 sec flasher works! Saw an earlier post on this, however not sure of what this means, using mloader btw as the standard config suggests.

3) I get a config warning upon completion of the programming sequence - see below

File name: C:\Users\smartp\Documents\1SEC_FLASH.c
Generated by: Flowcode v4.4.13.69
Date: Thursday, July 14, 2011 16:13:03
Licence: Professional

***UNREGISTERED***


http://www.matrixmultimedia.com


Launching the compiler...
C:\Program Files\Matrix Multimedia\Flowcode PIC24&dsPIC V4\Tools\MX_bats\pic16_C30_comp.bat "1SEC_FLASH" "C:\Users\smartp\DOCUME~1" 30F2011

C:\Users\smartp\Documents>pic30-gcc -c -mcpu=30F2011 -funsigned-char -fno-short-double -Os -I"C:\PROGRA~1\MATRIX~1\FLOWCO~3\Tools\MX_bats\..\C_tools\support\h" -I"C:\PROGRA~1\MATRIX~1\FLOWCO~3\Tools\MX_bats\..\MX_support" -Wall -std=gnu99 "1SEC_FLASH".c -o "1SEC_FLASH".o

Compilation successful!

Return code = 0

Launching the linker/assembler...
C:\Program Files\Matrix Multimedia\Flowcode PIC24&dsPIC V4\Tools\MX_bats\pic16_C30_link.bat "1SEC_FLASH" 30F2011 dsPIC30F

C:\Users\smartp\Documents>pic30-gcc -Wl,"1SEC_FLASH".o,-L"C:\PROGRA~1\MATRIX~1\FLOWCO~3\Tools\MX_bats\..\C_tools\lib",--heap=256,--report-mem,--script="C:\PROGRA~1\MATRIX~1\FLOWCO~3\Tools\MX_bats\..\C_tools\Support\dsPIC30F\gld\p30F2011.gld",-o"1SEC_FLASH".cof


Program Memory [Origin = 0x100, Length = 0x1f00]

section address length (PC units) length (bytes) (dec)
------- ------- ----------------- --------------------
.text 0x100 0x5aa 0x87f (2175)
.const 0x6aa 0x4 0x6 (6)
.text 0x6ae 0x646 0x969 (2409)
.dinit 0xcf4 0xc 0x12 (18)
.isr 0xd00 0x2 0x3 (3)

Total program memory used (bytes): 0x1203 (4611) 38%


Data Memory [Origin = 0x800, Length = 0x400]

section address alignment gaps total length (dec)
------- ------- -------------- -------------------
.ndata 0x800 0 0x4 (4)
.heap 0x804 0 0x100 (256)

Total data memory used (bytes): 0x104 (260) 25%


Dynamic Memory Usage

region address maximum length (dec)
------ ------- ---------------------
heap 0x804 0x100 (256)
stack 0x904 0x2fc (764)

Maximum dynamic memory (bytes): 0x3fc (1020)


C:\Users\smartp\Documents>pic30-bin2hex "1SEC_FLASH".cof

C:\Users\smartp\Documents>pic30-objdump -S "1SEC_FLASH".cof 1>"1SEC_FLASH".asm

HEX file creation successful!

Return code = 0

Launching the programmer...
C:\Program Files\Matrix Multimedia\Flowcode PIC24&dsPIC V4\tools\mLoader\mLoaderv3.exe -config -chip 30F2011 "1SEC_FLASH.hex"
Sending File, please wait!


...................

File sent with 1 warnings:

1: CONFIG failed to erase bits at [1f00000]

Contents of file are:

17 87 3F 00 33 87 FF FF FF FF FF FF 03 C0

Contents of chip are:

17 87 3F 00 33 87 0F 31 0F 33 07 00 03 C0



Return code = 0

FINISHED



4) the config screen has reference to 18F scripts is this normal - see below

Apart from these minor issues the product works reasonably well, however would like to understand more about the config and mloader.

appreciate the feedback

best regards

Pete
1SEC_FLASH.fcf_pic16
1 sec flasher for reference of config etc
(6 KiB) Downloaded 149 times
PICconfig screen.JPG
PICconfig screen with 18F scritps????
(127.21 KiB) Downloaded 1507 times
sorry about that Chief!

User avatar
Steve
Matrix Staff
Posts: 3111
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 89 times
Been thanked: 398 times
Contact:

Re: dsPIC/PIC24 observations/issues

Postby Steve » Thu Jul 14, 2011 9:19 am

A few of the issues you are seeing are due to changes with our config/programming utility "PPP". This used to perform both a configuration settings UI and a programming interface for PIC12, PIC16 and PIC18 devices.

We are gradually changing this "PPP" program so that it only works as a configuration utility. The programming functionality will be done by our "mLoader" program.

The version of "PPP" in the dsPIC/PIC24 variant of Flowcode is only used as a configuration utility, but seems to have a few hangups from its previous life as a programming utility. For this version of Flowcode you should ignore the "autodetect" button and the programming script data in the cofig utility.

The warnings about the config data can safely be ignored.

User avatar
petesmart
Valued Contributor
Valued Contributor
Posts: 395
Joined: Thu May 06, 2010 11:42 am
Location: Sydney, Australia
Has thanked: 190 times
Been thanked: 140 times
Contact:

Re: dsPIC/PIC24 observations/issues

Postby petesmart » Thu Jul 14, 2011 11:03 am

thanks Steve, do I need to do anything with PPP in terms of config?

Also... can you advise your timeframe for cleaning this bunch of issues up?

best

Pete
sorry about that Chief!

User avatar
Steve
Matrix Staff
Posts: 3111
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 89 times
Been thanked: 398 times
Contact:

Re: dsPIC/PIC24 observations/issues

Postby Steve » Thu Jul 14, 2011 11:19 am

All these issues will be looked at for the V5 release of Flowcode.

User avatar
petesmart
Valued Contributor
Valued Contributor
Posts: 395
Joined: Thu May 06, 2010 11:42 am
Location: Sydney, Australia
Has thanked: 190 times
Been thanked: 140 times
Contact:

Re: dsPIC/PIC24 observations/issues

Postby petesmart » Thu Jul 14, 2011 11:24 am

sorry to be persistant.....approximate timing for V5?...and,

can you assist with help on the arithmatic function syntax in the calculations? The help file does not match the listed calculation functions, I am attempting x to the power of y for example and getting very odd results...

appreciate if you could tell me what the compiler is so i can follow up on the manual/instruction set for reference...

thanks

Pete
Last edited by petesmart on Thu Jul 14, 2011 11:57 am, edited 1 time in total.
sorry about that Chief!

User avatar
Benj
Matrix Staff
Posts: 14676
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4660 times
Been thanked: 4286 times
Contact:

Re: dsPIC/PIC24 observations/issues

Postby Benj » Thu Jul 14, 2011 11:55 am

Hello Pete,

do I need to do anything with PPP in terms of config?


Yes you still need to use PPP to setup your device configuration.

1: CONFIG failed to erase bits at [1f00000]


This message is saying that some of the config bits were not set correctly. These bits are simply the N/A bits and will not effect the operation of the device.

Therefore the issues with PPP are only superficial and will not stop you from doing anything.

approximate timing for V5?


We are aiming for around November time.

For your power function problem are you using integer or floating point variables with the function?

User avatar
petesmart
Valued Contributor
Valued Contributor
Posts: 395
Joined: Thu May 06, 2010 11:42 am
Location: Sydney, Australia
Has thanked: 190 times
Been thanked: 140 times
Contact:

Re: dsPIC/PIC24 observations/issues

Postby petesmart » Thu Jul 14, 2011 11:59 am

thanks Ben,

I'm using floating point....

also if possible can you tell me what the complier is so I can follow up on the manual and instruction set please...

all the best

Pete
sorry about that Chief!

User avatar
Benj
Matrix Staff
Posts: 14676
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4660 times
Been thanked: 4286 times
Contact:

Re: dsPIC/PIC24 observations/issues

Postby Benj » Thu Jul 14, 2011 12:05 pm

Hello Pete,

The compiler used is the Microchip C30 compiler.

Here is the section from the manual 16-Bit_Language_Tools_Libraries_51456d.pdf.

Description: Calculates x raised to the power y.
Include: <math.h>
Prototype: double pow(double x, double y);
Arguments: x the base
y the exponent
Return Value: Returns x raised to the power y (x^y).
Remarks: If y is 0, pow returns 1. If x is 0.0 and y is less than 0 pow returns inf and a domain error occurs. If the result overflows or underflows, a range error occurs.

Example:

Code: Select all

#include <math.h>  /* for pow            */
#include <stdio.h> /* for printf, perror */
#include <errno.h> /* for errno          */
int main(void)
{
  double x,y,z;
  errno = 0;
  x = -2.0;
  y = 3.0;
  z = pow (x, y);
  if (errno)
    perror("Error");
  printf("%f raised to %f is %f\n\n ", x, y, z);
  errno = 0;
  x = 3.0;
  y = -0.5;
  z = pow (x, y);
  if (errno)
    perror("Error");
  printf("%f raised to %f is %f\n\n ", x, y, z);
  errno = 0;
  x = 4.0;
  y = 0.0;
  z = pow (x, y);
  if (errno)
    perror("Error");
  printf("%f raised to %f is %f\n\n ", x, y, z);
  errno = 0;
  x = 0.0;
  y = -3.0;
  z = pow (x, y);
  if (errno)
    perror("Error");
  printf("%f raised to %f is %f\n\n ", x, y, z);
}


Output:
-2.000000 raised to 3.000000 is -8.000000
3.000000 raised to -0.500000 is 0.577350
Error: domain error
0.000000 raised to -3.000000 is inf
These users thanked the author Benj for the post:
petesmart (Thu Jul 14, 2011 12:20 pm)
Rating: 5%
 

User avatar
petesmart
Valued Contributor
Valued Contributor
Posts: 395
Joined: Thu May 06, 2010 11:42 am
Location: Sydney, Australia
Has thanked: 190 times
Been thanked: 140 times
Contact:

Re: dsPIC/PIC24 observations/issues

Postby petesmart » Thu Jul 14, 2011 12:32 pm

Thanks Ben, will let you know how I go.....

Microchip 16_bit compiler link for those who are interested..

http://ww1.microchip.com/downloads/en/DeviceDoc/51456E.pdf

best

Pete
These users thanked the author petesmart for the post:
Benj (Thu Jul 14, 2011 12:56 pm)
Rating: 5%
 
sorry about that Chief!

User avatar
petesmart
Valued Contributor
Valued Contributor
Posts: 395
Joined: Thu May 06, 2010 11:42 am
Location: Sydney, Australia
Has thanked: 190 times
Been thanked: 140 times
Contact:

Re: dsPIC/PIC24 observations/issues

Postby petesmart » Thu Jul 14, 2011 2:57 pm

Thanks Ben,

Works well now...

Code: Select all

//Variable declarations
volatile double FCV_X;
volatile double FCV_Y;
volatile double FCV_Z;
volatile short FCV_BIT;
volatile short FCV_OUT;
volatile short FCV_STEP_SPEED;



//Macro implementations

int main()
{
   
   //Initialisation
   ADPCFG = 0xffff;


   //Interrupt initialisation code
   
   //Connection Point
   //Connection Point: [A]: A
FCC_Main_A:
;


   //Calculation
   //Calculation:
   //  step_speed = 100
   //  x = 2.0
   //  y = 0.0
   //  bit = 0
   FCV_STEP_SPEED = 100;
   FCV_X = 2.0;
   FCV_Y = 0.0;
   FCV_BIT = 0;
   

   //Loop
   //Loop: While bit=8
   while (1)
   {
      //Calculation
      //Calculation:
      //  y = bit
      FCV_Y = FCV_BIT;
      

      //Calculation
      //Calculation:
      //  z = pow(x,y)
      FCV_Z = pow(FCV_X,FCV_Y);


The Microchip library doc was very helpful, noticed also that there is an option for powf which is float based.

float powf(float x,float y);

thanks again

bets regards

Pete
sorry about that Chief!

User avatar
Benj
Matrix Staff
Posts: 14676
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4660 times
Been thanked: 4286 times
Contact:

Re: dsPIC/PIC24 observations/issues

Postby Benj » Thu Jul 14, 2011 3:31 pm

Hi Pete,

Great glad you got it all working correctly :D thanks for letting me know.