I'm not want to disturb this interesting thread, https://sourceforge.net/p/gcbasic/discussion/579125/thread/07ad8a34/#1643/ac68
While reading it, it came in my mind, it would be good to have one or two Pages ready for long standing Picaxe Users who want give Great Cow BASIC a try.
As I found in reading the discussion above there are several behavior which was used and good practise in Picaxe.
But this is not advised and not supported here. So who of the ex Picaxe users will become fame and write the ultimative Change_from_Picaxe_to_Great_Cow_BASIC Document?
I'm sure here is enough wisdom about this way.
I will take it and build a nice Page for our growing homepage.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think rather than a document how to translate from PICAXE BASIC to GCBASIC, there ought to be an app that does that since the PIN definitions are explicit in PICAXE BASIC translating to GCBASIC should be fairly straight forward.
For a newbie to GCBASIC like myself, I can't wait to get into the "demo" code and start learning GCBASIC, but I have hundreds of PICAXE BASIC programs I'd like to translate over to GCBASIC, but I also have new programs to develop so spending hours manually translating programs is out of the question.
IF I'm lucky, my PICKit3 programming port part will be here in a couple of weeks and I can get started with GCBASIC.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anything is possible.... a quick awk program should do it
Got some example programs?
It would be easy to knock up the basic tool. And, then, hand over to you.
How to handle frequency changes ? As this was to get around limitations of the language
How to handle strings?
How to handle variables? In PICAXE you have limitations on the number.... in other languages that limit is not imposed
How to handle interrupts ? In PICAXE you have time slicing that pretends... real interrupts are much more easier to understand.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Having converted a fair few PicAxe programs over to Great Cow Basic...
I originally tried doing a search and replace of various keywords (Endif to End If, Pause to Wait and so on) then attempted to rewrite individual commands into the correct sequence. Attempt to compile, find and remove errors. Recompile, remove more errors and so on into a working program.
The second approach was to print out the PicAxe program, use the program flow as inspiration but start again from scratch.
The second approach resulted in a better, faster GCB program in less time than attempting to modify an original into a compatible one.
Conversion of a simple PicAxe program might be feasible by using a script, but in my opinion you'd be better of doing a total rewrite.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
An app to do pin definitions should not be too difficult. The obstacle, as I see it, is finding someone that both able and willing to do it.
However, writing an app or script that can take an advanced Picaxe BASIC program (PE6) and spit out an equivalent Great Cow BASIC program would be like writing a new compiler from scratch.
I basically stopped using Picaxe for my own projects in Oct, 2013. Looking at my archives, the last Picaxe program I wrote was a "wireless programmer" using a Picaxe 20X2 to program another Picaxe over a wireless link with some LC-1000 wireless transceivers. As I look at the Picaxe code now, It seems I have forgotten quite a bit about Picaxe Basic. So I am not the guy to do this.
Like mkstevo, for programs I wanted to convert to GCB, I found it easier to just rewrite the code than to try to convert it with scripts and such. I had the Picaxe Code open on one display and GCB on another and used the Picaxe Basic as a reference as I wrote the GCB.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I try to lure picaxe users to GCB as it's Basic can be simple like sinclair basic or be clever and more difficult like bbc basic were in the '80's.
Picaxe is interpreted and so is the inline assembler.
GCB creates better assembler than I could write...it's been over 30 years since I used assembler code.
I am not the only one who "forgets" how a system works when not used. Like my 3D printers and the software like Cura.
It would be easy to convert your own picaxe code to gcb but not translating someone else's program.
I'd go with @williamroth's suggestion. ie if you know picaxe commands then how to convert to gcb would be easier than if you've forgotten picaxe.
Personally I'd just use gcb... with an arduino 328 or cheap clone because they have 2k ram for variables and lots of program memory (ok the bootloader uses a bit). USB plug and play on windows.
But with gcb there's loads of pic/avr supported so plenty of choice.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Exactly, we should not suspect that we are luring users. Something like this always goes backwards.
But it is obvious, old habits are easily taken over, without questioning whether this makes any sense under changed circumstances.
Well, yes, of course, if somebody from any kind of system comes here, always with the How to do not to do's.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
a picaxe to gcb translation got no kudos. Not much to it but gcb changes...picaxe doesn't.
it's just re-naming stuff...as always. William did a routine to simulate picaxe send serial in gcb.
I can't remember picaxe after a year...looks complicated.
ps allure users, yes? no...they're in stasis or summat. They're clockwork...needs winding...forward in time
why did I bother with a model pic when I could have a real one? answers on a postcard to chuckle bros co bbc
Last edit: stan cartwright 2017-12-08
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
How about filling your Experiences with some whole sentences, maybe some wisdoms from others added here, we could present such "Howto-not-to-do" Article soon?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I got this and found gcb alternatives http://www.picaxe.com/BASIC-Commands
HSEROUT break, ({#}data,{#}data...) where it can be one line is different.
Would a list of differences/equivelents be of any interest?
My "worst" error was starting arrays in gcb from 0 instead of 1 as picaxe arrays start at 0. When you're working with a ssd1306 glcd, one byte makes a difference.
Emphasise "read the instructions and do not assume things"?
Last edit: stan cartwright 2017-12-09
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Here is a portion of a program for controlling the DF Player Mini MP3 player module. The first section is PicAxe basic:
ForTrack=$1ToMaxTracksForFolder=$1ToMaxFolderscmd=Play_FxxTxx'arg = varA'Track and Folder directly set the MSB and LSB through b2 and b3GosubSendPause500IfBUSY_PIN=0ThenIfTrack=1ThenIfMaxFolders=MaxFoldersThenLetMaxFolders=MaxFolders+1EndIfEndIfDoWhileBUSY_PIN=0Pause100LoopEndIfNextNextSend:SerTxd("$7E, $FF, $06, C",#Cmd,"C $00, F",#arg.msb,"F T",#arg.lsb,"T $EF",CR,LF)SetFreqBAUD_FREQPause10SerOutTX,BAUD,($7E,$FF,$06,cmd,$00,arg.msb,arg.lsb,$EF)SetFreqMDEFAULTReturn
And this is the (near) equivalent for playing just one track in Great Cow Basic:
Main:Wait1SSerial_Send(Volume,0x0)'these are constants declared elsewhere...Serial_Send(Disk_Set,Usb_Disk)'these are constants declared elsewhere...Wait4SSerial_Send(Play_FxxTxx,0x1,0x1)'these are constants declared elsewhere...Wait400mSIfPlayer_Busy=0ThenDo'Disk foundPlay_Track(1,1)DoWait100mSLoopUntilPlayer_Busy=1While0EndIfEndSubPlay_Track(FdrAsByte,TrkAsByte)'The Folder and track are deliberately'reversed below as folder needs sending'last to match the 'optional' parameter'in the serial out routine.Serial_Send(Play_FxxTxx,Trk,Fdr)EndSub'SerOut TX, BAUD, ( 0x7E, 0xFF, 0x06, cmd, 0x00, arg.msb, arg.lsb, 0xEF ) SubSerial_Send(CmdasByte,A_lsbasByte,OptionalA_msb=0x0)SerSend1,0x7eSerSend1,0xffSerSend1,0x06SerSend1,CmdSerSend1,0x00SerSend1,A_msbSerSend1,A_lsbSerSend1,0xefWait100mSSendAHigh'Idle High EndSub
There are syntactical differences in the way loops are constructed, minor differences in 'If...Then' statements (End If as opposed to EndIf). Variable declaration uses 'Dim' and Constants '#Define' as opposed to 'Symbol', Pause (and Pauseus) rather than Wait mS (Wait S and Wait uS) and so on but it isn't impossible to work through a PicAxe program line by line and make those changes. The major differences are naturally when it comes to the built in libraries such as the serial send routine used in the above examples. Even that isn't insurmountable with the generous help provided by kind members of this (and the PicAxe) forum(s).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Another difference is pause and pulsout are clock dependent in picaxe.
"PAUSEUS microseconds
- Microseconds is a variable/constant (0-65535) which specifies how many
multiples of 10 microseconds to pause (at 8MHz on X2 parts, else 4MHz)."
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Now, this is a good base for assembling a nice Article together. Is any candidate willing to do this?
We should not try to build a cookbook, but some conceptional hints are very much appriciated :-)
Last edit: bed 2017-12-11
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
;picaxe-
symbol pingecho = C.5
high pingecho ;high sets dir to out
pulsin pingecho,1,range ;pulsin sets dir to in
GCB would use the srf04 include-Added support for using same pin as ping and echo
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm not want to disturb this interesting thread, https://sourceforge.net/p/gcbasic/discussion/579125/thread/07ad8a34/#1643/ac68
While reading it, it came in my mind, it would be good to have one or two Pages ready for long standing Picaxe Users who want give Great Cow BASIC a try.
As I found in reading the discussion above there are several behavior which was used and good practise in Picaxe.
But this is not advised and not supported here. So who of the ex Picaxe users will become fame and write the ultimative Change_from_Picaxe_to_Great_Cow_BASIC Document?
I'm sure here is enough wisdom about this way.
I will take it and build a nice Page for our growing homepage.
As long as we pages for other compilers...
Hi,
I think rather than a document how to translate from PICAXE BASIC to GCBASIC, there ought to be an app that does that since the PIN definitions are explicit in PICAXE BASIC translating to GCBASIC should be fairly straight forward.
For a newbie to GCBASIC like myself, I can't wait to get into the "demo" code and start learning GCBASIC, but I have hundreds of PICAXE BASIC programs I'd like to translate over to GCBASIC, but I also have new programs to develop so spending hours manually translating programs is out of the question.
IF I'm lucky, my PICKit3 programming port part will be here in a couple of weeks and I can get started with GCBASIC.
Anything is possible.... a quick awk program should do it
Got some example programs?
It would be easy to knock up the basic tool. And, then, hand over to you.
How to handle frequency changes ? As this was to get around limitations of the language
How to handle strings?
How to handle variables? In PICAXE you have limitations on the number.... in other languages that limit is not imposed
How to handle interrupts ? In PICAXE you have time slicing that pretends... real interrupts are much more easier to understand.
Having converted a fair few PicAxe programs over to Great Cow Basic...
I originally tried doing a search and replace of various keywords (Endif to End If, Pause to Wait and so on) then attempted to rewrite individual commands into the correct sequence. Attempt to compile, find and remove errors. Recompile, remove more errors and so on into a working program.
The second approach was to print out the PicAxe program, use the program flow as inspiration but start again from scratch.
The second approach resulted in a better, faster GCB program in less time than attempting to modify an original into a compatible one.
Conversion of a simple PicAxe program might be feasible by using a script, but in my opinion you'd be better of doing a total rewrite.
An app to do pin definitions should not be too difficult. The obstacle, as I see it, is finding someone that both able and willing to do it.
However, writing an app or script that can take an advanced Picaxe BASIC program (PE6) and spit out an equivalent Great Cow BASIC program would be like writing a new compiler from scratch.
I basically stopped using Picaxe for my own projects in Oct, 2013. Looking at my archives, the last Picaxe program I wrote was a "wireless programmer" using a Picaxe 20X2 to program another Picaxe over a wireless link with some LC-1000 wireless transceivers. As I look at the Picaxe code now, It seems I have forgotten quite a bit about Picaxe Basic. So I am not the guy to do this.
Like mkstevo, for programs I wanted to convert to GCB, I found it easier to just rewrite the code than to try to convert it with scripts and such. I had the Picaxe Code open on one display and GCB on another and used the Picaxe Basic as a reference as I wrote the GCB.
I try to lure picaxe users to GCB as it's Basic can be simple like sinclair basic or be clever and more difficult like bbc basic were in the '80's.
Picaxe is interpreted and so is the inline assembler.
GCB creates better assembler than I could write...it's been over 30 years since I used assembler code.
I am not the only one who "forgets" how a system works when not used. Like my 3D printers and the software like Cura.
It would be easy to convert your own picaxe code to gcb but not translating someone else's program.
I'd go with @williamroth's suggestion. ie if you know picaxe commands then how to convert to gcb would be easier than if you've forgotten picaxe.
Personally I'd just use gcb... with an arduino 328 or cheap clone because they have 2k ram for variables and lots of program memory (ok the bootloader uses a bit). USB plug and play on windows.
But with gcb there's loads of pic/avr supported so plenty of choice.
Exactly, we should not suspect that we are luring users. Something like this always goes backwards.
But it is obvious, old habits are easily taken over, without questioning whether this makes any sense under changed circumstances.
Well, yes, of course, if somebody from any kind of system comes here, always with the How to do not to do's.
a picaxe to gcb translation got no kudos. Not much to it but gcb changes...picaxe doesn't.
it's just re-naming stuff...as always. William did a routine to simulate picaxe send serial in gcb.
I can't remember picaxe after a year...looks complicated.
ps allure users, yes? no...they're in stasis or summat. They're clockwork...needs winding...forward in time
why did I bother with a model pic when I could have a real one? answers on a postcard to chuckle bros co bbc
Last edit: stan cartwright 2017-12-08
How about filling your Experiences with some whole sentences, maybe some wisdoms from others added here, we could present such "Howto-not-to-do" Article soon?
I got this and found gcb alternatives http://www.picaxe.com/BASIC-Commands
HSEROUT break, ({#}data,{#}data...) where it can be one line is different.
Would a list of differences/equivelents be of any interest?
My "worst" error was starting arrays in gcb from 0 instead of 1 as picaxe arrays start at 0. When you're working with a ssd1306 glcd, one byte makes a difference.
Emphasise "read the instructions and do not assume things"?
Last edit: stan cartwright 2017-12-09
Sure, this is that what I did expected from such a "Howto-not-to-do" Article
Good start!
Here is a portion of a program for controlling the DF Player Mini MP3 player module. The first section is PicAxe basic:
And this is the (near) equivalent for playing just one track in Great Cow Basic:
There are syntactical differences in the way loops are constructed, minor differences in 'If...Then' statements (End If as opposed to EndIf). Variable declaration uses 'Dim' and Constants '#Define' as opposed to 'Symbol', Pause (and Pauseus) rather than Wait mS (Wait S and Wait uS) and so on but it isn't impossible to work through a PicAxe program line by line and make those changes. The major differences are naturally when it comes to the built in libraries such as the serial send routine used in the above examples. Even that isn't insurmountable with the generous help provided by kind members of this (and the PicAxe) forum(s).
Another difference is pause and pulsout are clock dependent in picaxe.
"PAUSEUS microseconds
- Microseconds is a variable/constant (0-65535) which specifies how many
multiples of 10 microseconds to pause (at 8MHz on X2 parts, else 4MHz)."
Now, this is a good base for assembling a nice Article together. Is any candidate willing to do this?
We should not try to build a cookbook, but some conceptional hints are very much appriciated :-)
Last edit: bed 2017-12-11
;picaxe-
symbol pingecho = C.5
high pingecho ;high sets dir to out
pulsin pingecho,1,range ;pulsin sets dir to in
GCB would use the srf04 include-Added support for using same pin as ping and echo