I would like to know if it is possible to translate the attached Oshonsoft Basic code listing into GCB format? The code drives an old Philips SAA1057 phase locked loop chip. I will post the data sheet in the next post. The listing is a bit long to post inline but I can do that if it is preferred. I just want someone experienced in GCB Basic to cast a quick eye over the code before I make an attempt at conversion. Thanks.
Is the fuse configuration handled elsewhere than in the source file? I'm used to having to write the fuse information explicitly into the source code listing (I mainly use CCS C compiler).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The config is automatically handled, but, it you want/need to change then you can use PICINFO. PICINFO with generate the correct config - that is compatible with GCBASIC, MPASM and PIC-AS assemblers.
Access PICINFO via Function Key <f4> and select PICINFO.</f4>
A config of 0x3f41 is the default with Code Protect = ALL, MCLRE=OFF, OSC=XT, PWRTE=ON
So, this tells me you have an external OSC and you want to protect the code.
'''GCBASICProgram.'''--------------------------------------------------------------------------------------------------------------------------------'''Description:SimpleGCBASICBlinkyprogram.'''ThisprogramputssometextonanLCD(LATER)'''Andmakes4LEDsflashrepeatablyinsequence.'''@authorDavidJSBriscoe'''@licenceGPL'''@version1.0'''@date16thDecember2023'''********************************************************************************#chip16F628a,4#optionExplicit#CONFIGCPD=OFF#CONFIGLVP=OFF#CONFIGMCLRE=ON#CONFIGOSC=INTOSCIO#CONFIGPWRTE=OFF#CONFIGWDTE=OFF#CONFIGCP=OFF#CONFIGBOREN=ON//! Set the port as an outputDIRPORTBOUT//! Set the LED onPORTB.3=1// --- lcd ini ---/*'LCD connection settings#define LCD_IO 4 #define LCD_NO_RW #define LCD_RS PORTA.2 #define LCD_Enable PORTA.3 #define LCD_DB4 PORTB.0 #define LCD_DB5 PORTB.1 #define LCD_DB6 PORTB.2 #define LCD_DB7 PORTB.3 */// Main Program/*Locate 1,0Print "Tube oscillator"Locate 2,0Print "Heater warmup"*/Do//! Rotate to shift the port values to the right. We use the carry bit to reset the sequenceROTATEPORTBRIGHT//! Set the port.bit to the value of C. This will only be 1 when the portb.0 is shifted to the carry by the ROTATEPORTB.3=C//! Wait 100 msWait100msLoop
I've used these PIC16F628A's in the past with assembly language and the comparator/s needed setting up. Is this done automatically in GCBASIC or do I have to include a line to do this?
I've not tested this on hardware yet, will do that next week. Are there any problems with GCBASIC when using an ICD3 programmer? I'm assuming I can program the *.hex files using MPLAB IPE V6.15? Thanks.
PS Is there a simulator or debugger included in GCB and where do I read about using it.
Last edit: David Briscoe 2023-12-16
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I can't find MPLAB-IPE ICD3 CLI for PIC using external power in programmer preferences. It has an add button and I don't mind doing some editing to a batch file or config file if that's whats needed. Just tell me how. Thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Do you see the following in Prefs Editor?
What version are you on ? Compile something.. post the top lines of the ASM file producd. It will look like this.. It will tell me loads of things.
Attached is my copy of the use.ini file in which I have added the contents of the 127 file just above the [toolvariables] section as requested. Give me about 15 mins while I have a brew and an apple. then I'll restart the IDE to see if there are any changes. Thanks.
The ICD3 line shows up at the bottom of the list now. I will test this over the Christmas break as I have an ICD3 here at home but I'll have to dig out my development board and grab a few 628a's that we dont use any more.
Does the PICKIT4 work as well? We have a few of those hanging around at work. Thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've used these PIC16F628A's in the past with assembly language and the comparator/s needed setting up. Is this done automatically in GCBASIC or do I have to include a line to do this?
It should be done for you. To check out what gets done automatically, compile the file and open the resulting .asm file. Find the routine labeled 'INITSYS'... here's what I get compiling your file:
Continuing with my original question about the Oshonsoft listing how would these variables be defined in GCBASIC?
Dim data(15) As Byte
Dim tlr As Byte
Dim deler As Word
Dim deler1 As Word
deler = 0
deler1 = 32768
Dim freq As Word
Dim freq1 As Word
Dim freqhun As Byte
Dim freqten As Byte
Dim ht As Byte
Are they EXACTLY the same? Here is the Oshonsoft reference
The next section is writing to and reading from the internal EEPROM
'---- firstime on ----
Read 0, freqhun
If freqhun < 87 Or freqhun > 108 Then
freqhun = 87
Write 0, freqhun
freqten = 50
Write 1, freqten
Endif
Read 1, freqten
freq1 = freqhun * 100 + freqten
According to the Oshonsoft help file in the link above Read and Write are aliases for EEPROM_Read and EEPROM_Write respectively. Are there any built in function/subroutines for the internal EEPROM for the 628A or do I have to create my own with the help of the examples? Thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I would like to know if it is possible to translate the attached Oshonsoft Basic code listing into GCB format? The code drives an old Philips SAA1057 phase locked loop chip. I will post the data sheet in the next post. The listing is a bit long to post inline but I can do that if it is preferred. I just want someone experienced in GCB Basic to cast a quick eye over the code before I make an attempt at conversion. Thanks.
Last edit: David Briscoe 2023-12-11
Here is the data sheet of the SAA1057.
Yes, the conversion is very practical.
I would rewrite major pieces of the program as things are easier in GCBASIC.
I would start with a blank project. And, start with following program. ( See the attachment.. it works).
And, then, when you have the LCD working you will have the confidence to develop the next piece.
Ask here as you may have questions. Folks will help.
Thanks. How does GCB handle these 2 lines
Define CONF_WORD = 0x3f41
AllDigital
Is the fuse configuration handled elsewhere than in the source file? I'm used to having to write the fuse information explicitly into the source code listing (I mainly use CCS C compiler).
The config is automatically handled, but, it you want/need to change then you can use PICINFO. PICINFO with generate the correct config - that is compatible with GCBASIC, MPASM and PIC-AS assemblers.
Access PICINFO via Function Key <f4> and select PICINFO.</f4>
A config of 0x3f41 is the default with Code Protect = ALL, MCLRE=OFF, OSC=XT, PWRTE=ON
So, this tells me you have an external OSC and you want to protect the code.
So, using PICINFO would generate
added to the example program as follows:
Thanks.
This is what i've got so far.
I've used these PIC16F628A's in the past with assembly language and the comparator/s needed setting up. Is this done automatically in GCBASIC or do I have to include a line to do this?
I've not tested this on hardware yet, will do that next week. Are there any problems with GCBASIC when using an ICD3 programmer? I'm assuming I can program the *.hex files using MPLAB IPE V6.15? Thanks.
PS Is there a simulator or debugger included in GCB and where do I read about using it.
Last edit: David Briscoe 2023-12-16
GBASIC will Turn off the comparator - this is the default setting
CMCON = 7
Programming. Yes, you can use ICD3 direct from GCCODE IDE leveraging MPLAB IPE.
Select
MPLAB-IPE ICD3 CLI for PIC using external power
in Programmer Preferences and drag to the top of the list.When you compile you can program with ease.
I can't find
MPLAB-IPE ICD3 CLI for PIC using external power
in programmer preferences. It has an add button and I don't mind doing some editing to a batch file or config file if that's whats needed. Just tell me how. Thanks.We dont use batch files any more.
Do you see the following in Prefs Editor?
What version are you on ? Compile something.. post the top lines of the ASM file producd. It will look like this.. It will tell me loads of things.
As requested
You are on a current toolchain.
Did you scroll down in Prefs Editor to find the programmer ?
But, as we do not upgrade/change the use.ini file. You may need to add this to the
C:\GCstudio\gcbasic\use.ini
file. See attachment(s).See specifically 1227 file.
Yes. Please find attached a screenshot of the full list presented.
Did you edit the USE.INI ?
You place just above the
[toolvariables]
section.Attached is my copy of the use.ini file in which I have added the contents of the 127 file just above the
[toolvariables]
section as requested. Give me about 15 mins while I have a brew and an apple. then I'll restart the IDE to see if there are any changes. Thanks.Last edit: David Briscoe 2023-12-16
My apologies....
This is from the master which is in your
GCstudio\use_in_master
folder.The ICD3 line shows up at the bottom of the list now. I will test this over the Christmas break as I have an ICD3 here at home but I'll have to dig out my development board and grab a few 628a's that we dont use any more.
Does the PICKIT4 work as well? We have a few of those hanging around at work. Thanks.
Yes, PK4 is should be shown.
PK4/5/ICD3 are all slow compared to PK2/PK3. Choose carefully... :-)
This post no longer appears to be stickied but is still well worth a read:
https://sourceforge.net/p/gcbasic/discussion/579126/thread/d648215933/
It should be done for you. To check out what gets done automatically, compile the file and open the resulting .asm file. Find the routine labeled 'INITSYS'... here's what I get compiling your file:
Continuing with my original question about the Oshonsoft listing how would these variables be defined in GCBASIC?
Are they EXACTLY the same? Here is the Oshonsoft reference
https://www.oshonsoft.com/picbasiccompilerreferencemanual.php#23
Thanks.
Last edit: David Briscoe 2023-12-17
The next section is writing to and reading from the internal EEPROM
According to the Oshonsoft help file in the link above Read and Write are aliases for EEPROM_Read and EEPROM_Write respectively. Are there any built in function/subroutines for the internal EEPROM for the 628A or do I have to create my own with the help of the examples? Thanks.
Have you looked at the Help?
EPREAD and EPWRITE do the same.
Looks the same, but, ensure these variables are not controlling the chip/mcu frequency as this is done via the
#chip <chip>, 'frequency'
See the Help for lots of details but note the Arrays are 1-based. The first element is element zero but your first element is at element 1.