Importing mB 7.2 projects

Beta Testing discussion on mikroBasic PRO for PIC.
Post Reply
Author
Message
Leolenny
Posts: 78
Joined: 06 Jun 2005 10:54
Location: Italy

Importing mB 7.2 projects

#1 Post by Leolenny » 24 Mar 2009 14:31

Hello all,

I've found the import wizard. I select the mB7.2 *.pbp project file, but only the main code is imported, all the modules are not imported. How can I import a full project with all its components?

Thanks
Leo

Copy'nPaste
Posts: 573
Joined: 25 Apr 2006 15:39
Location: Cape Town, South Africa

#2 Post by Copy'nPaste » 24 Mar 2009 19:35

Old modules don't seem to run under Pro.
You need to try and modify them yourself, or wait for the original author to kindly re-write them :-)
"Copy'nPaste"

Leolenny
Posts: 78
Joined: 06 Jun 2005 10:54
Location: Italy

#3 Post by Leolenny » 24 Mar 2009 21:12

auch.... (dho!)

being myself the autor, I'll keep playing with the pro version, but I believe I'll go on with the 7.2 version. It's out of my mind to re-write huge codes I have "under construction"!!!

I believe some compatibility must be provided, how can someone migrate to the new version if some of the codes are still in progress? On the other hand, is not worth to complete old codes with 7.2 and start new codes with Pro!

any comment from the forum & mE folk?
Leo

Copy'nPaste
Posts: 573
Joined: 25 Apr 2006 15:39
Location: Cape Town, South Africa

#4 Post by Copy'nPaste » 24 Mar 2009 21:38

Ouch :oops:
A thousand years from now I too might just be an "Author"

I must admit, the new way of setting up libraries, for lcd, keypad, and spi, the few projects that I'm starting to convert from old code, are a bit tedious, almost like Proton Basic, with its "declares"

Then, once you have your code sorted, nothing a bit of "Copy"nPaste" can't fix :twisted:
And the support from mE, well, does the phrase "runs circles around the opposition", ring a bell?
"Copy'nPaste"

Durango
Posts: 134
Joined: 11 May 2006 17:48
Location: Maryland USA

#5 Post by Durango » 25 Mar 2009 18:35

Leo and Copy and Paste,

Here is what I did to get my Modules to work in the new Pro Compiler.

First copy your module and place it the directory where you imported your project to.

There are two things to change:

1. Change the extension of the module to mbas
EX. from MY_SPI_Write.pbas
to MY_SPI_Write.mbas

2. Edit the file (Module) to put "prototypes" of the routines in the interface section above the keyword inplements.

EX. from

Code: Select all

module MY_SPI_Write

symbol SDO = 0                  ' GPIO bit # for SDO
symbol SCK = 1                  ' GPIO bit # for SCK


implements

dim count as byte

sub procedure MY_SPI_Write(dim temp as byte)
     for count = 7 to 0 step -1
           Delay_4us
           if testbit(temp,7) = 1 then Setbit (GPIO,SDO)
              else ClearBit (GPIO,SDO)
           end if
           Delay_4us
           SetBit (GPIO,SCK)
           Delay_10us
           ClearBit (GPIO,SCK)
           temp = temp<< 1
     next count
end sub

sub procedure MY_SPI_Write_Word(dim state as word)

     MY_SPI_Write(Hi(state))
     MY_SPI_Write(Lo(state))

end sub


end.
To

Code: Select all

module MY_SPI_Write

symbol SDO = 0                  ' GPIO bit # for SDO
symbol SCK = 1                  ' GPIO bit # for SCK

sub procedure MY_SPI_Write_Word(dim state as word)  ' *** Added these
sub procedure MY_SPI_Write(dim temp as byte)        ' *** Added these

implements

dim count as byte

sub procedure MY_SPI_Write(dim temp as byte)
     for count = 7 to 0 step -1
           Delay_4us
           if testbit(temp,7) = 1 then Setbit (GPIO,SDO)
              else ClearBit (GPIO,SDO)
           end if
           Delay_4us
           SetBit (GPIO,SCK)
           Delay_10us
           ClearBit (GPIO,SCK)
           temp = temp<< 1
     next count
end sub

sub procedure MY_SPI_Write_Word(dim state as word)

     MY_SPI_Write(Hi(state))
     MY_SPI_Write(Lo(state))

end sub


end.
This is what I did to get it to work for me.

Hope this helps, :)

Durango

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

#6 Post by zristic » 26 Mar 2009 15:34

Sorry for the import trouble.
The changes we introduced are in your best interest- they will make your code faster and more efficient. I believe that the price for that is worth paying.

Thank you Durango for the provided answer, I am sure it will help other forum users too.

Leolenny
Posts: 78
Joined: 06 Jun 2005 10:54
Location: Italy

#7 Post by Leolenny » 29 Mar 2009 20:17

Hi folk,

thanks to Durango, I can import now my old projects. In any case, for thoes who want to understand why we need to do what Durango explained, please have a look at the Module structures on the Help!!

now my here is my new issue: all my goto statements give the "identifier label_name not declared"

I checked the sintax, and seem correct. Also I verified if the PRO version has some differencies with respect to the 7 version, but none found. Any suggestion??? did someone experienced the same problem?

Leo

goran.marinkovic
mikroElektronika team
Posts: 265
Joined: 25 Nov 2008 09:09

#8 Post by goran.marinkovic » 31 Mar 2009 09:08

Hi,

Problem is fixed now, thanks for the report.

Regards

Post Reply

Return to “mikroBasic PRO for PIC Beta Testing”