As many users are aware, the Arduino community out there is pretty big.
Many are also aware that the Arduino code is (generally) more cryptic than Great Cow Basic (GCB) and its compiled code (generally) runs slower than GCB.
Also, Arduino locks you in to a smallish number of microcontrollers.
I ask myself why Arduino, when there is a cheaper, faster & easier solution?
One of the main reasons (apart from Google having its hand in developing some of the code) I believe is because the maker community loves playing around with sensors, detectors etc.
After 10 years promoting GCB on YouTube, Evan has 850 subscribers. Wouldn't it be nice to increase this 10 fold (or more)?
So, I'm proposing a new project to help promote the usefulness of GCB out there in the maker community.
Evan has just finished a YouTube playlist using the PIC18FxxQ10 series of supported chips.
I'll supply Evan with an Acrel ADL200 Single phase energy meter (the ADL400 3 phase meter is also available). These are low cost DIN rail power meters that are approved for billing customers in many countries around the world, including the EU & USA. They are bidirectional (ie they record both import power from the grid & solar export power to the grid), along with displaying the voltage, current, frequency, PF etc.
All the data is accessed via modbus-RTU running over an rs-485 data link.
The PIC18FxxQ10 are ideally suited to this application, having an enhanced AUSART on board.
Many sensors use modbus for communications as it can be run reliably over long distances.
We buy the Acrel ADL200 energy meters direct from Acrel & have found them to be good value & very reliable. Currently we access the data using an STM32G071 which acts as the master with the ADL200 acting as the slave. We request the currently stored information from the registers in the ADL200 as we need it. Hardware decisions are then made along with displaying the information on an OLED.
The PIC18F25Q10 (for instance) is available in SOIC-28 which suits 2 to 3oz copper boards (which is chosen as there is power switching components on the same pcb).
I'm putting this out there for discussion. There needs to be interest from others & obviously Evan would have to agree & have the time to do the project. If he has, he might also have time to make a good video for uploading to YouTube.
I have a working modbus library (as server) ready (based on Mike's code), and also I have some PCB boards designs that could help to this project. currently I have tested the library on rs232, rs485, and modbus tcp-ip
about Arduino Vs GCB: I have the same thinking, I truly believe that GCB deserves a lot of attention, I think that the project needs a little push with a clever marketing plan
I also have a kind of project on the make called NEXUS with the idea of unite our community and get more development for the GCB project.
we have a great software, but I think that may be we need our own hardware that could help us to make projects faster and in a more professional way.
I truly think that we can male GCB exceptional.
Angel.
👍
2
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
GCBASIC becomes more and more powerful and its libraries are also more and more complete.
Once you add structure management (struct) I think it has no rivals in its field.
Last edit: Anobium 2024-12-22
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
A structure is a single variable that can contain several fields within it.
It can have strings, bytes, longs, integers, chars etc...
The more complex ones (for example C, MikroBasic, Visual Basic) can also contain other structures within them.
In Visual basic they are defined like this:
Type MyStruct
Data1 as byte
sData as string
LData as long
etc
End Type.
Dim StrucData as Mystruct
In essence, a consequential amount of memory corresponding to the total quantities of each variable is allocated, pointers are then created to each segment.
When one of the internal fields of the variable is used, the field is called with the name of the variable.
Example:
StrucData.sData.
The compiler must be able to point to these segments directly.
This feature is very useful for managing data, and for being able to store or transmit it, transmitting each single byte in sequence.
For example, if we need to store the configuration of one of our projects in eeprom, we just need to store the entire variable directly without needing to store every single element.
For fairly simple things (parameters all of one byte) I worked around by creating an array and naming each element with a name using a #define.
Example: configuration of any circuit
Address:
Define Config_Address Array (1)
Index:
Define Config_Index Array (2)
... and so on.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Structures. I fully understand. I was missing the context.
This is implementable. There would be many challenges but do other microcontroller BASIC implementations (such as MikroBasic or Proton) support structures?
Or, a better question may be ... what microcontroller BASIC implementations do support structures? This will would help understand the constraints.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The proton compiler does not seem to me that it implements data structures.
Mikrobasic instead supports them.
The following code is an example in Mikrobasic that I used in the program that manages the home automation plant and the anti -theft.
The first use to memorize and transmit very simple data packages.
The second, more complex, is used to define the RF 433MHz remote controls and sensors that use the PT2262 and HS1527 codes.
Among the variables inserted in this structure there is also a variable of the type defined in the previous structure (Dim MiaCod As StrutturaDatiMiaCod ).
In the very complex program (over 36000 lines) I use dozens of structures so you can manage, transmit and save the data much more comfortably.
Another basic compiler that uses the structures is the Swordfish compiler, this also provides for the use of Union.
========================================================================
' Struttura dei Dati relativi alla mia codifica.
' La trasmissione dei dati viene seguita da un preambolo: "PAF"
' ------------------------------------------------------------------------
Structure StrutturaDatiMiaCod
Dim Unit As Byte ' Unità di appartenenza
Dim Ind1 As Byte ' Indirizzo 1 RX
Dim Ind2 As Byte ' Indirizzo 2 RX
Dim Comando As Byte ' Comando trasmesso
Dim Param1 As Byte ' Parametro N° 1
Dim Param2 As Byte ' Parametro N° 2
Dim Param3 As Byte ' Parametro N° 3
Dim Param4 As Byte ' Parametro N° 4
Dim Param5 As Byte ' Parametro N° 5
Dim Param6 As Byte ' Parametro N° 6
Dim Sequenza As Byte ' Numero Sequenza trasmessa
Dim Crc As Byte ' Crc
End Structure
' -
Dim Dati As StrutturaDatiMiaCod Volatile
Const SIZEOF_DATI = SizeOf (Dati)
' --- FINE ---------------------------------------------------------------
' -
' -
' ========================================================================
' Telecomando o sensore memorizzato
' ------------------------------------------------------------------------
Structure Desc_TeleSens
Dim sMemo As String [12] ' Codice del TX
Dim Hs1 As Byte ' Primo Byte codice HS1527
Dim Hs2 As Byte ' Secondo Byte codice HS1527
Dim Hs3 As Byte ' Terzo Byte codice HS1527
Dim Hs4 As Byte ' Quarto Byte codice HS1527
Dim TipoCod As Byte ' Tipo di Codifica (*)
Dim Abilitato As Byte ' Se >0 è Abilitato
Dim SoloIndirizzo As Byte ' Se >0 verifica solo l'Indirizzo e non il dato
' Se deve ripetere usando la mia codifica
Dim TeleSensAb As Byte ' 0=Non usato, 1=Telecomando, 2=Sensore
Dim NumeroSens As Byte ' Se >0 è un Sensore. Puntatore al Numero di Sensore assegnato (SensoreNew)
Dim NumeroTele As Byte ' Se >0 è un Telecomando. Puntatore al Numero di Telecomando assegnato
' Ripeti il segnale come lo hai ricevuto, PT o HS
Dim RipetiPTHS As Byte ' Ripete nel formato ricevuto (PT, HS o Mia Codifica)
Dim RipetiMia As Byte ' Ripete e converte nel formato Mia Codifica
' Usato per la luce di emergenza. 07/07/2024
' Se = 0 NON USATO
' Se = 1 Accende
' Se = 2 Spegne
' Se = 3 Inverte ON/OFF
Dim LuceEmOnOff As Byte ' Accende/dspegne la luce di emergenza
' Ripete su un altro codice
Dim RipetiAltroCod As Byte ' Ripeti un altro codice
Dim TipoCodRip As Byte ' Tipo del codice ripetuto
Dim sMemoRip As String [12] ' Codice del TX
Dim Hs1Rip As Byte ' Primo Byte codice HS1527
Dim Hs2Rip As Byte ' Secondo Byte codice HS1527
Dim Hs3Rip As Byte ' Terzo Byte codice HS1527
Dim Hs4Rip As Byte ' Quarto Byte codice HS1527
Dim MiaCod As StrutturaDatiMiaCod ' Per trasmettere In mia codifica
' Riserva per future esigenze
Dim Riserva1 As Byte ' Riserva
Dim Riserva2 As Byte ' Riserva
Dim Riserva3 As Byte ' Riserva
Dim Riserva4 As Byte ' Riserva
Dim Riserva5 As Byte ' Riserva
' Stringhe inserite alla fine
Dim Descrizione As String [255]
End Structure
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks. Can you share an example of using the structure?
Clearly this defines an instance of the structure Dim Dati As StrutturaDatiMiaCod Volatile. How does address work ?
My guess is Dat1.Unit.
Please confirm.
As an insight - this is pseudo GCBASIC implementation. However, this will not work as you cannot create an array of strings. This test implementation shows the first step that needs to be resolved on the journey to structures... support for an array of strings as this is key to structure support.
This is a test program I have. See the program re string array handling.
#chip 16f877a
#option Explicit
#DEFINE USART_BAUD_RATE 9600
#DEFINE USART_TX_BLOCKING
#DEFINE USART_DELAY OFF
/*
Here's an example to demonstrate how you can achieve this:
Define a Structure:
Instead of using a single structure, you'll define parallel arrays to represent the structure fields.
*/// Define the maximum number of items#DEFINE MAX_ITEMS 10// Define parallel arrays for the structure fieldsDim IDs(MAX_ITEMS) As ByteDim Names(MAX_ITEMS) As String * 10 // Assuming name length is 10 characters .. this does not issue an error!!
Dim Ages(MAX_ITEMS) As Byte
/*
Access Structure Elements:
You can access the elements of the "structure" using the array index.
*/// Set values_index = 1IDs(_index) = _indexNames(_index) = "Alice"Ages(_index) = 25_index = 2IDs(_index) = _indexNames(_index) = "Evan"Ages(_index) = 69_index = 2// Get valuesDim id As ByteDim name As StringDim age As Byteid = IDs(_index)name = Names(_index) // Tis fails.. comment out to make compileage = Ages(_index)HserPrintByteCRLF IDHSerPrintStringCRLF nameHserPrintByteCRLF agePrintItem(_index)/*
Functions to Manipulate Structure:
You can create functions to manipulate the "structure" elements.
*/' Function to add a new itemSub AddItem( _index As Byte, _id As Byte, _namestr As string, _age As Byte) If _index < MAX_ITEMS Then IDs(_index) = _id Names(_index) = _namestr Ages(_index) = _age End IfEnd Sub' Function to print itemSub PrintItem( _index As Byte) If _index < MAX_ITEMS Then HSerPrint "ID: ": HSerPrint IDs(_index): HSerPrintCRLF HSerPrint "Name: ": HSerPrint Names(_index): HSerPrintCRLF HSerPrint "Age: ": HSerPrint Ages(_index): HSerPrintCRLF End IfEnd Sub/*
By using these parallel arrays and functions, you can effectively create and manipulate structures in GBBASIC.
Keep in mind that this approach has limitations compared to true structures in other programming languages,
but it's a practical workaround for organizing data in GCBASIC
*/
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, the initial pointer to the variable is that of the first field.
Then, to reach the second field you need to create the pointer to the second field.
To read or write in each of the fields of the structure, the compiler must create a descriptor (for each of the fields) which is inserted:
The name of the variable (Example: MyVar.Name)
The type of the variable (example string)
The length of the variable.
Every time the program refers to each of these variables, the compiler reads the pointer, type and length in bytes from the descriptor.
By creating a data structure it is much easier to access and store or send data serially.
For example, to send all the variables contained in a structure, simply point to the first address and sequentially send everything else.
During the reception phase it is equally simple, once you have read the entire sequence of data you have all the fields filled as in the origins.
With this system, for example, I read, modify and retransmit the configuration of my home automation control unit (many parameters) in a single step.
The same goes for all the other objects (Sensor, sensor type, HS or PT coding type, Description and method of use).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It is not needed and defeats the original goal of GCBASIC as a beginners tool to learn programming. Not to mention the privacy violation of handing over the entire library of user code, to a 3rd party, to data mine and use as a training tool for other AI's. Will they also gain access to user information?
I have no Idea of what BLOCKLY is so I can't comment directly but if it is an alternative to GCBASIC then again the question is why?
New controllers, Arrays and Structures are needed and should have been implemented prior to floats.
Compliments of the Season to all and keep up the good work.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
AI is the automation of knowledge that already exists.
The AI would support things like the automated adding of capabilities to a source program. Currently, the knowledge is in the Help and Demo programs. AI would learn from the existing knowledge base and reduce the learning curve.
The use of GCBASIC will be easier is AI engines like Claude, ChatGPT, CoPilot have consumed all the existing knowledge. At the moment Claude is very good at GCBASIC code generation the others are pretty poor.
Think of the AI in GCode as a quick way to find an existing demo and adapting to meet the new requirement.
I have been using Claude for a few months and it saves hours of development. I even used it fix an issue in the GCBASIC compiler - there are methods that I would not know existed without this help.
To quote Hugh - the learning was too hard, so Graphical GCB.
BACKGROUND
The compiler was created by Dr. Hugh Considine when he was 12 years old. That was in 2005. Hugh came up with the idea for a new compiler - of the then available compilers - they were hard to use and not free. And, he had some spare time.
Hugh believes that GCBASIC should be free to all - forever.
The original software was called Great Cow BASIC, but, he had some resistance in getting high schools in Australia to use and agree to the use of text based programming. Graphical GCBASIC was created to address the need for a graphical user interface. Graphical GCBASIC acts like a set of training wheels. The concept of Graphical GCBASIC is that the icons make it less scary, and since they all share names with the BASIC commands it is then easy to remember what command corresponds to each icon.. Using Graphical GCBASIC users can then switch to text mode whenever they want to, go backwards and forwards a few times if they want, and finally end up using just the text programming. It is a journey from a graphical user interface to text based programming.
Those who already have programming experience can go straight to GCBASIC, while those who would prefer a lighter learning curve can take the Graphical GCBASIC option. The two approaches targets two different sets of users who ultimately want to do the same thing.
The text based editor we have today was not of Hugh's making. It was Franks then Angels great work to provide the IDEs we have today. The design intent was for Graphical GCB to mask the compiler. However, this had a huge impact - the compiler had no constraints, syntax checking as all of this was done within Graphical GCB - I have spent years improving the syntax checking and adding debugging to the compiler to root out the lack of constraint checking and syntax checking.
Why is this important? AI help new users and it helps experienced developers.
You raise a great point about privacy.
We will need a piece of work to address the issues ( not limited to the following but this is off the top of my head) so we can advised users. There are no answers today - this needs to part of the project.
Data collection and consent
AI bias and discrimination
Surveillance and monitoring.
Transparency and control issues
Economic inequality and access to privacy
Security risks and data breaches
Re priorities
In the past years no one got to vote on the order of things. I published what I thought we would get time to do.
New controllers - unless I can get Nuvoton to help then there will be no 8051 new microcontrollers. I have been trying and trying for over 6 months. It is hard to support, documentation, example hardware and an assigned engineer - without paying. If Nuvoton do not want to support... no new 8051s.
String Arrays - no one asked from them directly. I know they are a prerequisite to structures.
Structures and therefore Pointers - on the list a huge job.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In terms of priority, in my opinion, string arrays and structures are more important.
These features would complete the compiler and bring it to the level of other more renowned (and expensive) compilers.
👍
1
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
String array is very useful. I think the same memory management policy used for structures can also be used to manage a string array.
A pointer is associated with the name of the variable, its type and its length.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, however, string array would come first. I would need to fully understand how the existing variables are managed. I have not.been into this part of the compiler.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
@Anobium - Your offer of time & expertise to work on a new project to measure grid import & solar export should bring in new users to experience the ease & power of Great Cow Basic (GCB).
I'll reach out separately to organise 2 x ADL200 power meters to go to the UK for you. Normally they come with random (slave) addresses to identify them. We order the power meters with the same slave address as this speeds up our production.
@Angel Mier - Thank you for offering your expertise using Mike's (mmotte) modbus code. Turning this into an easy to use GCB library would be great. This way the user will just need to define the ports & slave address etc, with all of the hard work being done in the background.
The Arduino community is both large & active. I suspect that having a range of "motherboards" and add-on "shields" (for LAN, wifi, Bluetooth, soil moisture/sound/light measurements etc) brings in many different users. Remember that Arduino started with just one "motherboard", the Arduino Serial.
Any further suggestions relating to what they would like to see in this new project are welcome.
👍
2
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have installed several Acrel ADW300 electricity meters in the company I work for - Stena Line. Acrel offers its own cloud service and application. But this is a secondary service for me. I still use Modbus reading using RS485 / ETH converters and I have programmed a Weintek display / server for data reading. Acrel really offers cheap electricity meters, for various needs and functions.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Excellent work Evan! Thank you for all your hard work on this project.
Great idea to publish the project & its progress on ko-fi.com
I'll send you a video of the scrolling LCD information that we currently collect from the Acrel ADL200. This might give you some ideas, but certainly is not set in concrete, so feel free to display whatever information you choose on the LCD for this project.
👍
1
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
As many users are aware, the Arduino community out there is pretty big.
Many are also aware that the Arduino code is (generally) more cryptic than Great Cow Basic (GCB) and its compiled code (generally) runs slower than GCB.
Also, Arduino locks you in to a smallish number of microcontrollers.
I ask myself why Arduino, when there is a cheaper, faster & easier solution?
One of the main reasons (apart from Google having its hand in developing some of the code) I believe is because the maker community loves playing around with sensors, detectors etc.
After 10 years promoting GCB on YouTube, Evan has 850 subscribers. Wouldn't it be nice to increase this 10 fold (or more)?
So, I'm proposing a new project to help promote the usefulness of GCB out there in the maker community.
Evan has just finished a YouTube playlist using the PIC18FxxQ10 series of supported chips.
I'll supply Evan with an Acrel ADL200 Single phase energy meter (the ADL400 3 phase meter is also available). These are low cost DIN rail power meters that are approved for billing customers in many countries around the world, including the EU & USA. They are bidirectional (ie they record both import power from the grid & solar export power to the grid), along with displaying the voltage, current, frequency, PF etc.
All the data is accessed via modbus-RTU running over an rs-485 data link.
The PIC18FxxQ10 are ideally suited to this application, having an enhanced AUSART on board.
Many sensors use modbus for communications as it can be run reliably over long distances.
We buy the Acrel ADL200 energy meters direct from Acrel & have found them to be good value & very reliable. Currently we access the data using an STM32G071 which acts as the master with the ADL200 acting as the slave. We request the currently stored information from the registers in the ADL200 as we need it. Hardware decisions are then made along with displaying the information on an OLED.
The PIC18F25Q10 (for instance) is available in SOIC-28 which suits 2 to 3oz copper boards (which is chosen as there is power switching components on the same pcb).
I'm putting this out there for discussion. There needs to be interest from others & obviously Evan would have to agree & have the time to do the project. If he has, he might also have time to make a good video for uploading to YouTube.
So, what does the GCB community think?
Links of interest:
Anoop Kumar's project using PIC16F15244 to communicate using modbus-RTU via rs-485 hardware link
https://github.com/microchip-pic-avr-examples/pic16f15244-spi-rs485-bridge-modbus-host-emulation-mplab-mcc
mmotte (Mike) discussion (& GCB code) for communicating with modbus-RTU over rs-485
https://sourceforge.net/p/gcbasic/discussion/629990/thread/9b060bda/?limit=250#4ca3
Acrel ADL200 Single phase power meter
https://www.acrel-electric.com.au/adl200-single-phase-energy-meter-product/
Modbus overview
https://www.rtautomation.com/technologies/modbus-rtu/
Modbus specifications (open source protocol)
https://www.modbus.org/docs/Modbus_over_serial_line_V1.pdf
I am up for this!
I am trying to get the YouTube followers and viewing hours up as this would then fund GCBASIC. 8500 users would be wonderful.
2025 will be an interesting year for the project. :-)
I have a working modbus library (as server) ready (based on Mike's code), and also I have some PCB boards designs that could help to this project. currently I have tested the library on rs232, rs485, and modbus tcp-ip
about Arduino Vs GCB: I have the same thinking, I truly believe that GCB deserves a lot of attention, I think that the project needs a little push with a clever marketing plan
I also have a kind of project on the make called NEXUS with the idea of unite our community and get more development for the GCB project.
we have a great software, but I think that may be we need our own hardware that could help us to make projects faster and in a more professional way.
I truly think that we can male GCB exceptional.
Angel.
GCBASIC becomes more and more powerful and its libraries are also more and more complete.
Once you add structure management (struct) I think it has no rivals in its field.
Last edit: Anobium 2024-12-22
@Jackjames. Can you help me understand the structure management ?
Do you mean the creation of a management structure? or, something else?
A structure is a single variable that can contain several fields within it.
It can have strings, bytes, longs, integers, chars etc...
The more complex ones (for example C, MikroBasic, Visual Basic) can also contain other structures within them.
In Visual basic they are defined like this:
Type MyStruct
Data1 as byte
sData as string
LData as long
etc
End Type.
Dim StrucData as Mystruct
In essence, a consequential amount of memory corresponding to the total quantities of each variable is allocated, pointers are then created to each segment.
When one of the internal fields of the variable is used, the field is called with the name of the variable.
Example:
StrucData.sData.
The compiler must be able to point to these segments directly.
This feature is very useful for managing data, and for being able to store or transmit it, transmitting each single byte in sequence.
For example, if we need to store the configuration of one of our projects in eeprom, we just need to store the entire variable directly without needing to store every single element.
For fairly simple things (parameters all of one byte) I worked around by creating an array and naming each element with a name using a #define.
Example: configuration of any circuit
Address:
Define Config_Address Array (1)
Index:
Define Config_Index Array (2)
... and so on.
Structures. I fully understand. I was missing the context.
This is implementable. There would be many challenges but do other microcontroller BASIC implementations (such as MikroBasic or Proton) support structures?
Or, a better question may be ... what microcontroller BASIC implementations do support structures? This will would help understand the constraints.
The proton compiler does not seem to me that it implements data structures.
Mikrobasic instead supports them.
The following code is an example in Mikrobasic that I used in the program that manages the home automation plant and the anti -theft.
The first use to memorize and transmit very simple data packages.
The second, more complex, is used to define the RF 433MHz remote controls and sensors that use the PT2262 and HS1527 codes.
Among the variables inserted in this structure there is also a variable of the type defined in the previous structure (Dim MiaCod As StrutturaDatiMiaCod ).
In the very complex program (over 36000 lines) I use dozens of structures so you can manage, transmit and save the data much more comfortably.
Another basic compiler that uses the structures is the Swordfish compiler, this also provides for the use of Union.
========================================================================
' Struttura dei Dati relativi alla mia codifica.
' La trasmissione dei dati viene seguita da un preambolo: "PAF"
' ------------------------------------------------------------------------
Structure StrutturaDatiMiaCod
Dim Unit As Byte ' Unità di appartenenza
Dim Ind1 As Byte ' Indirizzo 1 RX
Dim Ind2 As Byte ' Indirizzo 2 RX
Dim Comando As Byte ' Comando trasmesso
Dim Param1 As Byte ' Parametro N° 1
Dim Param2 As Byte ' Parametro N° 2
Dim Param3 As Byte ' Parametro N° 3
Dim Param4 As Byte ' Parametro N° 4
Dim Param5 As Byte ' Parametro N° 5
Dim Param6 As Byte ' Parametro N° 6
Dim Sequenza As Byte ' Numero Sequenza trasmessa
Dim Crc As Byte ' Crc
End Structure
' -
Dim Dati As StrutturaDatiMiaCod Volatile
Const SIZEOF_DATI = SizeOf (Dati)
' --- FINE ---------------------------------------------------------------
' -
' -
' ========================================================================
' Telecomando o sensore memorizzato
' ------------------------------------------------------------------------
Structure Desc_TeleSens
Dim sMemo As String [12] ' Codice del TX
Dim Hs1 As Byte ' Primo Byte codice HS1527
Dim Hs2 As Byte ' Secondo Byte codice HS1527
Dim Hs3 As Byte ' Terzo Byte codice HS1527
Dim Hs4 As Byte ' Quarto Byte codice HS1527
Dim TipoCod As Byte ' Tipo di Codifica (*)
Dim Abilitato As Byte ' Se >0 è Abilitato
Dim SoloIndirizzo As Byte ' Se >0 verifica solo l'Indirizzo e non il dato
' Se deve ripetere usando la mia codifica
Dim TeleSensAb As Byte ' 0=Non usato, 1=Telecomando, 2=Sensore
Dim NumeroSens As Byte ' Se >0 è un Sensore. Puntatore al Numero di Sensore assegnato (SensoreNew)
Dim NumeroTele As Byte ' Se >0 è un Telecomando. Puntatore al Numero di Telecomando assegnato
' Ripeti il segnale come lo hai ricevuto, PT o HS
Dim RipetiPTHS As Byte ' Ripete nel formato ricevuto (PT, HS o Mia Codifica)
Dim RipetiMia As Byte ' Ripete e converte nel formato Mia Codifica
' Usato per la luce di emergenza. 07/07/2024
' Se = 0 NON USATO
' Se = 1 Accende
' Se = 2 Spegne
' Se = 3 Inverte ON/OFF
Dim LuceEmOnOff As Byte ' Accende/dspegne la luce di emergenza
' Ripete su un altro codice
Dim RipetiAltroCod As Byte ' Ripeti un altro codice
Dim TipoCodRip As Byte ' Tipo del codice ripetuto
Dim sMemoRip As String [12] ' Codice del TX
Dim Hs1Rip As Byte ' Primo Byte codice HS1527
Dim Hs2Rip As Byte ' Secondo Byte codice HS1527
Dim Hs3Rip As Byte ' Terzo Byte codice HS1527
Dim Hs4Rip As Byte ' Quarto Byte codice HS1527
Dim MiaCod As StrutturaDatiMiaCod ' Per trasmettere In mia codifica
' Riserva per future esigenze
Dim Riserva1 As Byte ' Riserva
Dim Riserva2 As Byte ' Riserva
Dim Riserva3 As Byte ' Riserva
Dim Riserva4 As Byte ' Riserva
Dim Riserva5 As Byte ' Riserva
' Stringhe inserite alla fine
Dim Descrizione As String [255]
End Structure
Thanks. Can you share an example of using the structure?
Clearly this defines an instance of the structure
Dim Dati As StrutturaDatiMiaCod Volatile
. How does address work ?My guess is
Dat1.Unit
.Please confirm.
As an insight - this is pseudo GCBASIC implementation. However, this will not work as you cannot create an array of strings. This test implementation shows the first step that needs to be resolved on the journey to structures... support for an array of strings as this is key to structure support.
This is a test program I have. See the program re string array handling.
Yes, the initial pointer to the variable is that of the first field.
Then, to reach the second field you need to create the pointer to the second field.
To read or write in each of the fields of the structure, the compiler must create a descriptor (for each of the fields) which is inserted:
The name of the variable (Example: MyVar.Name)
The type of the variable (example string)
The length of the variable.
Every time the program refers to each of these variables, the compiler reads the pointer, type and length in bytes from the descriptor.
By creating a data structure it is much easier to access and store or send data serially.
For example, to send all the variables contained in a structure, simply point to the first address and sequentially send everything else.
During the reception phase it is equally simple, once you have read the entire sequence of data you have all the fields filled as in the origins.
With this system, for example, I read, modify and retransmit the configuration of my home automation control unit (many parameters) in a single step.
The same goes for all the other objects (Sensor, sensor type, HS or PT coding type, Description and method of use).
This all makes sense from a high level understanding of the use case.
The challenge will be any implementation, of course.
And, time and resources.
The 2025 plan as it stands is:
What is your view on the order?
Last edit: Anobium 2024-12-24
Drop the AI.
It is not needed and defeats the original goal of GCBASIC as a beginners tool to learn programming. Not to mention the privacy violation of handing over the entire library of user code, to a 3rd party, to data mine and use as a training tool for other AI's. Will they also gain access to user information?
I have no Idea of what BLOCKLY is so I can't comment directly but if it is an alternative to GCBASIC then again the question is why?
New controllers, Arrays and Structures are needed and should have been implemented prior to floats.
Compliments of the Season to all and keep up the good work.
AI is the automation of knowledge that already exists.
The AI would support things like the automated adding of capabilities to a source program. Currently, the knowledge is in the Help and Demo programs. AI would learn from the existing knowledge base and reduce the learning curve.
The use of GCBASIC will be easier is AI engines like Claude, ChatGPT, CoPilot have consumed all the existing knowledge. At the moment Claude is very good at GCBASIC code generation the others are pretty poor.
Think of the AI in GCode as a quick way to find an existing demo and adapting to meet the new requirement.
I have been using Claude for a few months and it saves hours of development. I even used it fix an issue in the GCBASIC compiler - there are methods that I would not know existed without this help.
To quote Hugh - the learning was too hard, so Graphical GCB.
BACKGROUND
The text based editor we have today was not of Hugh's making. It was Franks then Angels great work to provide the IDEs we have today. The design intent was for Graphical GCB to mask the compiler. However, this had a huge impact - the compiler had no constraints, syntax checking as all of this was done within Graphical GCB - I have spent years improving the syntax checking and adding debugging to the compiler to root out the lack of constraint checking and syntax checking.
Why is this important? AI help new users and it helps experienced developers.
You raise a great point about privacy.
We will need a piece of work to address the issues ( not limited to the following but this is off the top of my head) so we can advised users. There are no answers today - this needs to part of the project.
Re priorities
In the past years no one got to vote on the order of things. I published what I thought we would get time to do.
New controllers - unless I can get Nuvoton to help then there will be no 8051 new microcontrollers. I have been trying and trying for over 6 months. It is hard to support, documentation, example hardware and an assigned engineer - without paying. If Nuvoton do not want to support... no new 8051s.
String Arrays - no one asked from them directly. I know they are a prerequisite to structures.
Structures and therefore Pointers - on the list a huge job.
In terms of priority, in my opinion, string arrays and structures are more important.
These features would complete the compiler and bring it to the level of other more renowned (and expensive) compilers.
I have thought on string array. They would have to be fixed length.
Would this be acceptable?
String array is very useful. I think the same memory management policy used for structures can also be used to manage a string array.
A pointer is associated with the name of the variable, its type and its length.
Yes, however, string array would come first. I would need to fully understand how the existing variables are managed. I have not.been into this part of the compiler.
@Anobium - Your offer of time & expertise to work on a new project to measure grid import & solar export should bring in new users to experience the ease & power of Great Cow Basic (GCB).
I'll reach out separately to organise 2 x ADL200 power meters to go to the UK for you. Normally they come with random (slave) addresses to identify them. We order the power meters with the same slave address as this speeds up our production.
@Angel Mier - Thank you for offering your expertise using Mike's (mmotte) modbus code. Turning this into an easy to use GCB library would be great. This way the user will just need to define the ports & slave address etc, with all of the hard work being done in the background.
The Arduino community is both large & active. I suspect that having a range of "motherboards" and add-on "shields" (for LAN, wifi, Bluetooth, soil moisture/sound/light measurements etc) brings in many different users. Remember that Arduino started with just one "motherboard", the Arduino Serial.
Any further suggestions relating to what they would like to see in this new project are welcome.
I have installed several Acrel ADW300 electricity meters in the company I work for - Stena Line. Acrel offers its own cloud service and application. But this is a secondary service for me. I still use Modbus reading using RS485 / ETH converters and I have programmed a Weintek display / server for data reading. Acrel really offers cheap electricity meters, for various needs and functions.
To support increase of the GCBASIC supporting community, I just promoted one of my GCB powered projects on Elektor Lab.
You can see it here: https://www.elektormagazine.fr/labs/electronic-retrofit-cnc-integration-zzero-z-axis-high-active-probe
Hopefully its will contribute to bring more people in our community.
Last edit: Fabrice Engel 2024-12-30
This is great article. Well done.
See for the introduction to the GCBASIC Acrel 200 project.
https://ko-fi.com/post/Exciting-New-Project-The-ADL200-Power-Manage-S6S41ETHTD
Excellent work Evan! Thank you for all your hard work on this project.
Great idea to publish the project & its progress on ko-fi.com
I'll send you a video of the scrolling LCD information that we currently collect from the Acrel ADL200. This might give you some ideas, but certainly is not set in concrete, so feel free to display whatever information you choose on the LCD for this project.