I always used PicBasic, a few months I'm doing a lot of work with the GCB and I'm learning to use it, it generates a larger HEX code PBP but has the advantage of creating a readable ASM and there are many libraries.
I have version 0.95.010 I did not understand whether charge automatically calibrating oscillator for PIC12F629, testing with the simulator seems not working, I was using this code:
'- LOAD calibration 1K internal oscillator
osccal = peek (0x3FF)
I do not understand why you can not store bytes of EEPROM in the HEX file as do all compilers without having to create a table that uses Code:
'- EEPROM PROGRAMMER
'ORG 0x2100 + 0x7F
'De 00
it would be convenient to implement this possibility that you fail with the above code.
you can use multi-line comments as in C.
I thank you and I apologize if I made all these requests.
Gigi
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Welcome - thanks for the positive feedback. Let us look at the considerations. No issue to to ask - if, you do not ask... we cannot make better!
Set OSCCAL. Thought we had fixed Great Cow BasIC to load the saved calibration data into OSCCAL register on Baseline PIC in fix [515]. Can you please post your explicit code example to help me understand?
ASM DE. We have had a few discussions on this. I do not remember where we ended up after the discussion but... you could.... generate the ASM using Great Cow BASIC then generate HEX using MPASM.
Multi-line comments as in C. I no not understand this one. Can you explain?
Pleasure,
Anobium
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It does not seem to read the value to be loaded. I tried with RealSimulator and is not loaded properly.
2) I read old posts but I feel very uncomfortable manually write the code in asm and pass it to MPLAB file.
3) simply meant something like / * --------- * / very useful when I have to remove a lot of lines of code for testing.
Gigi
' -- freq=4/4 1Mhz -- 1uS per istruzione#chip 12F629,4 'Velocità in Mhz oscillatore interno#config INTRC_OSC_NOCLKOUT, WDT_OFF, MCLR_Off, BOD_on, PWRT_on#option explicit 'dichiarazione variabile obbligatoria' -- EEPROM PROGRAMMER' ORG 0x2100 + 0x7F' de 00' - acquisisce il codice automaticamente (mettere Jmp poi accendere, dare TX' - telecomando entro 5 secondi, togliere Jmp)'==========================================================================='***** SETTAGGIO PORTE'Pin 1 - Vdd +5V#define IO GPIO.0 'pin_7 / OUT decode 1=ON#define Txc GPIO.1 'pin_6 / TX code#define P1 GPIO.2 'pin_5 / Pulsante TX 0=TX#define Jmp GPIO.3 'pin_4 / (solo input) JUMP code 0=auto-apprendimento#define Inp GPIO.4 'pin_3 / INP code rx433#define Led GPIO.5 'pin_2 / OUT led segnalazione 1=ON'Pin 8 - Vss GND'============ VARIABILI ===========================================#define Code_b 0x20 ' N. timedimCode(15)asbyte' MAX byte disponibili X ARRAYdimTemp2asbytedimTemp1asbytedimTempasbyteat50dimTemp3asbytedimWtempasworddimStatoasbyte' FLAG controllo errori ecc.'==== SETTAGGI DELLE PORTE DEL PIC I/O ======================reset:'CMCON = 7 'disabilitaComparatori(impostatoautomaticamente)'ANSEL = 0 'selezionacanaliADCorDIGITAL'ADCON0 = b'00000000'WPU=b'00001100'' PIN Pull-up 1=ON 0=OFF (bit3 non settabile)' -- CARICA calibrazione oscillatore interno 1K'osccal=peek(0x3FF)' -------- bit a bit controllo 0=output 1=input (bit3 non settabile)dirGPIOb'01011100'' bit a bit controllo 0=output 1=input' -- TIMER0'psa =0 : t0cs = 0 'attivatimer0OPTION_REG=b'11010010'' prescaler 1/8 step 10uS circa' -- TIMER1 'Timer1ON--prescaler/8't1con = b'00100000' ''TMR1GE = 1 'attivaPINT1Gate'SetTimer 1, ps1_8 'prescalerwait500ms' RITARDO impulsi spurido'/*' Multi-line comments as in C' Multi-line comments as in C' Multi-line comments as in C'*/loop
Last edit: Anobium 2016-11-13
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Try on a real chip. I cannot see why this is not working. Here is the ASM for your chip, shown below from v.0.95.010. If this does not work on a real chip then do let us know.
OK. We can think on this. Added to the list but no commitment on timing.
You can do this today in the IDE. See Edit/Toggle Comments in the IDE. But, ok I get the ask. We can think on this but I do not see this as being a priority item. Sorry.
Your code layout is nice. Nice to see a good layout of code - even with the Italian comments this is highly understandable.
Anobium
Last edit: Anobium 2016-11-13
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This example will load the third item from the table (6) into the variable Temp. The ReadTable command must have a variable for the location to do this - if we wrote "ReadTable TestTable, 3, Temp" the compiler would replace that with "Temp = 6" and would not download the table to the EEPROM.
Hopefully that helps!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It does not seem right to own the ASM code, since it does not load the W register the value that is in the last byte of memory. If you look at it datasheet says to do a call on this address:
A calibration instruction is programmed into the last
location of program memory. This instruction is a
RETLW XX,
where the literal is the calibration value.
The literal is placed in the OSCCAL register to set the
calibration of the internal oscillator. Example 9-1
demonstrates how to calibrate the internal oscillator.
EXAMPLE 9-1: CALIBRATING THE
INTERNAL OSCILLATOR
bsf STATUS, RP0 ;Bank 1
call 3FFh ;Get the cal value
movwf OSCCAL ;Calibrate
bcf STATUS, RP0 ;Bank 0
I just can also testing a pic, I thank the great willingness to improve this compiler open to all.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
We fixed this on baseline chips, however 4 chips slipped through the cracks, These are:
12f629, 12f675, 16f630, 16f676
These chips do not automatically execute MOVLW xx upon reset like the baseline models, Therefore code must call the last address which is a RETLW xx where xx is the calibration data byte.
The last address on these chips is 0x3ff.
As a work around try adding the following as the first lines in BASIC source code.
call 0x3ff
movwf OSCCAL
The chips noted above are family 14 where the baseline are family 12. It should be possible to modity system.h initsys
The system.h as been updated to support the chips noted above. Download this file to replace your existing system.h, then test. Let us know the result as I have none of these chips to test.
As a GCB forum nube I'm curious. When file updates / fixes like this (system.h) occur do email alerts get sent to alert the membership of the changes?
Regarding "Block Commenting":
I too would like to see block commenting. It would also be much more convenient to put commenting options in the mouse right click menue. This will also make block commenting and un-commenting easy by just selecting sequential lines.
I'm also curious... What language is GCB developed in?
Thanks,
Chris
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Updates to Great Cow BASIC come via the releases we publish.
The smaller patches will be provided to resolve specific issues and we may decide to publish the URL to the new patch or we may decide to only provide the URL to specific users. But, we always wrap up all the changes into the releases we publish.
If we patch the compiler, we typically send a download URL to the specific user. Again, we always wrap up all the changes into the releases we publish.
Regarding "Block Commenting" we are not the design authority. So, I think these good thoughts need to be addressed to the developers of the SynWrite application which the IDE is based upon.
What language is GCB developed in? Freebasic
Hope this helps.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Help. I will update the online Help when I get updates to the Help files. I may, if I remember, post the updated Help to the web site. But, we always wrap up all the changes into the releases we publish.
Demos. I do update the Demos when there is something interesting available. But, we always wrap up all the changes into the releases we publish.
Hot Releases. These are the releases I publish as we prepare for the next release. I have a trusted set of developer users that test functionality, edit the Help, create/edit Demos etc. etc. I publish Hot Releases via the Developer Forum. This forum is not avaliable unless you are classified as a Developer. Hot Releases, the early ones, are a tad painful. Things break and I often change daily - so, there is work to be done tidying up your local system to ensure you get clean installs. But, as always.... Hot Releases become releases then I wrap up all the changes and publish.
Also, a lot of the processes to release are automated. But, there is a lot of work managing and the co-ordinating activities. We make mistakes - we learn and get better all the time - but, we do make mistakes. Be patience. :-)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Regarding "Block Commenting":
I too would like to see block commenting.
Block Commenting has always been a part of SynWrite (The GCBasic IDE) but for some reason unbeknown to the GCBasic Team the SynWrite Team renamed it in the latest release.
Select the Block of text that you wish to Comment / Uncomment and press:
CTRL+ALT+/
Or the MENU sequence:
Edit->Comments->Toggle Line Comment
Cheers (the other)
Chris
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anobium & William Roth,
thanks for having solved this little OSCAL problem only affects some of the old PIC12F but that I use with satisfaction, even look forward to the possibility of storing in EEPROM few bytes without having to create a table is really useful and possible in all compilers.
Gigi
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The eeprom data can be handled without a table, but there are hoops to jump through! For less than $0.10 a much newer device with more program memory and peripherals can be had, making this excercise un-necessary.
For the hoop jumpers low on program memory. The premise is to use MPASM as a go between the GCBasic compiler and SYNWrite IDE, and the MPLAPX IDE.
The MPASM assembler option was used by revising the G+STools/MakeHex.bat file. The inbuilt GCASM would also probably work without this step, but that is not the way the proof of concept was tested.
After the GCBasic program was compiled, the .asm file was imported into the newly created MPLABX project as a source file. The .asm file was opened then appended for the eeprom data. The eeprom data will be inserted into the MPLABX hex file after a Clean and Build of the project.
Right click the project, properties, mpasm, and make sure the case sensitive box is unchecked, prior to build.
Import the MPLABX .hex file to the programmer and write. Bingo, there is the eeprom data in the PK2 eeprom window. Pic 18's and other devices could have a different eeprom start point, see the MPASM assembler pdf.
I always used PicBasic, a few months I'm doing a lot of work with the GCB and I'm learning to use it, it generates a larger HEX code PBP but has the advantage of creating a readable ASM and there are many libraries.
I have version 0.95.010 I did not understand whether charge automatically calibrating oscillator for PIC12F629, testing with the simulator seems not working, I was using this code:
'- LOAD calibration 1K internal oscillator
osccal = peek (0x3FF)
I do not understand why you can not store bytes of EEPROM in the HEX file as do all compilers without having to create a table that uses Code:
'- EEPROM PROGRAMMER
'ORG 0x2100 + 0x7F
'De 00
it would be convenient to implement this possibility that you fail with the above code.
you can use multi-line comments as in C.
I thank you and I apologize if I made all these requests.
Gigi
Welcome - thanks for the positive feedback. Let us look at the considerations. No issue to to ask - if, you do not ask... we cannot make better!
Pleasure,
Anobium
Thank you for your quick response
1) I put at the end of test code, the product ASM oscillator is:
It does not seem to read the value to be loaded. I tried with RealSimulator and is not loaded properly.
2) I read old posts but I feel very uncomfortable manually write the code in asm and pass it to MPLAB file.
3) simply meant something like / * --------- * / very useful when I have to remove a lot of lines of code for testing.
Gigi
Last edit: Anobium 2016-11-13
Ok. Here goes.
Anobium
Last edit: Anobium 2016-11-13
You can store data in EEPROM using a data table - add "store data" to the end of the table definition. Here is a small example:
This example will load the third item from the table (6) into the variable Temp. The ReadTable command must have a variable for the location to do this - if we wrote "ReadTable TestTable, 3, Temp" the compiler would replace that with "Temp = 6" and would not download the table to the EEPROM.
Hopefully that helps!
It does not seem right to own the ASM code, since it does not load the W register the value that is in the last byte of memory. If you look at it datasheet says to do a call on this address:
A calibration instruction is programmed into the last
location of program memory. This instruction is a
RETLW XX,
where the literal is the calibration value.
The literal is placed in the OSCCAL register to set the
calibration of the internal oscillator. Example 9-1
demonstrates how to calibrate the internal oscillator.
EXAMPLE 9-1: CALIBRATING THE
INTERNAL OSCILLATOR
bsf STATUS, RP0 ;Bank 1
call 3FFh ;Get the cal value
movwf OSCCAL ;Calibrate
bcf STATUS, RP0 ;Bank 0
I just can also testing a pic, I thank the great willingness to improve this compiler open to all.
Test a pic please.
We fixed this on baseline chips, however 4 chips slipped through the cracks, These are:
12f629, 12f675, 16f630, 16f676
These chips do not automatically execute MOVLW xx upon reset like the baseline models, Therefore code must call the last address which is a RETLW xx where xx is the calibration data byte.
The last address on these chips is 0x3ff.
As a work around try adding the following as the first lines in BASIC source code.
The chips noted above are family 14 where the baseline are family 12. It should be possible to modity system.h initsys
The system.h as been updated to support the chips noted above. Download this file to replace your existing system.h, then test. Let us know the result as I have none of these chips to test.
https://sourceforge.net/p/gcbasic/code/HEAD/tree/GCBASIC/trunk/include/lowlevel/system.h
Last edit: William Roth 2016-11-14
As a GCB forum nube I'm curious. When file updates / fixes like this (system.h) occur do email alerts get sent to alert the membership of the changes?
Regarding "Block Commenting":
I too would like to see block commenting. It would also be much more convenient to put commenting options in the mouse right click menue. This will also make block commenting and un-commenting easy by just selecting sequential lines.
I'm also curious... What language is GCB developed in?
Thanks,
Chris
Great questions.
Hope this helps.
And,
Also, a lot of the processes to release are automated. But, there is a lot of work managing and the co-ordinating activities. We make mistakes - we learn and get better all the time - but, we do make mistakes. Be patience. :-)
Block Commenting has always been a part of SynWrite (The GCBasic IDE) but for some reason unbeknown to the GCBasic Team the SynWrite Team renamed it in the latest release.
Select the Block of text that you wish to Comment / Uncomment and press:
CTRL+ALT+/
Or the MENU sequence:
Edit->Comments->Toggle Line Comment
Cheers (the other)
Chris
Here is the link... http://synwrite.sourceforge.net/forums/
When it is update... can someone check out that all the existing IDE functionality still works. :-)
Chris, thanks for the tip! That will do just fine.
Anobium, thanks for the updates info and the link to the synwrite forum.
Chris
Anobium & William Roth,
thanks for having solved this little OSCAL problem only affects some of the old PIC12F but that I use with satisfaction, even look forward to the possibility of storing in EEPROM few bytes without having to create a table is really useful and possible in all compilers.
Gigi
Good to hear that William's fix works.
The eeprom data can be handled without a table, but there are hoops to jump through! For less than $0.10 a much newer device with more program memory and peripherals can be had, making this excercise un-necessary.
For the hoop jumpers low on program memory. The premise is to use MPASM as a go between the GCBasic compiler and SYNWrite IDE, and the MPLAPX IDE.
The MPASM assembler option was used by revising the G+STools/MakeHex.bat file. The inbuilt GCASM would also probably work without this step, but that is not the way the proof of concept was tested.
After the GCBasic program was compiled, the .asm file was imported into the newly created MPLABX project as a source file. The .asm file was opened then appended for the eeprom data. The eeprom data will be inserted into the MPLABX hex file after a Clean and Build of the project.
Right click the project, properties, mpasm, and make sure the case sensitive box is unchecked, prior to build.
Import the MPLABX .hex file to the programmer and write. Bingo, there is the eeprom data in the PK2 eeprom window. Pic 18's and other devices could have a different eeprom start point, see the MPASM assembler pdf.